From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECC712D9ECF; Mon, 6 Oct 2025 16:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767704; cv=none; b=TYWS58RIrEp5OTuORy0LEbhUpX3O/C2hVgyHGTraTzFwsh8umSmC7QjiYOuGFfYJr45vq/Md9H3xd+QGZJV775X8BkP2mlMeVd/P5eJEBoq1n2lUSQB/2UYhJ+EmXWBqZ2rXNKHGL6nXQACN01QIVC3AK6PDtEWHhn127DhOePE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767704; c=relaxed/simple; bh=vNDVZkxHA2mAyiZ+UlvQxAZSagxQ4O7RbrAShEgaA5E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VinQTmiWPLbLJCBCAo6e3v6Z5iNwf1KjDleQR8+PeztNaZrfHj/QeLEIokeRgm/8AhciyffBYNipskrNwSRO/L1C6h3wSwIgyL78VTB7ejPLykZNzulAilN785TgPaIoWQ74rUiPumj7Oj4t5g9QeGsQfw4B8n2mGTaxsuTvjfk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 62E991515; Mon, 6 Oct 2025 09:21:34 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD8FE3F738; Mon, 6 Oct 2025 09:21:39 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:23 +0100 Subject: [PATCH v3 1/9] tools build: Align warning options with perf Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-1-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=1150; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=vNDVZkxHA2mAyiZ+UlvQxAZSagxQ4O7RbrAShEgaA5E=; b=EG0tsFK21ZjPlI5l1dxxftTrHfPI06IJhl8UTXHnJqcTv7uneZdXX8HuPmYoCFAuTgNQH/Jbd ldN3DDWgKNQDW0iT+I7sD7I9OkqAaQ4YKTIPQ9jmjywC8hwpFzZ8ALt X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= The feature test programs are built without enabling '-Wall -Werror' options. As a result, a feature may appear to be available, but later building in perf can fail with stricter checks. Make the feature test program use the same warning options as perf. Fixes: 1925459b4d92 ("tools build: Fix feature Makefile issues with 'O=3D'") Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/build/feature/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index b41a42818d8ac232ade78ecb41363d26ce2a9471..bd615a708a0aa89ddbe87401f04= bd736e384a9c4 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -316,10 +316,10 @@ $(OUTPUT)test-libcapstone.bin: $(BUILD) # -lcapstone provided by $(FEATURE_CHECK_LDFLAGS-libcapstone) =20 $(OUTPUT)test-compile-32.bin: - $(CC) -m32 -o $@ test-compile.c + $(CC) -m32 -Wall -Werror -o $@ test-compile.c =20 $(OUTPUT)test-compile-x32.bin: - $(CC) -mx32 -o $@ test-compile.c + $(CC) -mx32 -Wall -Werror -o $@ test-compile.c =20 $(OUTPUT)test-zlib.bin: $(BUILD) -lz --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B57752DBF76; Mon, 6 Oct 2025 16:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767707; cv=none; b=FdyAYAnGBH6mOER6QBg3UvAZttfTDi39tyC+JE5NR95LXBCfOW6AwWtwK4nZ0pM4xRqtURXC7RrrxSpieykCeGedD9tVmXfgOWsdybj1ECwYhBQYUHRVnu+YAi6m4bU58I+n1o/xWEXh0c+ZUaNNnD1Ll/QY1LMbqJr3yG0XlPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767707; c=relaxed/simple; bh=H3wg4rcmLVUVzF6Navqmshn4de5zeGYk8fBYI7vbo5o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MNSlKRSp4hePuWzb2EDUbRUEfvf0tVqCTrAvJBOzxoojdH9rZIjaQMPf5MXlxKnBZn6JjQ5eJmu4wp421frvOXEzBOK8mYwk2y4MlI27HbHiEA9/OyOTsgmbhQHas1y1Xn6U1iJaLwEGYJBQ9TICLO2axf4S0CSFVZHVHNNnfsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 304F31515; Mon, 6 Oct 2025 09:21:37 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9ADAD3F738; Mon, 6 Oct 2025 09:21:42 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:24 +0100 Subject: [PATCH v3 2/9] perf python: split Clang options when invoking Popen Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-2-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=2000; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=H3wg4rcmLVUVzF6Navqmshn4de5zeGYk8fBYI7vbo5o=; b=FpZCim28FeMjgD8SSZxghcLEh4eQuWcsdoBF5GHaj0XPtOgzIYESmzJGi2vfy3n7n8BFpqR2m VIPuuJGGUKqBTWfZYHE/YZI0U/tPoQoIOA3Q8V5v8nUcBYN3zVsnE2t X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= When passing a list to subprocess.Popen, each element maps to one argv token. Current code bundles multiple Clang flags into a single element, something like: cmd =3D ['clang', '--target=3Dx86_64-linux-gnu -fintegrated-as -Wno-cast-function-ty= pe-mismatch', 'test-hello.c'] So Clang only sees one long, invalid option instead of separate flags, as a result, the script cannot capture any log via PIPE. Fix this by using shlex.split() to separate the string so each option becomes its own argv element. The fixed list will be: cmd =3D ['clang', '--target=3Dx86_64-linux-gnu', '-fintegrated-as', '-Wno-cast-function-type-mismatch', 'test-hello.c'] Fixes: 09e6f9f98370 ("perf python: Fix splitting CC into compiler and optio= ns") Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/perf/util/setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index dd289d15acfd62ff058bbaed7e565bb958e3a3c8..9cae2c472f4ad4d9579e8528b8b= b0152df6fe20e 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -1,6 +1,7 @@ from os import getenv, path from subprocess import Popen, PIPE from re import sub +import shlex =20 cc =3D getenv("CC") assert cc, "Environment variable CC not set" @@ -22,7 +23,9 @@ assert srctree, "Environment variable srctree, for the Li= nux sources, not set" src_feature_tests =3D f'{srctree}/tools/build/feature' =20 def clang_has_option(option): - cc_output =3D Popen([cc, cc_options + option, path.join(src_feature_te= sts, "test-hello.c") ], stderr=3DPIPE).stderr.readlines() + cmd =3D shlex.split(f"{cc} {cc_options} {option}") + cmd.append(path.join(src_feature_tests, "test-hello.c")) + cc_output =3D Popen(cmd, stderr=3DPIPE).stderr.readlines() return [o for o in cc_output if ((b"unknown argument" in o) or (b"is n= ot supported" in o) or (b"unknown warning option" in o))] =3D=3D [ ] =20 if cc_is_clang: --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51F772DC77A; Mon, 6 Oct 2025 16:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767710; cv=none; b=o8Cy9jSwq8xvgVxCgMnJaJo+xJAOEgOqDiGR7SxyYPo6uVEO96PTP2JgE2QUaOsCXBKM9Pu8umrHsvB/5prFGIbPS2vPCPXvENdBT/YIcKYFrRZQWGfXrdnSc7I0K9EQAnWIC6n0SX2tuu6AeIW9g//xaE9PQX2cbpd4XluYfCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767710; c=relaxed/simple; bh=m3SmlzRsMKVpO74OXfiVE3r/DuuiN/mWjDes/0cwih0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WsADCAGrxHjta/6pVT7AGVMYQ/cZ8M1Vfspd9j2sq6wSkkvThdCxdOeG6mSyXA3zNQrEP+NuEyVsqNtA3KNC+ts0SYnjcDYbtVf3RqshpBwSvrBbjsyIyM9C6NpzO08LJDsvq4OL6BNxhG9Th39Pp/8Pd1MJWG52kNKqUBJujg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F160C1515; Mon, 6 Oct 2025 09:21:39 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 684C33F738; Mon, 6 Oct 2025 09:21:45 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:25 +0100 Subject: [PATCH v3 3/9] perf build: Correct CROSS_ARCH for clang Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-3-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=1923; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=m3SmlzRsMKVpO74OXfiVE3r/DuuiN/mWjDes/0cwih0=; b=P/jhnB+7EFmN27NsILJyvdp237PuNM9MUTeMFHprYYaxLA9gJqDTnVDbR8lhu5730vVdvjaG0 /AvvxHOtS/eBQ59/Cb4kIikDOUVFG9H+euApMwSOZP2VL59wm5Fu2M4 X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= Clang's -dumpmachine outputs "aarch64-unknown-linux-gnu", which does not match the MultiArch convention. This prevents the build system from detecting installed packages. Fix by stripping the trailing '-' from CROSS_COMPILE when setting CROSS_ARCH. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/build/feature/Makefile | 2 +- tools/perf/Makefile.perf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index bd615a708a0aa89ddbe87401f04bd736e384a9c4..214ccaee69181cce1f8e736b85c= 8dc940efa6c19 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -94,7 +94,7 @@ else # paths are used instead. ifdef CROSS_COMPILE ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),) - CROSS_ARCH =3D $(shell $(CC) -dumpmachine) + CROSS_ARCH =3D $(notdir $(CROSS_COMPILE:%-=3D%)) PKG_CONFIG_LIBDIR :=3D /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_A= RCH)/pkgconfig/ PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/p= kgconfig/ diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e2150acc2c13325f93a2d5cd4a60b4a6bfeedc94..47bc9d8a91df90535408c427909= bcb3f7cd50970 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -194,7 +194,7 @@ else # paths are used instead. ifdef CROSS_COMPILE ifeq ($(PKG_CONFIG_LIBDIR)$(PKG_CONFIG_PATH)$(PKG_CONFIG_SYSROOT_DIR),) - CROSS_ARCH =3D $(shell $(CC) -dumpmachine) + CROSS_ARCH =3D $(notdir $(CROSS_COMPILE:%-=3D%)) PKG_CONFIG_LIBDIR :=3D /usr/local/$(CROSS_ARCH)/lib/pkgconfig/ PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/local/lib/$(CROSS_A= RCH)/pkgconfig/ PKG_CONFIG_LIBDIR :=3D $(PKG_CONFIG_LIBDIR):/usr/lib/$(CROSS_ARCH)/p= kgconfig/ --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C4042DAFBA; Mon, 6 Oct 2025 16:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767714; cv=none; b=UEWF1jszal5qahXYkkOVfPjUxHyQd87TfWFieBwFWkvEv4gBcbtKBYGBqYWqfmYrsmzRYpi3PUmaAra29zD8/Bbj/ssPgqHyr2YydeKIoFxKhLNEXZKwkIBJwdhdeMojSkkrlEKOdgqTSGN2x2Lm5CCy6g0vO5o0qoPgh5H0nmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767714; c=relaxed/simple; bh=GGldtNXc0oaGS+19NwZcOJHDnYTkrkTDgLmVwE6QIUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cZWB8sd/WO80mDvvrci09Pu98pGJyCXnheBEvUsKCXGqTAAZYudEqLRNmAGXpplANwOpMbK0lGJmP7NTFuHwoYGL32pPap7AAg4M4fNpE9w6WwCQpGvGAPmVwZHFWEUfmdUbzYHUSFWAEbqGFLlUmzJ5Og3rjCOVEQZ3FFp8eaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BBEB51516; Mon, 6 Oct 2025 09:21:42 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 353C43F738; Mon, 6 Oct 2025 09:21:48 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:26 +0100 Subject: [PATCH v3 4/9] perf build: Disable thread safety analysis for perl header Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-4-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=3588; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=GGldtNXc0oaGS+19NwZcOJHDnYTkrkTDgLmVwE6QIUo=; b=BLRY4IQuw/VxHRszeUvciM005PXecD/Bpj2Ky9vCsY5uv8Ib9vT/VmGHqkK1GNR9GAJBP4QN8 xANHFi217g6DS5VGu8aRy97l0WLYgW3InDhYVvxol2e1vlfLRqysy/y X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= When build with perl5, it reports error: In file included from /usr/lib/perl5/5.42.0/x86_64-linux-thread-multi/C= ORE/perl.h:7933: /usr/lib/perl5/5.42.0/x86_64-linux-thread-multi/CORE/inline.h:298:5: er= ror: mutex 'PL_env_mutex.lock' is not held on every path through here [-Werror,-Wthread-safety-analysis] 298 | ENV_UNLOCK; | ^ /usr/lib/perl5/5.42.0/x86_64-linux-thread-multi/CORE/perl.h:7091:31: no= te: expanded from macro 'ENV_UNLOCK' 7091 | # define ENV_UNLOCK PERL_REENTRANT_UNLOCK("env"... | ^ /usr/lib/perl5/5.42.0/x86_64-linux-thread-multi/CORE/perl.h:6465:7: not= e: expanded from macro 'PERL_REENTRANT_UNLOCK' 6465 | } STMT_END | ^ /usr/lib/perl5/5.42.0/x86_64-linux-thread-multi/CORE/perl.h:865:28: not= e: expanded from macro 'STMT_END' 865 | # define STMT_END while (0) | ^ The error is caused by perl header but not perf code, disable thread safety analysis if including the header. Though GCC does not support the thread safety analysis option, this negative warning flag is silently ignored by it. Signed-off-by: Leo Yan Reviewed-by, applying. Reviewed-by: Ian Rogers --- tools/perf/scripts/perl/Perf-Trace-Util/Build | 2 +- tools/perf/util/scripting-engines/Build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Build b/tools/perf/scr= ipts/perl/Perf-Trace-Util/Build index 9b0e5a8b5070f1a1640518fae75557f824ef21ee..01a1a0ed51aefd721b4bc7eba72= 8c29a8ffcd551 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Build +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Build @@ -2,7 +2,7 @@ perf-util-y +=3D Context.o =20 CFLAGS_Context.o +=3D $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-stric= t-prototypes -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-s= witch-enum CFLAGS_Context.o +=3D -Wno-unused-parameter -Wno-nested-externs -Wno-undef -CFLAGS_Context.o +=3D -Wno-switch-default -Wno-shadow +CFLAGS_Context.o +=3D -Wno-switch-default -Wno-shadow -Wno-thread-safety-a= nalysis =20 ifeq ($(CC_NO_CLANG), 1) CFLAGS_Context.o +=3D -Wno-unused-command-line-argument diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scri= pting-engines/Build index 2282fe3772f3bdc35056cb5e66efb3462dc1c2e3..24f087b0cd11b3e06a338c394dc= 2c650bc2c60b1 100644 --- a/tools/perf/util/scripting-engines/Build +++ b/tools/perf/util/scripting-engines/Build @@ -3,7 +3,7 @@ ifeq ($(CONFIG_LIBTRACEEVENT),y) endif perf-util-$(CONFIG_LIBPYTHON) +=3D trace-event-python.o =20 -CFLAGS_trace-event-perl.o +=3D $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -= Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs= -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-aft= er-statement -Wno-switch-enum +CFLAGS_trace-event-perl.o +=3D $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -= Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs= -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-aft= er-statement -Wno-switch-enum -Wno-thread-safety-analysis =20 # -Wno-declaration-after-statement: The python headers have mixed code wit= h declarations (decls after asserts, for instance) CFLAGS_trace-event-python.o +=3D $(PYTHON_EMBED_CCOPTS) -Wno-redundant-dec= ls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-deprecated= -declarations -Wno-switch-enum -Wno-declaration-after-statement --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38B722DC789; Mon, 6 Oct 2025 16:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767716; cv=none; b=Z4fwImoEDm0dQUVzfHMxqGXKm4nuIig4yyGRGPjsM+tzKMV4gmqMNczuWkqOJWyuBXhkRwWahU52d9THia+DGYpT47SJzggMFJDRiVvcgHsqxhOeedmxITXMXZEIlbd6BeKRcspHQ3cnuIokdpNbZ4EbiGRBIVRm0+JDcUfkonU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767716; c=relaxed/simple; bh=cmg2aP/OdJEbju4k0iOcFl8K9ZROTOnbUW84a1thBFk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ftBR0DTzLhY6LX+P8AYt2IEU6XCsD7MC3eM2KgSGPFe1/Hh/EACsOJ7KGGzVu3jzh37Y+GPCiKFA+Xa4aGIm0HfDkadHBL/GUlvm12KBWlPqJiIgEtp29/eUuciXGI8ryzoyq0zFB1mJ+ZDSGfJZ221Ly69M1lPnpDfDI3VsmI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C0951515; Mon, 6 Oct 2025 09:21:45 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02AA53F738; Mon, 6 Oct 2025 09:21:50 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:27 +0100 Subject: [PATCH v3 5/9] perf test coresight: Dismiss clang warning for memcpy thread Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-5-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=1020; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=cmg2aP/OdJEbju4k0iOcFl8K9ZROTOnbUW84a1thBFk=; b=uHQMo7Q9IxLbGpqgA/8C9HLBkjOOSprcJgKLgZ0Rx/RpLjPxbpgqOxRJy38umCaRiVBKPyshL fVA3ZirxbPWD2sjpi1KrhEXlCKlB375nqcGzKzIXJ4ngH/ykqJcGEvh X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= clang-18.1.3 on Ubuntu 24.04.2 reports warning: memcpy_thread.c:30:1: warning: non-void function does not return a value = in all control paths [-Wreturn-type] 30 | } | ^ Dismiss the warning with returning NULL from the thread function. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c= b/tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c index 5f886cd09e6b3a62b5690dade94f1f8cae3279d2..7e879217be30a86431989dbf1f3= 6d2134ef259cc 100644 --- a/tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c +++ b/tools/perf/tests/shell/coresight/memcpy_thread/memcpy_thread.c @@ -27,6 +27,8 @@ static void *thrfn(void *arg) } for (i =3D 0; i < len; i++) memcpy(dst, src, a->size * 1024); + + return NULL; } =20 static pthread_t new_thr(void *(*fn) (void *arg), void *arg) --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9FE82DE1FE; Mon, 6 Oct 2025 16:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767718; cv=none; b=MXqHxgm+87tpeIwYJh5yjTLvN70idrawwTMsUSCBEYCUbiXNWfGjFDGKqra6Dvt3dv7Q1evGMms9/7DIgxHARYqXd9vA0EpZpJYB7Z7Ht0o7C2ByftL1TU5Jd6Q7JLP9goCfPozL4IZAl7fzcG8YdMo0G7bz6Xz11P+QwhZEiZg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767718; c=relaxed/simple; bh=a3IPmV5jlnePssZURERzGDN5YmfphWeM3ATbsnwKAQg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iRLk+lR1lxNTc14Z6tSstg8EQDtCbIUKpooHa+Lwp1EXWrBoEZtEAjGZrgj+mLJxnaDQg34gS4djkDYT33pcCbZdxVDKHBS4lmg3YnSBfViKwB8sELqnz5mRxBJ+iNZ9E2X3o7fYKKZOFqfm1h6zT+sJe+MF09Nw+3WIvzVR6n8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58DB21516; Mon, 6 Oct 2025 09:21:48 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C43C33F738; Mon, 6 Oct 2025 09:21:53 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:28 +0100 Subject: [PATCH v3 6/9] perf test coresight: Dismiss clang warning for thread loop Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-6-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=2703; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=a3IPmV5jlnePssZURERzGDN5YmfphWeM3ATbsnwKAQg=; b=OsSTrd6d//ZmcbwP7/iVL4/KlsaJyKeaLDALKKWQf+IycnhEC8MFr0EWMFuV+FtOy/8aUMlVK XiDTqhxx8s0DHMhBJ9B15cITHrjjtS/ShJAyu37L2/Ngklwrhonzipy X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= clang-18.1.3 on Ubuntu 24.04.2 reports warning: thread_loop.c:41:23: warning: value size does not match register size spe= cified by the constraint and modifier [-Wasm-operand-widths] 41 | : /* in */ [i] "r" (i), [len] "r" (len) | ^ thread_loop.c:37:8: note: use constraint modifier "w" 37 | "add %[i], %[i], #1\n" | ^~~~ | %w[i] thread_loop.c:41:23: warning: value size does not match register size spe= cified by the constraint and modifier [-Wasm-operand-widths] 41 | : /* in */ [i] "r" (i), [len] "r" (len) | ^ thread_loop.c:37:14: note: use constraint modifier "w" 37 | "add %[i], %[i], #1\n" | ^~~~ | %w[i] thread_loop.c:41:23: warning: value size does not match register size spe= cified by the constraint and modifier [-Wasm-operand-widths] 41 | : /* in */ [i] "r" (i), [len] "r" (len) | ^ thread_loop.c:38:8: note: use constraint modifier "w" 38 | "cmp %[i], %[len]\n" | ^~~~ | %w[i] thread_loop.c:41:38: warning: value size does not match register size spe= cified by the constraint and modifier [-Wasm-operand-widths] 41 | : /* in */ [i] "r" (i), [len] "r" (len) | ^ thread_loop.c:38:14: note: use constraint modifier "w" 38 | "cmp %[i], %[len]\n" | ^~~~~~ | %w[len] Use the modifier "w" for 32-bit register access. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/perf/tests/shell/coresight/thread_loop/thread_loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/coresight/thread_loop/thread_loop.c b/t= ools/perf/tests/shell/coresight/thread_loop/thread_loop.c index e05a559253ca9d9366ad321d520349042fb07fca..86f3f548b00631682767665fc5e= 9d5b8551a3634 100644 --- a/tools/perf/tests/shell/coresight/thread_loop/thread_loop.c +++ b/tools/perf/tests/shell/coresight/thread_loop/thread_loop.c @@ -34,8 +34,8 @@ static void *thrfn(void *arg) } asm volatile( "loop:\n" - "add %[i], %[i], #1\n" - "cmp %[i], %[len]\n" + "add %w[i], %w[i], #1\n" + "cmp %w[i], %w[len]\n" "blt loop\n" : /* out */ : /* in */ [i] "r" (i), [len] "r" (len) --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FDE72DAFA3; Mon, 6 Oct 2025 16:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767721; cv=none; b=hv/7NbNc+gDFAanP0yLOTgun1vOsAZkiEJ11C3ueh5mdduHz0ylNwEyaYZECI7PdtWKDOVYA3JK/R8x24W/40pgS8SLIh4ZeJJQr6RHzCSxtnkGmVmpHBhoHC372aZLBPQ2gHJUJQAcE2m1AhrKLmWQCUIxjNDWXHmpn/NTqVfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767721; c=relaxed/simple; bh=6JaO7UUmiEVn7pKrHNGJDEz9BYZJxL1KrwbjcRDT7O4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eUhG0FK66W/bwFsP3yHMAwqzrfCtgf02gUUiOvUAMwWfSzE/YyGCTmmMuteeQu51lCRFRoa7Pf83mlrioh+dbGES5uM0d50fb5Eb46XEJToK1N2h53mhC+W6wmB3j+khvTeRkd1pDOaMgpqGwlgeLWFf+AE1jGWN8g/bgnVAZ8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2749E1515; Mon, 6 Oct 2025 09:21:51 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 926983F738; Mon, 6 Oct 2025 09:21:56 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:29 +0100 Subject: [PATCH v3 7/9] perf test coresight: Dismiss clang warning for unroll loop thread Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-7-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=1677; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=6JaO7UUmiEVn7pKrHNGJDEz9BYZJxL1KrwbjcRDT7O4=; b=Lt1QqvHfOSB9vlFHFsS4Jsx07yuXXDBJvHmH9ANcX4UcxoVzli1my1N8n0DqahPDTvzLHJsdb AG1Hvg+beaLDrTNowNSUpqt/TUBAaJzkKKDZ63Txa8cZJotCjhVyBMC X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= clang-18.1.3 on Ubuntu 24.04.2 reports warning: unroll_loop_thread.c:35:25: warning: value size does not match register s= ize specified by the constraint and modifier [-Wasm-operand-widths] 35 | : /* in */ [in] "r" (in) | ^ unroll_loop_thread.c:39:1: warning: non-void function does not return a v= alue [-Wreturn-type] 39 | } | ^ Use the modifier "w" for 32-bit register access and return NULL at the end of thread function. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- .../tests/shell/coresight/unroll_loop_thread/unroll_loop_thread.c | 4 = +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loo= p_thread.c b/tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loo= p_thread.c index 0fc7bf1a25af3607b40f091f62176134ddb7f9f6..8f4e1c985ca38ab545a05189432= a14a6d888d34c 100644 --- a/tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loop_threa= d.c +++ b/tools/perf/tests/shell/coresight/unroll_loop_thread/unroll_loop_threa= d.c @@ -20,7 +20,7 @@ static void *thrfn(void *arg) for (i =3D 0; i < 10000; i++) { asm volatile ( // force an unroll of thia add instruction so we can test long runs of code -#define SNIP1 "add %[in], %[in], #1\n" +#define SNIP1 "add %w[in], %w[in], #1\n" // 10 #define SNIP2 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 SNIP1 // 100 @@ -36,6 +36,8 @@ static void *thrfn(void *arg) : /* clobber */ ); } + + return NULL; } =20 static pthread_t new_thr(void *(*fn) (void *arg), void *arg) --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A8212DECA0; Mon, 6 Oct 2025 16:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767724; cv=none; b=WpKhE+d+kgdXvjYHf2DKUSJPQP4DZEKwhGo0sc7/O+3AApPsx51hyC3tkQab+GJFOD8E6QpFjERRygfLAmnqHzRnw9dz0f2Qqy7KK0fbJvI0EW2AqUJF2KyYTYDacZdTPjRF2SDcBctuYgXjJhgc1hUBcy/JFZxtUqYUoc32pUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767724; c=relaxed/simple; bh=wkvR3xgU9zsjoyU6Z+96rh2Bwjg67hx/XgTNQZzIguQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o43AQTgX0ULSTpoFps05/hrp9ubwTLeR7R03aIihRM8476ZDwWuOateAdj83y4s1H81PEM26em8sfIg2ajnHY5uVpxK9w3F98pP0f1Pa7QThfTjf8rC8eGouujZqpkrMMmhbZo5iG9V8bjqTcXJgplWW0pXXmrvYAd09K5gD4Jk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA6961516; Mon, 6 Oct 2025 09:21:53 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 605F73F738; Mon, 6 Oct 2025 09:21:59 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:30 +0100 Subject: [PATCH v3 8/9] perf build: Support build with clang Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-8-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=2815; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=wkvR3xgU9zsjoyU6Z+96rh2Bwjg67hx/XgTNQZzIguQ=; b=/XWpMHeWTC73xiF7JjyT34LymlXXmT3i4DbrxJQQFnXHHoOY+du9YQ9nZamPxUiUN3H5F/yX3 kr/f0rOif9tD/Tc37CZFro3HV5ftH5Nih62dOt8yPUFj9yXH20hWjVa X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= Add support for building perf with clang. For cross compilation, the Makefile dynamically selects target flag for corresponding arch. This patch has been verified on x86_64 machine with Ubuntu distro, it can build successfully for native target, and for cross building Arm64 and s390. Example: native build on x86_64 / Ubuntu machine: $ HOSTCC=3Dclang CC=3Dclang CXX=3Dclang++ make -C tools/perf Example: cross building s390 target on x86_64 / Ubuntu machine: # Install x390x cross toolchain and headers $ sudo apt-get install gcc-s390x-linux-gnu g++-s390x-linux-gnu \ libc6-dev-s390x-cross linux-libc-dev-s390x-cross # Build with clang $ HOSTCC=3Dclang CC=3Dclang CXX=3Dclang++ \ ARCH=3Ds390 CROSS_COMPILE=3Ds390x-linux-gnu- \ make -C tools/perf NO_LIBELF=3D1 NO_LIBTRACEEVENT=3D1 NO_LIBPYTHON=3D1 Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/perf/Makefile.config | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5a5832ee7b53c604ec0d90c5ca7e2bee5bfa6a17..616e71b3d897493a2b14612cdcf= 4a872e2296f4d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -23,8 +23,39 @@ HOSTCFLAGS :=3D $(filter-out -Wnested-externs,$(EXTRA_WA= RNINGS)) # borrowed from kernel headers depends on it, e.g. put_unaligned_*(). CFLAGS +=3D -fno-strict-aliasing =20 -# Enabled Wthread-safety analysis for clang builds. +# Set target flag and options when using clang as compiler. ifeq ($(CC_NO_CLANG), 0) + CLANG_TARGET_FLAGS_arm :=3D arm-linux-gnueabi + CLANG_TARGET_FLAGS_arm64 :=3D aarch64-linux-gnu + CLANG_TARGET_FLAGS_m68k :=3D m68k-linux-gnu + CLANG_TARGET_FLAGS_mips :=3D mipsel-linux-gnu + CLANG_TARGET_FLAGS_powerpc :=3D powerpc64le-linux-gnu + CLANG_TARGET_FLAGS_riscv :=3D riscv64-linux-gnu + CLANG_TARGET_FLAGS_s390 :=3D s390x-linux-gnu + CLANG_TARGET_FLAGS_x86 :=3D x86_64-linux-gnu + CLANG_TARGET_FLAGS_x86_64 :=3D x86_64-linux-gnu + + # Default to host architecture if ARCH is not explicitly given. + ifeq ($(ARCH), $(HOSTARCH)) + CLANG_TARGET_FLAGS :=3D $(shell $(CLANG) -print-target-triple) + else + CLANG_TARGET_FLAGS :=3D $(CLANG_TARGET_FLAGS_$(ARCH)) + endif + + ifeq ($(CROSS_COMPILE),) + ifeq ($(CLANG_TARGET_FLAGS),) + $(error Specify CROSS_COMPILE or add CLANG_TARGET_FLAGS for $(ARCH)) + else + CLANG_FLAGS +=3D --target=3D$(CLANG_TARGET_FLAGS) + endif # CLANG_TARGET_FLAGS + else + CLANG_FLAGS +=3D --target=3D$(notdir $(CROSS_COMPILE:%-=3D%)) + endif # CROSS_COMPILE + + CC :=3D $(CLANG) $(CLANG_FLAGS) -fintegrated-as + CXX :=3D $(CXX) $(CLANG_FLAGS) -fintegrated-as + + # Enabled Wthread-safety analysis for clang builds. CFLAGS +=3D -Wthread-safety endif =20 --=20 2.34.1 From nobody Sun Dec 7 23:48:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 136972DECD2; Mon, 6 Oct 2025 16:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767726; cv=none; b=VCFQwb5p3aM4MGeUQzMfGiTUDhyO7RBpO+hwOQnQClEQcHzswFa3A1yuTNVndJ0AaJAn4u521nnMJnygaEpYxz4VWYS8enUIiDF8BmScBXxMUHYee0cnTUdkMO1gMrvQ0iY4wHlT2osDhr7SsLNsTEcKFvNMEYVR5wrRT0LRoVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759767726; c=relaxed/simple; bh=yLdtJoXXg2ZofvQ3tks4npYZRXDJBWfYweloxYQbePU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RQQHgA2ZI2juPZ/f0fKTxcgfrD/5STqsu0iXDXbo9A3GDPVoRk2dCXRW9MwOvfDarA89Tfr/TmBICl1hPZYPOfoEL32bT+WD9mVRqMXUPPSVAJU3C3NzPtKehSyr3D/TNbw/bjOO75futYsdLGWugyHMrebdKVl0EDC4E1xrkv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B47821515; Mon, 6 Oct 2025 09:21:56 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2E0EA3F738; Mon, 6 Oct 2025 09:22:02 -0700 (PDT) From: Leo Yan Date: Mon, 06 Oct 2025 17:21:31 +0100 Subject: [PATCH v3 9/9] perf docs: Document building with Clang Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251006-perf_build_android_ndk-v3-9-4305590795b2@arm.com> References: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> In-Reply-To: <20251006-perf_build_android_ndk-v3-0-4305590795b2@arm.com> To: Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759767696; l=5456; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=yLdtJoXXg2ZofvQ3tks4npYZRXDJBWfYweloxYQbePU=; b=iOckLph1iYJ9s0sP+7wDulOCeNPGoUWbOyJCvZQabdA+mLUluT6/cAYOwIPh8MUXieOr7dQU6 as19EERlH8HBRcaFZMy35EzfKzaHWd+0dTajOdGQzKBnLH5E8RyD1wr X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= Add example commands for building perf with Clang. Since recent Android NDK releases use Clang as the default compiler, a separate Android specific document is no longer needed; point to the general build documentation instead. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers --- tools/perf/Documentation/Build.txt | 15 +++++++ tools/perf/Documentation/android.txt | 80 +++-----------------------------= ---- 2 files changed, 21 insertions(+), 74 deletions(-) diff --git a/tools/perf/Documentation/Build.txt b/tools/perf/Documentation/= Build.txt index 83dc87c662b63ecc17553a15cc15a6b8d6f01d83..57b226e7fc2f8e849dfe58b3af3= 1891f58dfd0af 100644 --- a/tools/perf/Documentation/Build.txt +++ b/tools/perf/Documentation/Build.txt @@ -99,3 +99,18 @@ configuration paths for cross building: In this case, the variable PKG_CONFIG_SYSROOT_DIR can be used alongside the variable PKG_CONFIG_LIBDIR or PKG_CONFIG_PATH to prepend the sysroot path = to the library paths for cross compilation. + +5) Build with Clang +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +By default, the makefile uses GCC as compiler. With specifying environment +variables HOSTCC, CC and CXX, it allows to build perf with Clang. + +Using Clang for a native build: + + $ HOSTCC=3Dclang CC=3Dclang CXX=3Dclang++ make -C tools/perf + +Specifying ARCH and CROSS_COMPILE for cross compilation: + + $ HOSTCC=3Dclang CC=3Dclang CXX=3Dclang++ \ + ARCH=3Darm64 CROSS_COMPILE=3Daarch64-linux-gnu- \ + make -C tools/perf diff --git a/tools/perf/Documentation/android.txt b/tools/perf/Documentatio= n/android.txt index 24a59998fc91e814ad96f658d3481d88d798b60c..3f3cc7ac3d139c5517ec9458f13= c06249c701429 100644 --- a/tools/perf/Documentation/android.txt +++ b/tools/perf/Documentation/android.txt @@ -1,78 +1,10 @@ How to compile perf for Android -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =20 -I. Set the Android NDK environment ------------------------------------------------- +There are two ways to build perf and run it on Android: =20 -(a). Use the Android NDK ------------------------------------------------- -1. You need to download and install the Android Native Development Kit (ND= K). -Set the NDK variable to point to the path where you installed the NDK: - export NDK=3D/path/to/android-ndk +- Method 1: Build perf with static linking. See Build.txt, section + "4) Cross compilation" for how to build a static perf binary. =20 -2. Set cross-compiling environment variables for NDK toolchain and sysroot. -For arm: - export NDK_TOOLCHAIN=3D${NDK}/toolchains/arm-linux-androideabi-4.9/prebu= ilt/linux-x86_64/bin/arm-linux-androideabi- - export NDK_SYSROOT=3D${NDK}/platforms/android-24/arch-arm -For x86: - export NDK_TOOLCHAIN=3D${NDK}/toolchains/x86-4.9/prebuilt/linux-x86_64/b= in/i686-linux-android- - export NDK_SYSROOT=3D${NDK}/platforms/android-24/arch-x86 - -This method is only tested for Android NDK versions Revision 11b and later. -perf uses some bionic enhancements that are not included in prior NDK vers= ions. -You can use method (b) described below instead. - -(b). Use the Android source tree ------------------------------------------------ -1. Download the master branch of the Android source tree. -Set the environment for the target you want using: - source build/envsetup.sh - lunch - -2. Build your own NDK sysroot to contain latest bionic changes and set the -NDK sysroot environment variable. - cd ${ANDROID_BUILD_TOP}/ndk -For arm: - ./build/tools/build-ndk-sysroot.sh --abi=3Darm - export NDK_SYSROOT=3D${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/= arch-arm -For x86: - ./build/tools/build-ndk-sysroot.sh --abi=3Dx86 - export NDK_SYSROOT=3D${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/= arch-x86 - -3. Set the NDK toolchain environment variable. -For arm: - export NDK_TOOLCHAIN=3D${ANDROID_TOOLCHAIN}/arm-linux-androideabi- -For x86: - export NDK_TOOLCHAIN=3D${ANDROID_TOOLCHAIN}/i686-linux-android- - -II. Compile perf for Android ------------------------------------------------- -You need to run make with the NDK toolchain and sysroot defined above: -For arm: - make WERROR=3D0 ARCH=3Darm CROSS_COMPILE=3D${NDK_TOOLCHAIN} EXTRA_CFLAGS= =3D"-pie --sysroot=3D${NDK_SYSROOT}" -For x86: - make WERROR=3D0 ARCH=3Dx86 CROSS_COMPILE=3D${NDK_TOOLCHAIN} EXTRA_CFLAGS= =3D"-pie --sysroot=3D${NDK_SYSROOT}" - -III. Install perf ------------------------------------------------ -You need to connect to your Android device/emulator using adb. -Install perf using: - adb push perf /data/perf - -If you also want to use perf-archive you need busybox tools for Android. -For installing perf-archive, you first need to replace #!/bin/bash with #!= /system/bin/sh: - sed 's/#!\/bin\/bash/#!\/system\/bin\/sh/g' perf-archive >> /tmp/perf-ar= chive - chmod +x /tmp/perf-archive - adb push /tmp/perf-archive /data/perf-archive - -IV. Environment settings for running perf ------------------------------------------------- -Some perf features need environment variables to run properly. -You need to set these before running perf on the target: - adb shell - # PERF_PAGER=3Dcat - -IV. Run perf ------------------------------------------------- -Run perf on your device/emulator to which you previously connected using a= db: - # ./data/perf +- Method 2: Download the Android NDK and use the bundled Clang to + build perf. See Build.txt, section "5) Build with clang" for details. --=20 2.34.1