From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
<live-patching@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Alexei Starovoitov <ast@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
<linux-modules@vger.kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Subject: Re: [PATCH v9] kallsyms: Add self-test facility
Date: Tue, 15 Nov 2022 16:43:57 +0800 [thread overview]
Message-ID: <f21eb27b-4c7f-5136-85ab-61a8ca762496@huawei.com> (raw)
In-Reply-To: <20221115083349.1662-1-thunder.leizhen@huawei.com>
On 2022/11/15 16:33, Zhen Lei wrote:
> 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>
> ---
> include/linux/kallsyms.h | 1 +
> init/Kconfig | 13 +
> kernel/Makefile | 1 +
> kernel/kallsyms.c | 2 +-
> kernel/kallsyms_selftest.c | 485 +++++++++++++++++++++++++++++++++++++
> kernel/kallsyms_selftest.h | 13 +
> 6 files changed, 514 insertions(+), 1 deletion(-)
> create mode 100644 kernel/kallsyms_selftest.c
> create mode 100644 kernel/kallsyms_selftest.h
v8 --> v9:
[v8] https://lkml.org/lkml/2022/11/2/225
Adjust the prototype of some callback functions. Because 7/9 and 8/9
in v8 are dropped.
--
Regards,
Zhen Lei
next prev parent reply other threads:[~2022-11-15 8:44 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 8:33 [PATCH v9] kallsyms: Add self-test facility Zhen Lei
2022-11-15 8:42 ` Luis Chamberlain
2022-11-15 8:43 ` Leizhen (ThunderTown) [this message]
2022-12-15 8:50 ` Geert Uytterhoeven
2022-12-15 9:16 ` Leizhen (ThunderTown)
2022-12-15 9:39 ` Geert Uytterhoeven
2022-12-15 12:33 ` Leizhen (ThunderTown)
2022-12-15 13:24 ` Geert Uytterhoeven
2022-12-15 13:58 ` Leizhen (ThunderTown)
2022-12-15 14:40 ` Leizhen (ThunderTown)
2022-12-15 14:51 ` Geert Uytterhoeven
2022-12-16 7:42 ` Leizhen (ThunderTown)
2022-12-16 9:36 ` Leizhen (ThunderTown)
2022-12-16 11:28 ` Geert Uytterhoeven
2022-12-16 12:01 ` Leizhen (ThunderTown)
2022-12-16 13:29 ` David Laight
2022-12-16 14:44 ` David Laight
2022-12-16 15:19 ` Andreas Schwab
2022-12-16 15:25 ` David Laight
2022-12-16 15:54 ` Andreas Schwab
2022-12-16 16:09 ` David Laight
2022-12-16 16:11 ` Andreas Schwab
2022-12-16 16:32 ` David Laight
2022-12-16 16:53 ` Steven Rostedt
2022-12-16 16:57 ` David Laight
2022-12-16 17:19 ` Steven Rostedt
2022-12-16 17:38 ` Steven Rostedt
2022-12-16 19:27 ` David Laight
2022-12-17 7:31 ` Leizhen (ThunderTown)
2022-12-17 13:37 ` Geert Uytterhoeven
2022-12-17 17:37 ` David Laight
2022-12-16 11:57 ` Andreas Schwab
2022-12-16 13:31 ` Leizhen (ThunderTown)
2022-12-16 13:47 ` Andreas Schwab
2022-12-15 14:43 ` Geert Uytterhoeven
2022-12-15 14:51 ` Andreas Schwab
2022-12-16 10:40 ` David Laight
2022-12-16 11:40 ` Leizhen (ThunderTown)
2022-12-16 11:44 ` Andreas Schwab
2022-12-16 11:57 ` Leizhen (ThunderTown)
2022-12-16 12:39 ` Andreas Schwab
2022-12-16 13:31 ` Leizhen (ThunderTown)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f21eb27b-4c7f-5136-85ab-61a8ca762496@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=David.Laight@ACULAB.COM \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox