From nobody Sun Feb 8 18:49:02 2026 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) (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 9D54D320A04 for ; Tue, 23 Dec 2025 08:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766479450; cv=none; b=AodbG7DpgyQn3e+CFXVkmeC7LTJ8XicA8Mstgg40NyvRjLun6s9A/OVaY4TL8e+73YOVJBjEZO0wCw0T9gACSn6P1PXcobYOU7R/St8SQZT1pLj91joFSDJzbsrcKe56p1hpujTxCxjWJjfMga4IcYTUvGBYesAJ0NYqfSE12co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766479450; c=relaxed/simple; bh=m43rCnWF6W4flnZfWPAFH2zPZg0lP1fMO8rg5+/cqio=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FCX0c5hEEeN30XzY9j3pMs+f7MJZT4CE6LU9KZw1khizl1LapGwfNLx7osIwvXSliSIoOam99Aagj4y7VlvEw5rdubRnocvr4/4f47VwiLEs1nFf1X7epM9KVq1ke8FLvSSIPJLl1bxRuOirSWcqTC63CCvgfpYPSbrccPKWgvw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=i+jbnGCY; arc=none smtp.client-ip=209.85.216.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i+jbnGCY" Received: by mail-pj1-f67.google.com with SMTP id 98e67ed59e1d1-34ca40c1213so3986235a91.0 for ; Tue, 23 Dec 2025 00:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766479448; x=1767084248; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sYARJPf4DCJHMSVJhsQ64ZrdejW7DqNqW01daFc7LNc=; b=i+jbnGCY+Tjw5cMI9Wya7LlBzHZpJpTT0InGTrCdtlkgr1/HMKdNnTXyvt+nzSgpZh wCWTVR2GxwUnZntnH5uFrsp80V/RFDHLxhxgUuTmQ3Dv9wzyQzi8/Ij/XGERrr0FM2hV AldNj1O7vw76ruMbdDHMxMtBTmXtQV6eWSVBACD6s3XJez5wxZFyy2exnh3rq+rckZDb mIPof01F+UE6pc5c52mJteg90cxNKgBtTnGCxjiDazy+Q+Fc5ykkxa7qTezEA9cHQPf1 fOccBGZvnW29c2+sFzYEB8pEvlDfmE/sUj9o5wbWo51Hy2myUPMlVfpPEl0GW6uNLvxg DWeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766479448; x=1767084248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sYARJPf4DCJHMSVJhsQ64ZrdejW7DqNqW01daFc7LNc=; b=UtOABHov+Q4FgNXj4PbK0uf3mp5JneSTRmBiKHo91Yz1AYrtEiQcLp+lOtJlRgd0v+ v8WTZzpnJ21rDtHytZaLOOK3rarJR7cty9RvTeV1HtvQRaMqbz9PqG+w6BMRKjtki916 g0DbAUQubQN5gKqhh34yt3oWRxF5kFj7j3tpkFIYQIjAgXP41DpBcLcghzPAz+ytfR8q mK5mkmzBdKQnw1LY8jhz8wQ30EdkSJ+6j0hz+h3Y6fgc59QKzEo6gvsKLruOPwIZ+VzO 0cxyT8KM4BrxrBhfaN3COQLKc+s9O7Tj2JAUa8LYFGUWWV+0Pif3VKhG90q7lZw1RdjJ gt5g== X-Forwarded-Encrypted: i=1; AJvYcCWiI7LYX94DlLtZ606nsK/uYTOh+tj5HkpSeVNkBMNrxzJsMGTUo7DTej6RRqNPVCoeGUVBgjp/H1hMm1Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxD1b6N+36koYtAxOjybxJnsEfkSRQxvTwgF7FtEsNfiqY5gZFx drBsR0HP8Zfqwo3n8NxjcbBIwlfsitLWGt5lT+jJe1mL/rsMkWCUnnbl X-Gm-Gg: AY/fxX6TXEhQoa+CaEJABavU+EZiLUcVALZgspTmT6p4kCZU6KHLqLgqIKIYRSCW0kn YqTvTCSnIDpW10V28x0beu+kHNuLLfYVK+5IiJzV6WJ8jUK9chKFiLl3V0IuH77FFYZAIIoChz2 dRTR2GFQNRx20H0pI36l319+98lLirWuZuevNnBqoyuz5IYZkdCk7kVytAb8FDaJ80SDwhyVwjj ck5DAplfX83Ryx1OkkCfoEcB+c5Ckxk3ign8hXMyIYhXR+2CWqUZaUuHoaGZOCgx233jCaJb6Jr r+BFWArEWsl3fyuNoE1mnVhFi2KJYWWRjpoj/ieByqmd7ba2puWYJbk9ZTkuqm45YmLotMotf9/ 6DE9uZuugOpymlWCo56EKv27IG+WZjYpc2WvrxdN2xVijSt50KK8HocwSaRTAhNmWJ/hoUPV1Xc sRi+0xAfFNovEScdLsfnpio9HVL1CO8Tw0DNbD X-Google-Smtp-Source: AGHT+IEPBzpa+JSlltoi2sicjexlhwpONg+WQbBsfL7i+rkHPN4HgKra3RHsx7N07jEuGnZtt+CPGw== X-Received: by 2002:a05:701b:250f:b0:11b:9386:a3cb with SMTP id a92af1059eb24-12172310ff9mr8272832c88.44.1766479447624; Tue, 23 Dec 2025 00:44:07 -0800 (PST) Received: from HUC.. ([149.34.251.245]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1217254c734sm56720887c88.13.2025.12.23.00.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 00:44:07 -0800 (PST) From: hupu To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, james.clark@linaro.org, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, hupu.gm@gmail.com Subject: [RFC 2/2] perf build: Prefer kernel source headers for BPF skeletons Date: Tue, 23 Dec 2025 16:43:35 +0800 Message-ID: <20251223084337.3789-3-hupu.gm@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251223084337.3789-1-hupu.gm@gmail.com> References: <20251223084337.3789-1-hupu.gm@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When building eBPF skeletons with Clang, prefer header files provided by the kernel source tree over headers installed on the host system. While host-installed UAPI headers can be sufficient today, they are tightly coupled to the host environment and may diverge from the target kernel version over time as the kernel evolves. Relying on kernel source headers helps ensure that the headers used during the build remain consistent with the target kernel version and reduces dependence on the host build environment. This change adds the kernel source UAPI and generated header paths to the BPF include list and places them before the system include paths, while still keeping host headers (CLANG_SYS_INCLUDES) as a fallback. Signed-off-by: hupu --- tools/perf/Makefile.perf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 8b8647fd4f41..57c73ab98703 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -1203,7 +1203,13 @@ endif =20 CLANG_OPTIONS =3D -Wall CLANG_SYS_INCLUDES =3D $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARC= H)) -BPF_INCLUDE :=3D -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCL= UDES) + +KHDR_INCLUDES :=3D -I$(abspath $(OUTPUT)../../usr/include) \ +-I$(abspath $(OUTPUT)../../arch/$(SRCARCH)/include/generated/uapi) \ +-I$(abspath $(OUTPUT)../../arch/$(SRCARCH)/include/uapi) + +BPF_INCLUDE :=3D -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE) \ + $(KHDR_INCLUDES) $(CLANG_SYS_INCLUDES) TOOLS_UAPI_INCLUDE :=3D -I$(srctree)/tools/include/uapi =20 ifneq ($(WERROR),0) --=20 2.43.0