From nobody Mon Jun 8 08:28:37 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 719BA28642B for ; Sun, 31 May 2026 01:09:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780189777; cv=none; b=cBYUUUpaB/GALnIzC1IroF95X0w98ZouO+P3Hg7X4vqzLdmE9C2McJhCcr3VjPunsoLZqeSjhXF+Oo4fobqq5FDQ1yTzumxk797y6i/wvHIsyciV0EO5EOfUoYsD3vE85ZynvW++YV8U6XRLgz2VmRVIqCYZb3JobDN3cffXsLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780189777; c=relaxed/simple; bh=GsGocHcq/Q0vfetgMY4nWIE8g9RqWN7YqLOVtvPKOXE=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=amdaWDGORzH09uPC81HZZW2TNZhodB3UTli9Oa/yb8zmj45NElkaOIj8byx9VXrH4se/E5p9/MJ4AZsVQqezjyHdxzI5vOZnOVD7I+DvHi5Pwz1RzCnnS8aLqo19geHpoGyt/VonM6MMfEwzOs5aYJ/ZCULCNexZRJC9mQ1iwog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Jog9q4zL; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Jog9q4zL" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-135916eefa0so8972460c88.1 for ; Sat, 30 May 2026 18:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780189776; x=1780794576; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6OZnvWRalzD/CmOsCs1H78dHBBpbTxm9Yjlm+cCugng=; b=Jog9q4zLpt4GXUE61tG0yO5v0UPdmrSMZkLFSEZvgU+IyYwmVmoJNBWwumIDmRY1X+ zI1NEDSxgUQyYdrNehv4t8U/627V4zQK3fxOvAGhwqFJfQw1hnW1EtmM+X3zp8ccM1q7 vCMH8K4DwwcaXjc7dAvh+AtENl2LjjU+Qw4C7Ddd/jix0GwtJP154h2KEGJHCMYI491v N9JsX//Sr3F7OHX9IWvs6mQu2B9o4GOPUe+DnWrGErgDWPMde7s2nguvHU2yEZOpiMNH dz8GAc/p6n8tUU6//+nUlJD6kD7OQQGhbA3bpn72tNyd5eke4ODgRBCqrB8jq8KqfdhX 8N3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780189776; x=1780794576; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6OZnvWRalzD/CmOsCs1H78dHBBpbTxm9Yjlm+cCugng=; b=AJAGtApZGTpemRLwWfK0DNV/4P1GcjlCtQb7KgjPzvMWRRhpLw30C1+VxVEclQGNTZ CgJ9wOCsT1lC3r7sqLZbWGtKqCcDVtL8k/xw44F1sGkQBSLIIldOoYMpbtsa/IAbzm3A 8z4opUlUnIoimwHqEhR+TRtSUQpoNc3RzHTdM5RcNOVp+7XeRJJ20gYJpxJgHE4z/UMj DkLTZHKXVrrElEKtVF5M41T1gnAS7uHliI31bPOYFAt40z3gZvFOl010i2AjAOyUx+qL 08mUP8ZYFEZ3Zn9+cHAJwHEBT4uY75jMFyXrLLGsTE3agOxUQrd4BQPCsj5e8ZK/fOed e2lA== X-Forwarded-Encrypted: i=1; AFNElJ8cduIfj788yKLEMfB/8vIAuDtTMlsZwAkJ5+/VoFQ+XHQUdDUpoCiZfwZPKlp+VzLPxER5BbPexWFvP/4=@vger.kernel.org X-Gm-Message-State: AOJu0YwQRpP1kNOfM9jMiUIASqBL1ipWcTrncWBTwUMTd9DYuxP5jmZ/ 9DeT5u0e5VHYREVPrienatQNov4h7u3aZW5KeQaRUYVZz4HWFEpWoODLqYO0fXuLNXYld2PZOY5 FjtInHpyJRQ== X-Received: from dlbrl27.prod.google.com ([2002:a05:7022:f51b:b0:136:9842:a8cb]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:421:b0:12d:de3f:d843 with SMTP id a92af1059eb24-137d425071fmr2460172c88.38.1780189775362; Sat, 30 May 2026 18:09:35 -0700 (PDT) Date: Sat, 30 May 2026 18:09:24 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260531010924.525824-1-irogers@google.com> Subject: [PATCH v1] tools build: Fix feature checks to touch target files on success From: Ian Rogers To: Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Arnaldo Carvalho de Melo , Namhyung Kim , Dmitrii Dolgov <9erthalion6@gmail.com>, James Clark , Leo Yan , Costa Shulyupin , Yuzhuo Jing , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Cc: linux-perf-users@vger.kernel.org, Ian Rogers Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In tools/build/feature/Makefile, test-clang-bpf-co-re.bin and test-bpftool-skeletons.bin redirected grep output but never touched or created the $@ target file upon success. Because the target file was never created on disk, Kbuild could never cache the result of the check. Consequently, Make treated the prerequisite as missing and continuously re-executed the Clang BPF backend and bpftool feature checks on every single sub-make evaluation during build startup, or on every incremental build. Refactor both feature check recipes to touch $@ on success. For test-clang-bpf-co-re.bin, group the shell pipeline within curly braces and redirect both stdout and stderr to .make.output to allow errors to be inspected and not appear in build output. List test-clang-bpf-co-re.bin's input C file as a dependency so modification triggers a rebuild. For test-bpftool-skeletons.bin, add it to the FILES list so that it will be cleaned. Tested-by: James Clark Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Ian Rogers --- This patch originally appeared in the now merged perf patch series: https://lore.kernel.org/linux-perf-users/20260518154638.2798789-1-irogers@g= oogle.com/ --- tools/build/feature/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 704c687ed3ad..5b4a984973c4 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -75,7 +75,8 @@ FILES=3D \ test-file-handle.bin \ test-libpfm4.bin \ test-rust.bin \ - test-libopenssl.bin + test-libopenssl.bin \ + test-bpftool-skeletons.bin =20 FILES :=3D $(addprefix $(OUTPUT),$(FILES)) =20 @@ -383,9 +384,9 @@ $(OUTPUT)test-libaio.bin: $(OUTPUT)test-libzstd.bin: $(BUILD) -lzstd =20 -$(OUTPUT)test-clang-bpf-co-re.bin: - $(CLANG) -S -g --target=3Dbpf -o - $(patsubst %.bin,%.c,$(@F)) | \ - grep BTF_KIND_VAR +$(OUTPUT)test-clang-bpf-co-re.bin: test-clang-bpf-co-re.c + { $(CLANG) -S -g --target=3Dbpf -o - $< | \ + grep BTF_KIND_VAR; } > $(@:.bin=3D.make.output) 2>&1 && touch $@ =20 $(OUTPUT)test-file-handle.bin: $(BUILD) @@ -397,8 +398,8 @@ $(OUTPUT)test-libopenssl.bin: $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags openssl 2>/dev/null) =20 $(OUTPUT)test-bpftool-skeletons.bin: - $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \ - > $(@:.bin=3D.make.output) 2>&1 + { $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons'; } \ + > $(@:.bin=3D.make.output) 2>&1 && touch $@ =20 # Testing Rust is special: we don't compile anything, it's enough to check= the # compiler presence. Compiling a test code for this purposes is problemati= c, --=20 2.54.0.823.g6e5bcc1fc9-goog