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 0B871C43217 for ; Thu, 24 Nov 2022 02:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229727AbiKXClw (ORCPT ); Wed, 23 Nov 2022 21:41:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiKXClu (ORCPT ); Wed, 23 Nov 2022 21:41:50 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B361A6869C; Wed, 23 Nov 2022 18:41:49 -0800 (PST) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NHhxD0TMBzqSfH; Thu, 24 Nov 2022 10:37:52 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 24 Nov 2022 10:41:48 +0800 Received: from [10.174.178.55] (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 24 Nov 2022 10:41:47 +0800 Subject: Re: [PATCH v8 7/9] livepatch: Improve the search performance of module_kallsyms_on_each_symbol() To: Petr Mladek CC: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Joe Lawrence , , , "Masahiro Yamada" , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , Luis Chamberlain , , Steven Rostedt , "Ingo Molnar" , David Laight References: <20221102084921.1615-1-thunder.leizhen@huawei.com> <20221102084921.1615-8-thunder.leizhen@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: Date: Thu, 24 Nov 2022 10:41:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/11/23 21:57, Petr Mladek wrote: > On Wed 2022-11-02 16:49:19, Zhen Lei wrote: >> Currently we traverse all symbols of all modules to find the specified >> function for the specified module. But in reality, we just need to find >> the given module and then traverse all the symbols in it. >> >> Let's add a new parameter 'const char *modname' to function >> module_kallsyms_on_each_symbol(), then we can compare the module names >> directly in this function and call hook 'fn' after matching. And the >> parameter 'struct module *' in the hook 'fn' can also be deleted. >> >> Phase1: mod1-->mod2..(subsequent modules do not need to be compared) >> | >> Phase2: -->f1-->f2-->f3 > > Just for record. The patch looks good from the livepatching code POV. > > But I guess that it will need to get updated to support the new > callers in the ftrace and bpf code. Yes, this patch and 8/9 conflicts with the patch series of Jiri Olsa, So they didn't merge into linux-next. I will update and repost after v6.2-rc1. > > Best Regards, > Petr > . > -- Regards, Zhen Lei