selftests: find_symbol: Actually use load_mod() parameterThe parameter passed to load_mod() is stored in $MOD, but never used.Obviously it was intended to be used instead of the hardcoded"test_ka
selftests: find_symbol: Actually use load_mod() parameterThe parameter passed to load_mod() is stored in $MOD, but never used.Obviously it was intended to be used instead of the hardcoded"test_kallsyms_b" module name.Fixes: 84b4a51fce4ccc66 ("selftests: add new kallsyms selftests")Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
show more ...
selftests: add new kallsyms selftestsWe lack find_symbol() selftests, so add one. This let's us stress testimprovements easily on find_symbol() or optimizations. It also inherentlyallows us to te
selftests: add new kallsyms selftestsWe lack find_symbol() selftests, so add one. This let's us stress testimprovements easily on find_symbol() or optimizations. It also inherentlyallows us to test the limits of kallsyms on Linux today.We test a pathalogical use case for kallsyms by introducing moduleswhich are automatically written for us with a larger number of symbols.We have 4 kallsyms test modules:A: has KALLSYSMS_NUMSYMS exported symbolsB: uses one of A's symbolsC: adds KALLSYMS_SCALE_FACTOR * KALLSYSMS_NUMSYMS exportedD: adds 2 * the symbols than CBy using anything much larger than KALLSYSMS_NUMSYMS as 10,000 andKALLSYMS_SCALE_FACTOR of 8 we segfault today. So we're capped ataround 160000 symbols somehow today. We can inpsect that issue atour leasure later, but for now the real value to this test is thatthis will easily allow us to test improvements on find_symbol().We want to enable this test on allyesmodconfig builds so we can'tuse this combination, so instead just use a safe value for now andbe informative on the Kconfig symbol documentation about where ourthresholds are for testers. We default then to KALLSYSMS_NUMSYMS ofjust 100 and KALLSYMS_SCALE_FACTOR of 8.On x86_64 we can use perf, for other architectures we just use 'time'and allow for customizations. For example a future enhancements couldbe done for parisc to check for unaligned accesses which triggers aspecial special exception handler assembler code inside the kernel.The negative impact on performance is so large on parisc that itkeeps track of its accesses on /proc/cpuinfo as UAH:IRQ: CPU0 CPU13: 1332 0 SuperIO ttyS07: 1270013 0 SuperIO pata_ns8741564: 320023012 320021431 CPU timer65: 17080507 20624423 CPU IPIUAH: 10948640 58104 Unaligned access handler trapsWhile at it, this tidies up lib/ test modules to allow us to havea new directory for them. The amount of test modules under lib/is insane.This should also hopefully showcase how to start doing basicself module writing code, which may be more useful for more complexcases later in the future.Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>