Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6181053iog; Thu, 23 Jun 2022 13:04:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1srLELPonWRvgpr5TEy/+ttRRFm25mtVkdWBZTDu7ZjrYzrNZ+irzgte191SZwZXCNv4nKo X-Received: by 2002:a63:5c56:0:b0:3fc:824d:fc57 with SMTP id n22-20020a635c56000000b003fc824dfc57mr8976082pgm.561.1656014641805; Thu, 23 Jun 2022 13:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656014641; cv=none; d=google.com; s=arc-20160816; b=UM+FIb0FfDQ31tGsKP29rg/faWBH1YO0kgTVBG46JOb3f7YqroFHXLaqrKvHspGpiA NJiUqTgP+Hg/CW6OxUJUufyMn87DUCQultIxXZVY6g7ykVwZfvslrN4s5W4+4rDdnRkg 1U7GFevd34fElZNgLwCznyImK4PV1tZVCIZMXlTm2JihGWmmGXas8uNSg927yYKn1FFB Dh4t0JSsgYGFYvEKwvcpKRR/c3uwqCYkkFHSgsf5VDzMoFFOLCYXWXX8fXKGWBfwkQcZ C1MsbcjM6EZyTOCJie8ix3pSnycor5AVhwa963Ps5x6R03S2QgLsikEQcbqBlF3TlUo+ 3BBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=pEL1WpSAMyD9mSY4a16U3Cj3+7K9DHBU8p8yE5/Cd+M=; b=taGpejH4Yhf8LWw71o6yiQsyrWCDUD9wacJ5fvhIfT89it07VRzmXw9xZzci+6TErL suZFwqws+1xMSO9LVbhzcjJVeCfa+EwtWf14bLUFHWVc1SilRmH4A4cB/mxe6mS/7UTQ PC+wM9rkLsFSB3sI/rtSlpJYW1FTqOGi7G3IWNYaNtMsGaZLxK37TuS6bTdG15tnwwD3 qzb+AVYrYtimc+JR7x32LWitW3/QMBOnPI8WYimd5GOFPsK6wKKjMvHpF79pev5rfamr kDJshCbt1Kejcx5XJyKqX7e4GpwIzQ2tK4/zrBDc2dlQTNxAj0CFD4Y6ts4SkN1RiYvz bhXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Sdy61U8S; 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 p11-20020a17090a868b00b001df4ea7a026si3816265pjn.34.2022.06.23.13.03.50; Thu, 23 Jun 2022 13:04:01 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Sdy61U8S; 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 S231151AbiFWToO (ORCPT + 99 others); Thu, 23 Jun 2022 15:44:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbiFWToB (ORCPT ); Thu, 23 Jun 2022 15:44:01 -0400 Received: from conssluserg-01.nifty.com (conssluserg-01.nifty.com [210.131.2.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 289624F9E3; Thu, 23 Jun 2022 12:35:42 -0700 (PDT) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 25NJZAiJ026139; Fri, 24 Jun 2022 04:35:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 25NJZAiJ026139 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1656012911; bh=pEL1WpSAMyD9mSY4a16U3Cj3+7K9DHBU8p8yE5/Cd+M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Sdy61U8S1Mu+wzsbo79yD/KwiVM9vgopBQ9Z2NbvOlwcpawkA3a7xy0iEOEDeGPF7 /2bi6nQmF6xTOlzE0PA0Yj+qZH777RpcOE7gTfR+BPYphWq2y3B/jpo6iVeUdoCMWo rs8RvCcEwQ1gUHgcVw1zWbbWzHTD181NghhQXuNwNxatWSFODy1FHw5BjDiO9Up3do OlZEX4scuTO6xDmeT4dr0bEcFp7qscIOmSrZ9985Syau9p9BQnWKqWUPTXuyrx6bmg mPmfFYTxzgRIICm5jDYcWBW0qVtAhaRtpHsrkU7TMqVXRnl9hoIdvyw7o3TLuDVAgi /pTtygIPHwYKg== X-Nifty-SrcIP: [209.85.221.43] Received: by mail-wr1-f43.google.com with SMTP id q9so212873wrd.8; Thu, 23 Jun 2022 12:35:10 -0700 (PDT) X-Gm-Message-State: AJIora/RI2JdJxw2SiRbGGzKltZTbs76FY91IhbK6WF2zoog/shN7USv pufKEqmraQiXEcPaXQOtuSFjPFsT8JAAaMCc570= X-Received: by 2002:a5d:5e92:0:b0:21a:278c:b901 with SMTP id ck18-20020a5d5e92000000b0021a278cb901mr9825142wrb.461.1656012909393; Thu, 23 Jun 2022 12:35:09 -0700 (PDT) MIME-Version: 1.0 References: <20220616195759.3214538-1-samitolvanen@google.com> In-Reply-To: From: Masahiro Yamada Date: Fri, 24 Jun 2022 04:34:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: Ignore __this_module in gen_autoksyms.sh To: Sami Tolvanen Cc: Nicolas Schier , Alexander Lobakin , Nick Desaulniers , Steve Muckle , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Jun 22, 2022 at 12:37 AM Sami Tolvanen wrote: > > On Sat, Jun 18, 2022 at 4:01 PM Masahiro Yamada wrote: > > > > On Fri, Jun 17, 2022 at 4:58 AM Sami Tolvanen wrote: > > > > > > Module object files can contain an undefined reference to __this_module, > > > which isn't resolved until we link the final .ko. The kernel doesn't > > > export this symbol, so ignore it in gen_autoksyms.sh. > > > > OK, I understand these two sentences. > > > > > This avoids an > > > unnecessary vmlinux rebuild with UNUSED_KSYMS_WHITELIST when we have a > > > symbol list that already contains all the module dependencies. > > > > > > > I do not understand how this can happen. > > > > > > Can you provide me steps to reproduce it? > > This issue only happens when we have a whitelist that already contains > all the symbols we need to export. As autoksyms.h contains all the > necessary symbols in the initial vmlinux build, there should be no > need to link vmlinux again. However, as the code is looking at > undefined symbols in module .o files before __this_module is resolved, > adjust_autoksyms.sh thinks that __this_module is still missing and > triggers a rebuild, without actually changing anything. > > I suspect this isn't a common situation, but it does happen when > building Android kernels, which specify a complete list of exported > symbols. Linking vmlinux.o takes a while with LTO and we would like to > avoid performing this step more than once. > > Sami Thanks, confirmed. But, this patch does not shoot the root cause. The relink of vmlinux should not happen irrespective of UNUSED_KSYMS_WHITELIST. I thought I had fixed this issue long time before, but actually didn't due to my mistake in commit 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS"). I will pick up this patch anyway, but the re-link of vmlinux should be addressed by the other patch. -- Best Regards Masahiro Yamada