Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp369547rwb; Mon, 28 Nov 2022 22:46:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf74hGciX67iqhWnkIJsv4wPzQ/c4Wb26+yM4XUPrV1HVjnZdBN7iEH0R7t47AkPxeWpASkx X-Received: by 2002:a17:902:d395:b0:189:58a9:14aa with SMTP id e21-20020a170902d39500b0018958a914aamr25111599pld.22.1669704403906; Mon, 28 Nov 2022 22:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669704403; cv=none; d=google.com; s=arc-20160816; b=fOM7fw/ZWnBGMsQhkugaWb1qF++RjrtHIDQxOsL2v7mH8QPGUUyK9t7QshQI2QSB15 Hz/rMxauy+hE7Bm3e+KY39DLB3GwIYubYckeUWIsPVwc2VonKxqfeMVt0un65/HxOtY9 zPFIyC27srIS7Lj43K+M2qzDkQlv3BowwVvyGB5+24/chjboMMXoV6PP90yCSYe/02Mp GQqCikHKoqrrjYOasrDkR3B76cREsvp8lWbDunDnGX+UiwcJfctpjxHKUqPmRnLxZ/hb fHn0AFfDYBqqa2ZFthkeu7zbb5SElRFsWqXUq8CGrnYHaK/OQGws6i/R6AE4fmc2rF3z Mb7A== 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=2pLzq/SzjaM0KPWKXQrCExQaHgJlHt7QEU3lr44aL8w=; b=GQs47ysiq/v2mUThfDhgwp/xUZ0gv0scCnfijA7tAxRqaXZcKtwTCnid1a2AspdSLi eGkz5tHu0rSihxEgadobN1pIGDkOCfq0niYWPbPrDNjuhvSDCijC1ixtI5LUBrn7uk0p bKWVGKdkg5RxoVEIzSP0EqdTuX/zMseVzRUmBUdIr86gihDMrZgQV055Uu1yoBW4zvEd Drg6shuG7MpEv5eIJE94Z1tg5U1j3nBBNM6OuqyOqF6iNlSk173JESzCE4ClRRrCSeA2 JdbVjw3vQkSd/icTdy+KCCQbHNml3QnDlioDoi7fX6bOLrMZKaEFLSCwwSRzFImtMSL+ TCNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="XYkTC/bt"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s27-20020a63ff5b000000b004782a15508dsi3646412pgk.824.2022.11.28.22.46.33; Mon, 28 Nov 2022 22:46:43 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="XYkTC/bt"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235656AbiK2GAa (ORCPT + 82 others); Tue, 29 Nov 2022 01:00:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbiK2GA3 (ORCPT ); Tue, 29 Nov 2022 01:00:29 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1C452175; Mon, 28 Nov 2022 22:00:28 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id bj12so31165531ejb.13; Mon, 28 Nov 2022 22:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2pLzq/SzjaM0KPWKXQrCExQaHgJlHt7QEU3lr44aL8w=; b=XYkTC/btf3zjxM2HhgCFpLp1a7ejW0BkcZgv5Wz0DrghPJRGuVHzVbdferWAQK+vwf JqEzcRTX7SZjFu0XPKlkeC/ZMwA9gOqeMZyhTrsJE/8QskM5ql2usS6FZHej5Fn/Yw1G wmA8CmLWaVvaN47Ho7YIdbCQjiMP9QOgpDJRianeC/37oJztFYEUCCWuuZBWIWlSk4D7 Dq12BSxoycLRuyC4BYxSswffD7ZgwCmJNcJReq0eWVHZafY/WaZy1hFpxjtkJMU+XXLe hXkCjxgFj1nRRzJvw4pMfZAvcTlKL5MVPkJQ/BX222oFhjh6+blnZsngJ5Qm2xdusJFQ NLwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=2pLzq/SzjaM0KPWKXQrCExQaHgJlHt7QEU3lr44aL8w=; b=J09DnPZtpAkikvghpoufjPwYTzk+zZyfEg9TIc2eOzG3VCtc8SwvyBv4RQgvWCZCHE uE1Ho64Wl0nsRqNozVW130RXnOKMNhAzx2to95J8ex8/Q5XEUpiiUZZXCc/mnLZQTcMr bftlz4/VmEDbIwJJRUbJMi8AKAAd3RCvQUutyk7C+sF+1CN4+TgAjd16KZNPI4Q1XzLn l6I2O2p40NKJ7QfExZ2z6S3becVAeseIUwVhKn4lQAfbn30UkYH6Blfp3PYdRFdSdPm5 mCD/lwuSdekEIRRkJjlrkUdwkp07/MQEKf/e8zcR8QR40Ge0MTVAlXn1APPMfHd2DGAN Er8g== X-Gm-Message-State: ANoB5pmj487c/VuTp4IpCnHr29pir/l4A+mq4QZG2beLSBxXUX6tLOT3 1vFSl90ihm14fXInTVa5Qv3/XaQHW7pZXQFkWT0= X-Received: by 2002:a17:906:30c1:b0:7b7:eaa9:c1cb with SMTP id b1-20020a17090630c100b007b7eaa9c1cbmr32037639ejb.745.1669701626413; Mon, 28 Nov 2022 22:00:26 -0800 (PST) MIME-Version: 1.0 References: <20221126111147.199366-1-changbin.du@gmail.com> <20221126111147.199366-3-changbin.du@gmail.com> In-Reply-To: <20221126111147.199366-3-changbin.du@gmail.com> From: Andrii Nakryiko Date: Mon, 28 Nov 2022 22:00:14 -0800 Message-ID: Subject: Re: [PATCH 2/2] makefiles: do not generate empty vmlinux.h To: Changbin Du Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Quentin Monnet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Shuah Khan , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Alexander Shishkin , Namhyung Kim , Mykola Lysenko , linux-perf-users@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Sat, Nov 26, 2022 at 3:13 AM Changbin Du wrote: > > Remove the empty vmlinux.h if bpftool failed to dump btf info. > The emptry vmlinux.h can hide real error when reading output > of make. wouldn't this be better handled by adding .DELETE_ON_ERROR: to bpftool's Makefile? > > Signed-off-by: Changbin Du > --- > samples/bpf/Makefile | 2 +- > tools/bpf/bpftool/Makefile | 2 +- > tools/bpf/runqslower/Makefile | 2 +- > tools/perf/Makefile.perf | 2 +- > tools/testing/selftests/bpf/Makefile | 2 +- > 5 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile > index 727da3c5879b..ab4788b4883e 100644 > --- a/samples/bpf/Makefile > +++ b/samples/bpf/Makefile > @@ -362,7 +362,7 @@ ifeq ($(VMLINUX_BTF),) > $(error Cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)",\ > build the kernel or set VMLINUX_BTF or VMLINUX_H variable) > endif > - $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ > + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ || { rm $@; exit 1; } > else > $(Q)cp "$(VMLINUX_H)" $@ > endif > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index 4a95c017ad4c..d9d6f890884c 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -177,7 +177,7 @@ BUILD_BPF_SKELS := 1 > > $(OUTPUT)vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL_BOOTSTRAP) > ifeq ($(VMLINUX_H),) > - $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) btf dump file $< format c > $@ > + $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) btf dump file $< format c > $@ || { rm $@; exit 1; } > else > $(Q)cp "$(VMLINUX_H)" $@ > endif > diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile > index 8b3d87b82b7a..2d7911f4666b 100644 > --- a/tools/bpf/runqslower/Makefile > +++ b/tools/bpf/runqslower/Makefile > @@ -77,7 +77,7 @@ ifeq ($(VMLINUX_H),) > "specify its location." >&2; \ > exit 1;\ > fi > - $(QUIET_GEN)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ > + $(QUIET_GEN)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ || { rm $@; exit 1; } > else > $(Q)cp "$(VMLINUX_H)" $@ > endif > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf > index a432e59afc42..0546d408aa4e 100644 > --- a/tools/perf/Makefile.perf > +++ b/tools/perf/Makefile.perf > @@ -1064,7 +1064,7 @@ VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS)))) > > $(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) > ifeq ($(VMLINUX_H),) > - $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ > + $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ || { rm $@; exit 1; } > else > $(Q)cp "$(VMLINUX_H)" $@ > endif > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index e6cf21fad69f..9aa2475b4ac6 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -284,7 +284,7 @@ endif > $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR) > ifeq ($(VMLINUX_H),) > $(call msg,GEN,,$@) > - $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ > + $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ || { rm $@; exit 1; } > else > $(call msg,CP,,$@) > $(Q)cp "$(VMLINUX_H)" $@ > -- > 2.37.2 >