Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2240193rwb; Sat, 24 Sep 2022 05:24:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50yRvAS4TUfmv+oUdJGWwm3KMOLBxqm3LAW5jVNkZj9h+nkNfXe2csBF1raps5/w343BN8 X-Received: by 2002:a05:6402:289a:b0:453:ff16:1a8f with SMTP id eg26-20020a056402289a00b00453ff161a8fmr13267698edb.330.1664022255595; Sat, 24 Sep 2022 05:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664022255; cv=none; d=google.com; s=arc-20160816; b=TnjVjged9DBcinW+WodJH2pKuMGqRm6em/5qbcAWNxMU3pWEGfvdlAkec8y4HMzU2B 1bpmVr9o++cdfUmgdb9diLHpYb1CwvoY3igA1LTOYEKl3fQTvlkWBVAmLw663RBixtfK 3iITUkJ1jTfVZMJNhhb2vNpvQRtpvVhXwpQXoybflEscE7khCcBZ1SxVVmvDzjb08Ro+ vWq7w4CsPmG+JBCtPWVgc1rpjDWkgbxvzU62KKSP5uTUZGNiKGEAgHshVDes9sKOhUTY ZXvDkLBPq3leaeNVi4JVnMB8BuHtl01Ve88soVBGWoTUeWl6Pi30OVzD/bJmoAa8Ynh8 7CNw== 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:references:to :from:subject; bh=V7n7Pt9kSnDAymqbWEAHf5pRxTktbU3nzcTxfszsGS8=; b=fivmj609z1+F3D5n/aAhh0hTzgJMCKsKLzkPB2pGHk9zshk4KvNU0JbvH4AfTUx3Zm HaG8MOr2UEju7jEQ5T/ObhDfno4OLgZ7Wzw/A6LOz3K4QtGHH057btJB8VVPe3fNgorj kemTcaZQeZrFGnHLokjvsuTe5bE1YGxRemQj2fFOZEnUXX/JNDhB5KktxtCz+mxacHlt RCXpHFigzt1SY/P3sIbGEhsCOVXTqpPgz61uxCQdpHhGaLrIbn43VecwbiLPGbfChKZA JfmA1IcDCoGOcUzcqQx4BvtVrp51hNNE5+X3RFiHo038AJyvaTVpFgkJ72zbtCrNwMgi tyEg== 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 kq9-20020a170906abc900b00741a19c2151si8946155ejb.625.2022.09.24.05.23.49; Sat, 24 Sep 2022 05:24:15 -0700 (PDT) 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 S233791AbiIXMLR (ORCPT + 99 others); Sat, 24 Sep 2022 08:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233797AbiIXMLN (ORCPT ); Sat, 24 Sep 2022 08:11:13 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6234889CFF; Sat, 24 Sep 2022 05:11:12 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MZSS318SVzlXL7; Sat, 24 Sep 2022 20:06:59 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 20:11:10 +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; Sat, 24 Sep 2022 20:11:09 +0800 Subject: Re: [PATCH v5 08/10] livepatch: Improve the search performance of module_kallsyms_on_each_symbol() From: "Leizhen (ThunderTown)" To: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , , , Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , "Luis Chamberlain" , , "Steven Rostedt" , Ingo Molnar References: <20220923112033.1958-1-thunder.leizhen@huawei.com> <20220923112033.1958-9-thunder.leizhen@huawei.com> <4ef46874-4dbc-2663-ebad-7adbbbfa3b18@huawei.com> Message-ID: <6cddc5ab-6af5-c221-9383-a45d955af52b@huawei.com> Date: Sat, 24 Sep 2022 20:10:57 +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: <4ef46874-4dbc-2663-ebad-7adbbbfa3b18@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.3 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/9/24 9:11, Leizhen (ThunderTown) wrote: > > On 2022/9/23 19:20, 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. >> >> In order to achieve this purpose, split the call to hook 'fn' into two >> phases: >> 1. Finds the given module. Pass pointer 'mod'. Hook 'fn' directly returns >> the comparison result of the module name without comparing the function >> name. >> 2. Finds the given function in that module. Pass pointer 'mod = NULL'. >> Hook 'fn' skip the comparison of module name and directly compare >> function names. > Sorry, I forgot to change the description. I will fix it in v6, after I've > collected review comments. Oh, It's Saturday, and I don't think anyone's seen v5 yet. So I'll post the v6. Please skip v5. > -- Regards, Zhen Lei