Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8299830rwb; Wed, 23 Nov 2022 19:29:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5hVqM7xi4wUeDlxiqMM2gTydMgXx+5QrjhgJc5RL5IvPalhbfWvOwWiTa6BSaux6o5VKGC X-Received: by 2002:a17:906:9d16:b0:7ae:c45b:98fb with SMTP id fn22-20020a1709069d1600b007aec45b98fbmr16272634ejc.478.1669260582437; Wed, 23 Nov 2022 19:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669260582; cv=none; d=google.com; s=arc-20160816; b=HfoQWopQpFgFvtVTg3vgwey7h6n39IGBwe2ObcsW5LPG98v+0fdoQWzQtLvpaVduFm D+CPU4ynQXeUKe9+zgDeOdoUf6xcRo2caMn9or8l7M6VjFBsLP9Y4uw3XRrKn6p2qmCK Lcja57Er20Fj+tpWGT3csSkreDpS1SUYtd+8rf2pYRx8+vG+WjXH06uDpw2gGiOEsCsB 6W7BVrR53oP420Ze+dAYrQz9gsNF5HFRrH1Qz1ex173UC6+5yIsvPOeovjrB7xCcB5FM y8p+TWiJGtaJ4tJs006TdopGMrxfPKAgu0IuqznmzAO17UjxcoYPlUrX8m5PeBoTq8p9 ljog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=N6AktfNbTUQnqvMPwVJh2F6r2h7atynGlqyz5wC2z1o=; b=JCD9s7/t0wqw53sTJf97nENJdxksG3EJ5SSWLLLPt+uSbMuTR92TuBOwtzI9D1CSus zaFiIW+kPNyg77tj35qo+DQOg73Q/Pk1mnH610I9dJjok0vrgjWtYPwlFis3lXPrtBKI Awj6F23cduF37irU5O+jpRAzLMqf+6v2OCUAbzU8yV8pgVBKORWr1BRwmykUVNYzi5KG 4bkrWJJmChJvrW+EfiJd573+aWphGyLx9T8tpEAmy6FJ4l4qYfOW39z4nAunCCp8dM8/ SGMjpnwn2M6DbF/OE+PUg7tBl4AKh8H7Tm7Fnkj56asGZe+q3O1nhzjaSHJdURmOlE84 D8qw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch5-20020a0564021bc500b00459563e2c60si403edb.329.2022.11.23.19.29.21; Wed, 23 Nov 2022 19:29:42 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiKXClw (ORCPT + 89 others); 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 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