modules changes for v6.2-rc1
Tux gets for xmass improving the average lookup performance of kallsyms_lookup_name() by 715x thanks to the work by Zhen Lei, which upgraded our old implementation from being O(n) to O(log(n)), while also retaining the old implementation support on /proc/kallsyms. The only penalty was increasing the memory footprint by 3 * kallsyms_num_syms. Folks who want to improve this further now also have a dedicated selftest facility through KALLSYMS_SELFTEST. Since I had to start reviewing other future kallsyms / modules enhancements by Nick Alcock (his stuff is not merged, it requires more work) I carefully reviewed and merged Zhen Lei's kallsyms changes through modules-next tree a bit less than a month ago. So this has been exposed on linux-next for about a month now with no reported regressions. Stephen Boyd added zstd in-kernel decompression support, but the only users of this would be folks using the load-pin LSM because otherwise we do module docompression in userspace. This is the newest code and was merged last week on modules-next. We spent a lot of time analyzing and coming to grips with a proper fix to an old modules regression which only recently came to light (since v5.3-rc1, May 2019) but even though I merged that fix onto modules-next last week I'm having second thoughts about it now as I was writing about that fix in this git tag message for you, as I found a few things we cannot quite justify there yet. So I'm going to push back to the drawing board again there until all i's are properly dotted. Yes, it's a regression but the issue has been there for 2 years now and it came up because of high end CPU count, it can wait a *tiny* bit more for a proper fix. The only other thing with mentioning is a minor boot time optimization by Rasmus Villemoes which deferes param_sysfs_init() to late init. The rest is cleanups and minor fixes. -----BEGIN PGP SIGNATURE----- iQJGBAABCgAwFiEENnNq2KuOejlQLZofziMdCjCSiKcFAmOX54cSHG1jZ3JvZkBr ZXJuZWwub3JnAAoJEM4jHQowkoinFSgP/AxBdTOljYoqHnIL2/5f7PO2epSUq4Yu h42kE7aQ9qbiR9Rq2piCmD0SmeroVBIfxoMJwxnTuUy5IeujLXe6mtt7nG7Z96H1 mFxBCF63LqE/VUp/bYTusJkOPLksmhK2tCo5zMEnrRuhDAMrbFRc/S3jGm15P3/v /hdzh384Ou4cEQPQY6nsMwSvYsuNeYAhE/BqhkrQ1LDOAgSGx8DUp4db7i1/gmxG PAu7CPJEdEGljSHhG7v7PmqYYAyhyMRsW2WkCndQUvpcfZ3Q5abMFMa+9DQuT0j9 VIJtIFMZzgC+wy+1HB2hdhVcfYj1cGul0DIKugbJ9obTrIEiB8BFSaNluZroKXkU MIB/rlQCU8kkiw5CocTwM7APHPyv5sZf97oYm9MHcRE2QYYq+o4XKul3Pl2vcEB7 Cetbdxv+rUGl4Qm0U9AbXzZijwOnRu0XZShy4FTjwhipBSER93hGzYph9beSS+sb QLnDK1c6fATT9Ye95w9Oq7/4wdK5yDifRLwA57qo4oKNz4F4MhToPcIQbhLtU2IC NHWa5udylfbpNf2MnpCw0040b1hUV8atUxwZ2kBMPH/5bodXzQBKZkQEpzdPyOD8 sihPRlVmiVVXwRMxtQtFZXpb4l9Zg9YTEFMAA1ixgT1Gefh1VjAMAfOmy/hqiqBp x5CXDwftRckB =acEB -----END PGP SIGNATURE----- Merge tag 'modules-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux Pull modules updates from Luis Chamberlain: "Tux gets for xmas an improvement to the average lookup performance of kallsyms_lookup_name() by 715x thanks to the work by Zhen Lei, which upgraded our old implementation from being O(n) to O(log(n)), while also retaining the old implementation support on /proc/kallsyms. The only penalty was increasing the memory footprint by 3 * kallsyms_num_syms. Folks who want to improve this further now also have a dedicated selftest facility through KALLSYMS_SELFTEST. Stephen Boyd added zstd in-kernel decompression support, but the only users of this would be folks using the load-pin LSM because otherwise we do module decompression in userspace. The only other thing with mentioning is a minor boot time optimization by Rasmus Villemoes which deferes param_sysfs_init() to late init. The rest is cleanups and minor fixes" * tag 'modules-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: livepatch: Call klp_match_callback() in klp_find_callback() to avoid code duplication module/decompress: Support zstd in-kernel decompression kallsyms: Remove unneeded semicolon kallsyms: Add self-test facility livepatch: Use kallsyms_on_each_match_symbol() to improve performance kallsyms: Add helper kallsyms_on_each_match_symbol() kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[] kallsyms: Correctly sequence symbols when CONFIG_LTO_CLANG=y kallsyms: Improve the performance of kallsyms_lookup_name() scripts/kallsyms: rename build_initial_tok_table() module: Fix NULL vs IS_ERR checking for module_get_next_page kernel/params.c: defer most of param_sysfs_init() to late_initcall time module: Remove unused macros module_addr_min/max module: remove redundant module_sysfs_initialized variable
This commit is contained in:
commit
3ba2c3ff98
16 changed files with 841 additions and 44 deletions
|
|
@ -125,6 +125,24 @@ struct klp_find_arg {
|
|||
unsigned long pos;
|
||||
};
|
||||
|
||||
static int klp_match_callback(void *data, unsigned long addr)
|
||||
{
|
||||
struct klp_find_arg *args = data;
|
||||
|
||||
args->addr = addr;
|
||||
args->count++;
|
||||
|
||||
/*
|
||||
* Finish the search when the symbol is found for the desired position
|
||||
* or the position is not defined for a non-unique symbol.
|
||||
*/
|
||||
if ((args->pos && (args->count == args->pos)) ||
|
||||
(!args->pos && (args->count > 1)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int klp_find_callback(void *data, const char *name,
|
||||
struct module *mod, unsigned long addr)
|
||||
{
|
||||
|
|
@ -139,18 +157,7 @@ static int klp_find_callback(void *data, const char *name,
|
|||
if (args->objname && strcmp(args->objname, mod->name))
|
||||
return 0;
|
||||
|
||||
args->addr = addr;
|
||||
args->count++;
|
||||
|
||||
/*
|
||||
* Finish the search when the symbol is found for the desired position
|
||||
* or the position is not defined for a non-unique symbol.
|
||||
*/
|
||||
if ((args->pos && (args->count == args->pos)) ||
|
||||
(!args->pos && (args->count > 1)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return klp_match_callback(data, addr);
|
||||
}
|
||||
|
||||
static int klp_find_object_symbol(const char *objname, const char *name,
|
||||
|
|
@ -167,7 +174,7 @@ static int klp_find_object_symbol(const char *objname, const char *name,
|
|||
if (objname)
|
||||
module_kallsyms_on_each_symbol(klp_find_callback, &args);
|
||||
else
|
||||
kallsyms_on_each_symbol(klp_find_callback, &args);
|
||||
kallsyms_on_each_match_symbol(klp_match_callback, name, &args);
|
||||
|
||||
/*
|
||||
* Ensure an address was found. If sympos is 0, ensure symbol is unique;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue