Centos-kernel-stream-9/init
Donald Dutile a5f753d630 kallsyms: Add self-test facility
JIRA: https://issues.redhat.com/browse/RHEL-28063

Conflicts:
  Nice self-test addition, but needs more verification to enable
  in RHEL, so add redhat/config that disables it for now.
  Only including to ease backporting of further commits, and enable
  others to verify its use, usefulness, for RHEL.

commit 30f3bb09778de64ef9f23fb4bb5f868c4728a071
Author: Zhen Lei <thunder.leizhen@huawei.com>
Date:   Tue Nov 15 16:33:48 2022 +0800

    kallsyms: Add self-test facility

    Added test cases for basic functions and performance of functions
    kallsyms_lookup_name(), kallsyms_on_each_symbol() and
    kallsyms_on_each_match_symbol(). It also calculates the compression rate
    of the kallsyms compression algorithm for the current symbol set.

    The basic functions test begins by testing a set of symbols whose address
    values are known. Then, traverse all symbol addresses and find the
    corresponding symbol name based on the address. It's impossible to
    determine whether these addresses are correct, but we can use the above
    three functions along with the addresses to test each other. Due to the
    traversal operation of kallsyms_on_each_symbol() is too slow, only 60
    symbols can be tested in one second, so let it test on average once
    every 128 symbols. The other two functions validate all symbols.

    If the basic functions test is passed, print only performance test
    results. If the test fails, print error information, but do not perform
    subsequent performance tests.

    Start self-test automatically after system startup if
    CONFIG_KALLSYMS_SELFTEST=y.

    Example of output content: (prefix 'kallsyms_selftest:' is omitted
     start
      ---------------------------------------------------------
     | nr_symbols | compressed size | original size | ratio(%) |
     |---------------------------------------------------------|
     |     107543 |       1357912   |      2407433  |  56.40   |
      ---------------------------------------------------------
     kallsyms_lookup_name() looked up 107543 symbols
     The time spent on each symbol is (ns): min=630, max=35295, avg=7353
     kallsyms_on_each_symbol() traverse all: 11782628 ns
     kallsyms_on_each_match_symbol() traverse all: 9261 ns
     finish

    Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
    Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2024-06-17 14:17:22 -04:00
..
Kconfig kallsyms: Add self-test facility 2024-06-17 14:17:22 -04:00
Makefile sched/preempt: Tell about PREEMPT_DYNAMIC on kernel headers 2022-04-07 09:35:08 -04:00
calibrate.c
do_mounts.c init: flush async file closing 2024-04-17 10:10:57 +08:00
do_mounts.h init: flush async file closing 2024-04-17 10:10:57 +08:00
do_mounts_initrd.c freezer,umh: Clean up freezer/initrd interaction 2023-10-20 06:13:12 -04:00
do_mounts_rd.c
init_task.c kcsan: Remove redundant zero-initialization of globals 2023-09-22 13:20:54 -04:00
initramfs.c init: flush async file closing 2024-04-17 10:10:57 +08:00
main.c Merge: workqueue: Backport workqueue commits to v6.9 2024-06-13 13:07:43 +00:00
noinitramfs.c
version.c kbuild: add an elfnote for whether vmlinux is built with lto 2021-04-25 05:25:42 +09:00