Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6656470rwb; Tue, 15 Nov 2022 01:35:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FUkLOgdNG2KXfRm3kh0fjpKQ0aqZGimt9557VKW6PNCosC1UfQcKnVtgwFC1G/9Jw43uy X-Received: by 2002:a17:90a:b10b:b0:212:e52e:dfeb with SMTP id z11-20020a17090ab10b00b00212e52edfebmr1275229pjq.227.1668504917838; Tue, 15 Nov 2022 01:35:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668504917; cv=none; d=google.com; s=arc-20160816; b=CjWNsDWB7rSjPgHiON40VoTNJeu0uj9QPrgA0oOag7ZHf88QyDaPirx2VfOO7jMc4t ti+Y7ZOFYYZgwsZuY1D5uwQ80TomTXBFyUaD3QeKFbpC2Tl+8b2ZIs+nKhvautA5qaBM EXKzhLAns0pBFZDKMxFSkNa/biiXCbd9W7/uFgVOVRTMxDFOeD+Oatsv0JT9u1Z7xBS2 FQyKlH05kbipz9KUtnL3JWeWin1fxzCvbeoBCn973PkIz6qXXgE2P74Es7GNk0TkWByB m4whhng3mF0VpQQ3HSr8KYm84Spe37qBcqTj35IFIkasiBMkk65GbyfVeqPtUaEH/LBR sfSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JcJBCjh7l838Wq6UcVkfXVQPjk4/ajsDYeXjINPhA/E=; b=RxX1QTSRs8bLLXYPNNHH1ZaMJF53BbEEw3aB0x+My+ieP5JptwsTjeFFtyU4vXcroD 1+txNxjOwdxaXMATLZiVwsEgRTcwVyH3KhbnglgjEyX/FsN0iRtU3FE+u3nBcY/4IxMZ QlIJtqsyga/0D6N4cVeGlhhy6YXJZZup5Vynozo4yWEITVt+hqMfHokGQIsuAcxP+5UK 3kaf2SThzgVcESePZ7Mv1kTYQG72FfTdRjQHMn846Jsp1OuMb0B5TehwMGPPuEgF0AaG 3R/Tbvz7yBBYAM2/TFmcSrzO3qbHQYcNLL8ZRJ/8SmTtVXSvHNJ2IEcOCV6CU0tHyIXI 2Acg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ZPUKQY17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i24-20020a631318000000b00460609ce615si12356464pgl.243.2022.11.15.01.35.04; Tue, 15 Nov 2022 01:35:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ZPUKQY17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235927AbiKOInA (ORCPT + 88 others); Tue, 15 Nov 2022 03:43:00 -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 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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