From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C83F3C4332F for ; Tue, 15 Nov 2022 08:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232897AbiKOImu (ORCPT ); Tue, 15 Nov 2022 03:42:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232814AbiKOImp (ORCPT ); Tue, 15 Nov 2022 03:42:45 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE0B15735; Tue, 15 Nov 2022 00:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=JcJBCjh7l838Wq6UcVkfXVQPjk4/ajsDYeXjINPhA/E=; b=ZPUKQY17GwU9g+RK433OKjmi9/ 6CfbNHxq03HVJR8VRHDj/cUiQL9F6F3k2WA2upf9g6VDTkE5GB0kNhjN/l2IZBPbxNm+co5qmcMqm eqnwFzyRGf+FAA0Mro5KkRr83DrR3YpPDElOSuz0oNaVDV0CMj+m5O6DKcpkBTvsaX9aoRnkJQ/6v b8Cr3oAk2Re9CCq42yH1pCcOK/ovndsDqjzy2ddVolaMq+rXLZo7kIdz6X7lhWsxScMIJW87pJw4B 9n/Lan41jb5fV87q7sPWeUBN/7UyQwQHvhc6NRc6AwddfRz/Jm6YVTwMZpWDyOR7OR5lrMTVguxld MMJBgjFQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ourWZ-008zwE-TE; Tue, 15 Nov 2022 08:42:31 +0000 Date: Tue, 15 Nov 2022 00:42:31 -0800 From: Luis Chamberlain To: Zhen Lei , nick.alcock@oracle.com Cc: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , linux-modules@vger.kernel.org, Steven Rostedt , Ingo Molnar , David Laight Subject: Re: [PATCH v9] kallsyms: Add self-test facility Message-ID: References: <20221115083349.1662-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115083349.1662-1-thunder.leizhen@huawei.com> Sender: Luis Chamberlain Precedence: bulk List-ID: On Tue, Nov 15, 2022 at 04:33:48PM +0800, 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 Thanks! Queued onto module-next. Luis