Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1280250rdb; Fri, 20 Oct 2023 13:53:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiPD1OvxJiP9pv12U4uowOA/KwZ3UzmtvSmAG4a0Gaj8+M6kOm81OH4mirQpoS97TPmzJW X-Received: by 2002:a17:90b:1d0e:b0:27c:fc2a:a178 with SMTP id on14-20020a17090b1d0e00b0027cfc2aa178mr3377814pjb.9.1697835210872; Fri, 20 Oct 2023 13:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697835210; cv=none; d=google.com; s=arc-20160816; b=ggVep3SsGlSx91j5I0GavObsZvFP1MobVGCXCmhR+Vnn1q9afP7nhQ6dN9YJsCZ2ih GUvAr96zcpF4GM05b1tCBnE00XQ/VCUY1zj4vJiA+ThoJ0xqF8DnFoU+GnxOt8H17FNN Mq/2CpvrYBngXvCTPrIElOXePPQZGtLOwTRurv5pIJIRtxUmzuSYzxVff5HR8UpffXff Yl/kR8WfbBLnHAARYohfpy7YUnWcZNUJH4XWrAvdoFPKwWOHUA1KlElVSscA6c1xt2xi uIqfuqfQsR5f8ld2N4RGtrNTzWseZJoGYznxqH0mGWip1hQ3UpKmEMF9mIJCUfAbScL9 iDPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=unUnfck8/CKTv+VT7tj7RrTNM5dM2fjAuO4rpf2gviw=; fh=CwsjwHYR/jf6S3rEfynfaVTFZME2Di6jPct8+LZYbM4=; b=qW1U+2TuVAwkTC1PjHVbKpwI/sCBzREWJb5UmWOvgaAKDZm1lz9ec2GPH1FGs1tt5N vBpZTTLyzeul0+cVq9mHlFnWJoDoVP9d6VkDQYqNoLgkguhX7C0VCginGAHnxnczoSWa vZ2RKdGParDj/VF1Cqk3rlbrmbK37xzx+a34smrA9bcTc7CC3JwYEjJj9EAm+W6Aq5Zq NK7ncSKFIJR3zOW+e+60bgJ0TqBi3twAfnOyThoP2U+ywgPaaKpwBFqlmheE3WSuZzRl DNs3jyDtiE8j7oR/NIa1S10RLCtJWBFfjG6ZHjBWz2ytof8ThIpOKVLK1+/uQKYgv2em +YAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dzrwJJd3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id oj16-20020a17090b4d9000b0027ce5a78453si2744740pjb.29.2023.10.20.13.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 13:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dzrwJJd3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D0DB180A1668; Fri, 20 Oct 2023 13:52:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbjJTUwR (ORCPT + 99 others); Fri, 20 Oct 2023 16:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbjJTUwQ (ORCPT ); Fri, 20 Oct 2023 16:52:16 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1149D6A; Fri, 20 Oct 2023 13:52:08 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-53d9f001b35so1737790a12.2; Fri, 20 Oct 2023 13:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697835127; x=1698439927; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=unUnfck8/CKTv+VT7tj7RrTNM5dM2fjAuO4rpf2gviw=; b=dzrwJJd3StIlRKXc6DpRg7hMKFSLOZqYaJacr8OzMdTMnYc1KoglIr7lhc3m6usNZs swv/NmJURQ7FlxVdFPmM4Gst8nR/c/Q4VrkCpMIASdMPkmODByFdlRjtjVUo6ANUSJHP hczRzMwHEBgoM9Eole3R+/+iVUcm1FpxvnSuDFzNqaUctM9c9RPNM/uMh2N48UMrOVT2 u591hEl+EcUsssYOPji35I3nw56ZzXWjCGEdhvGlU4TsTy0mBUtEf+lrl25w08VPsjc+ 3aMN1K18dq5hSb3D2je1SK33u+Glff1W41/+sMwmWMWTY1THPDhHcerv/X9ZgKe/2zyg C+wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697835127; x=1698439927; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=unUnfck8/CKTv+VT7tj7RrTNM5dM2fjAuO4rpf2gviw=; b=tZF1kZlB5Rim+9GfHaMo2WdAVZ4zqJmaitA+RUkOJsOM0804xw/PZZhKXNBvh0y0mW OJW75+1DiUabe4DQKeygstassjZHM75LleJX4Mo/fStDLvfiTgb4r5O1lJznFrWCZjiZ 6ZSmpwrHAfo+3bBy/Pg0IIcod+4YOJffPcpT/aqOX0sFViKiDbf35pV6ixZ7cfoePuFA U/IDT2HERMRsZ6oU9kopkjeRf6wO+M8XdFcCQCh9S1J+wvGpLO2zU2aTjwlaHmPHztt0 BV56/aoBLaWbAukyA3N+RSyLKMlwDgXwP+4PvkocZcWThZqCTfQ7o6HOfRpSnwXAAPrL U2Dw== X-Gm-Message-State: AOJu0Yzs4rRkAOsIeS1OOnJFRzLIyOTliHzHqQGxc2D35WQgQptFpFe5 RmkIMofd8c7/RI2P4LmX0QiezH5SfvJQAcf0V3Q= X-Received: by 2002:a05:6402:2787:b0:53e:fc60:85bd with SMTP id b7-20020a056402278700b0053efc6085bdmr3033561ede.24.1697835126812; Fri, 20 Oct 2023 13:52:06 -0700 (PDT) MIME-Version: 1.0 References: <20231018151950.205265-1-masahiroy@kernel.org> <20231018151950.205265-4-masahiroy@kernel.org> In-Reply-To: From: Andrii Nakryiko Date: Fri, 20 Oct 2023 13:51:54 -0700 Message-ID: Subject: Re: [bpf-next PATCH v2 4/4] kbuild: refactor module BTF rule To: Masahiro Yamada Cc: Jiri Olsa , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 13:52:48 -0700 (PDT) On Fri, Oct 20, 2023 at 12:03=E2=80=AFAM Masahiro Yamada wrote: > > On Fri, Oct 20, 2023 at 7:55=E2=80=AFAM Andrii Nakryiko > wrote: > > > > On Thu, Oct 19, 2023 at 1:15=E2=80=AFAM Jiri Olsa = wrote: > > > > > > On Thu, Oct 19, 2023 at 12:19:50AM +0900, Masahiro Yamada wrote: > > > > newer_prereqs_except and if_changed_except are ugly hacks of the > > > > newer-prereqs and if_changed in scripts/Kbuild.include. > > > > > > > > Remove. > > > > > > > > Signed-off-by: Masahiro Yamada > > > > --- > > > > > > > > Changes in v2: > > > > - Fix if_changed_except to if_changed > > > > > > > > scripts/Makefile.modfinal | 25 ++++++------------------- > > > > 1 file changed, 6 insertions(+), 19 deletions(-) > > > > > > > > diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal > > > > index 9fd7a26e4fe9..fc07854bb7b9 100644 > > > > --- a/scripts/Makefile.modfinal > > > > +++ b/scripts/Makefile.modfinal > > > > @@ -19,6 +19,9 @@ vmlinux :=3D > > > > ifdef CONFIG_DEBUG_INFO_BTF_MODULES > > > > ifneq ($(wildcard vmlinux),) > > > > vmlinux :=3D vmlinux > > > > +cmd_btf =3D ; \ > > > > + LLVM_OBJCOPY=3D"$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --bt= f_base vmlinux $@; \ > > > > + $(RESOLVE_BTFIDS) -b vmlinux $@ > > > > else > > > > $(warning Skipping BTF generation due to unavailability of vmlinux= ) > > > > endif > > > > @@ -41,27 +44,11 @@ quiet_cmd_ld_ko_o =3D LD [M] $@ > > > > cmd_ld_ko_o +=3D = \ > > > > $(LD) -r $(KBUILD_LDFLAGS) = \ > > > > $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) = \ > > > > - -T scripts/module.lds -o $@ $(filter %.o, $^) > > > > + -T scripts/module.lds -o $@ $(filter %.o, $^) = \ > > > > + $(cmd_btf) > > > > > > > > -quiet_cmd_btf_ko =3D BTF [M] $@ > > > > > > nit not sure it's intentional but we no longer display 'BTF [M] ...ko= ' lines, > > > I don't mind not displaying that, but we should mention that in chang= elog > > > > > > > Thanks for spotting this! I think those messages are useful and > > important to keep. Masahiro, is it possible to preserve them? > > > > No, I do not think so. > That's too bad, I think it's a useful one. > Your code is wrong. > Could be, but note the comment you are removing: # Re-generate module BTFs if either module's .ko or vmlinux changed BTF has to be re-generated not just when module .ko is regenerated, but also when the vmlinux image itself changes. I don't see where this is done with your changes. Can you please point it out explicitly? > > To clarify this is a fix, > I will replace the commit as follows: > > > > > ------------------->8---------------------- > kbuild: detect btf command change for modules > > Currently, the command change in cmd_btf_ko does not cause to rebuild > the modules because it is not passed to if_changed. > > Pass everything to if_change so that the btf command is also recorded > in the .*.cmd files. This removes the hacky newer_prereqs_except and > if_changed_except macros too. > ------------------->8---------------------- > > > > > -- > Best Regards > > Masahiro Yamada