Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3945132iog; Tue, 21 Jun 2022 08:55:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vv7gXPdmyOIPRbDmWrD2fTgCQapvcDSoXOAc9VWfKVub/kqfZykZ9lrKzsGohLs55ut9EZ X-Received: by 2002:a17:907:3d8a:b0:70e:76f2:eedd with SMTP id he10-20020a1709073d8a00b0070e76f2eeddmr26683797ejc.485.1655826944607; Tue, 21 Jun 2022 08:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655826944; cv=none; d=google.com; s=arc-20160816; b=GCEGmnUkIrbPI5cD/kw73lhXdrtXNfudSQhgKgwQ+FP1Z/tXxCKVZEpjY0lyAE6Ipo /r/PnxSzl/XXPcAOP37573yDWDEkUf5q3C1XWebLjOqMBLMfE7Phi+aeq0Gku1B7Zehk gaohknDUUYZN+yT2fJgtNpKOMCNygJMd4zBw/K7cYHqqEw+sPLxvr7GrfCdoKHWspZq9 yrX3mjXkMUp2dhNy1hgjEYJ5ALcV8oORgOzdcD3tf0u3eXF+cGl7gh89XpiJUOZGmh27 ljDIQ1UJccJyV9ihs+SirXLWSW1bImzXKhROmSWdfsTpBNrEJPaoKrdCzaRDYVfm9XlC earg== 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; bh=jNomwlsDfqU5poOBT4be6sMDFMnq8kqupfgjKPBSl0o=; b=Ypp7hfRaGPsBHSgp2Fm0JBGAkU6ktJzsqHWs/zFulm1MjYKGvR8mN/QVScEmS09kPM edjp3AseIEdIftIHoTOFsV50tg9jgjd5HD9CJqRVwlw5Wnhab4OR0T+KHXWLcayiJ5f6 FGKPZ6crpKraxrg4GaHD5ogQEHLnB5+TvECnqFQHsBZHBAf+gCsPgo8i3xUqcpKysDDJ VeD4FybpnUTq5coxh7lL12vlF/XNoN/rcbSbx1PwcynAVepEdQ6RyJ/sIBxrSj3MGx2S L3FHkdNWyFg7ry0kg+8f3ctAB7hpfWF2UoZfoIcRcef8DVV6YFRddXzNJeq6TbsE6NKK Ge/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Qt4+GtYL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v30-20020a17090651de00b006f3b16423ebsi489370ejk.620.2022.06.21.08.55.16; Tue, 21 Jun 2022 08:55:44 -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=@google.com header.s=20210112 header.b=Qt4+GtYL; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352907AbiFUPiC (ORCPT + 99 others); Tue, 21 Jun 2022 11:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352923AbiFUPhq (ORCPT ); Tue, 21 Jun 2022 11:37:46 -0400 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF522B272 for ; Tue, 21 Jun 2022 08:37:44 -0700 (PDT) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-31772f8495fso133973627b3.4 for ; Tue, 21 Jun 2022 08:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jNomwlsDfqU5poOBT4be6sMDFMnq8kqupfgjKPBSl0o=; b=Qt4+GtYLdrDWQ6a5jl3LLOu8so+RPUk0wXjzmyqo52tVhlMHxh+jHNFbD0VR2STZ4K 5Kj+4Vv9NJyGdkpnEeEXy4dYLuU05zKinvDfx8L62t/nGOK7pk1Bb8nPm9gD3PWmCzB+ 0FsTPU9LLC+vH9Ahtgte4BU6/x5GtcPAioWD/CA5Kw9kAdi7S6uhutiYCMu9N0ohluZ3 xYnZ/jjuUSLbzzkcZ4iY420a6fi0MZTYxsamgxpanWk8sGUMvDQu7WphHBxiNpbkI0FZ svL5BHCVyM70iTmWazyMHlSzSg6z3CND1vVS5DIaHVUVVdEGMhYYjHHg0/En+btpU/PN ionQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jNomwlsDfqU5poOBT4be6sMDFMnq8kqupfgjKPBSl0o=; b=xkmphwE2BQCiH1YSNCFwCUyyBTcb70fNwWk2Zcz4Ts2mukPnYSsnGLkN8CdlyUcrpk 5OB7KNJjKXjaB/rZoxTtUOrbvPXjza3Lyg6Wok6SB05UiFAAfkQ9W99axYglzQNlhGcG hPi4CP1A5YEJUNDAH+vdZ27eKqFcPJTigCpYCfCf008LnpllY5HP2gdwN6mjvFD+Pk1o RdzFabCSveVLzf9c14y9RUa9vFaW6EVaTQIDk8bK21amMuS7K25ilay3BvvdNcFu7hM6 Gpj161PCXWzmG81e+toVb2/VKXHWxUhY9/o8p5Sq8BTe0uN09VB9QSHWJMdkpfSvsde0 iDDw== X-Gm-Message-State: AJIora/8ncCnq/ht+EbvJBGjZt3TgGo+WLlKSISCXdPSkBsnkt/zd+vU Eemc0/p5wiHJ1lvndwWSolMDQoi+NRioPAh2FbyknA== X-Received: by 2002:a81:100d:0:b0:317:a2a8:833d with SMTP id 13-20020a81100d000000b00317a2a8833dmr18684737ywq.69.1655825863727; Tue, 21 Jun 2022 08:37:43 -0700 (PDT) MIME-Version: 1.0 References: <20220616195759.3214538-1-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Tue, 21 Jun 2022 08:37:07 -0700 Message-ID: Subject: Re: [PATCH] kbuild: Ignore __this_module in gen_autoksyms.sh To: Masahiro Yamada 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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 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