From nobody Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A92CB24DCFD; Tue, 30 Sep 2025 16:55:17 +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=1759251319; cv=none; b=u4Ku+EIKaRbbCj5qqa4nN3nAbeJpQHOHqyiyzwNo8QfpGFsZwzMqeNwkdkSqj6/V36F4CZN3w9j2sW4JsbdaIi77dK6lHvEU6Ufo2brukNU37vahDmx6hK4T8JyQ4x5a2qHPX7BHCRd0H0vkOJYMzS25wmn5ZFhHuGy8+41mGvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251319; c=relaxed/simple; bh=vNDVZkxHA2mAyiZ+UlvQxAZSagxQ4O7RbrAShEgaA5E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bs2GYXkxgpkDFDIpWijYM7ETLH9oZ30FzSdzHL2cY0rmkooVGksUlux69Z5wkD4g7ZKx9nboQ8AsKMwPC62Y2rafLd4sMe7cUbh1NlsIPMRHx8jbz2lVJ2AvPinVpuMkhcDaKP7VwjSdfS25xvafnqGilmO2gD6VOaSbDkogdpg= 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 10EAA2008; Tue, 30 Sep 2025 09:55:09 -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 954723F59E; Tue, 30 Sep 2025 09:55:14 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:49 +0100 Subject: [PATCH v2 1/8] 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: <20250930-perf_build_android_ndk-v2-1-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=1150; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=vNDVZkxHA2mAyiZ+UlvQxAZSagxQ4O7RbrAShEgaA5E=; b=w7geYiaMAhmUPgqu3bi/nGiCnmua6rreR48+qZ4pZCNSG9KTt61MKH5OumTf1BVK3X6ibYOqW B92+AuPnQt7CdbPLYUilbKZ5SeIZ/wLIVI1rXLuLiBnG1pYqqNgQ6R3 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A57CE258CD0; Tue, 30 Sep 2025 16:55:20 +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=1759251323; cv=none; b=j2911bag7/i2BSqskhJciTr9nZUij52P8HPc4t4EihpYyMfekkloCg0NFddqyI3X441ABJzoQYT0YHEuMAhuFemQnZiwUDmcs/Kl9B62pLArwYueZIfWtobxqh0vQf5R7btwcpezltDY/+o897UEqxwRFpRg6fbAyNbmi3eMXPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251323; c=relaxed/simple; bh=H3wg4rcmLVUVzF6Navqmshn4de5zeGYk8fBYI7vbo5o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JyC/PATEBE6rmfz2Ng5FecNnqJDNRZ8GunWVmLMUNcJokwXVrl4a5XqywBwfK6K3L10HRs4UeTwsC7Ib5FKNd7qCREZoBgRdH2YMpQ/SM9jo376VchZMMxn0QWC56EH06gDx1wK13EFTWuB4++4RWiOIUb5WYdV9nmXjwKrth6s= 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 CE559106F; Tue, 30 Sep 2025 09:55:11 -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 604F63F59E; Tue, 30 Sep 2025 09:55:17 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:50 +0100 Subject: [PATCH v2 2/8] 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: <20250930-perf_build_android_ndk-v2-2-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=2000; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=H3wg4rcmLVUVzF6Navqmshn4de5zeGYk8fBYI7vbo5o=; b=2vHDvyqlu2enxBTGiXwfLSV7xEVnSv8i37X0B+GoSrV88y/V3SsM8vL77Bnn6rQkXvu98RMsa ZuVM9X6VygdD4ewiXvtmQkHJ3eqY4AYznAQKuN7R3CLv6r6g84A+UoX 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 353F223816D; Tue, 30 Sep 2025 16:55:23 +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=1759251324; cv=none; b=dN28iOhBn25StQ58+YK7F9UADKo8y9LSeiE2lhwBTxUAoFX+f8csVYNvFHkWgqDHWMJClUuLAF/xDqeWE2lW7JivQSpx0l3Cd65rUaKwmaBmkEmRc/OGeXbVnt98tXOj6PYVzp07STLUJsHU5+e7MhsMmzK5LVlOL46HWdvAF/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251324; 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=uB/AKJZYb6jkfFjLNJwuYx86KhMVDALgTtqxkgPE7ofYnIucsGJ0VKiSsl742M05b/Le48jqK/Yv/fRd+ritZ9ubLpALizDuFp3XUSwH5FUwSj8cENp2XPBq+qC2AOLiEpO7CbNqYxhFs+NJ+cviuetuhrJbq4dIqKtLh/iNv/U= 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 9DA6A2008; Tue, 30 Sep 2025 09:55:14 -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 2B9DB3F59E; Tue, 30 Sep 2025 09:55:20 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:51 +0100 Subject: [PATCH v2 3/8] 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: <20250930-perf_build_android_ndk-v2-3-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=1923; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=m3SmlzRsMKVpO74OXfiVE3r/DuuiN/mWjDes/0cwih0=; b=qUc6vL977vzutRPctHwk1sckCH+1J1T6H7bOBO7DYTmLBmUjwij5vDGLB3/y7XbyFMRL7bm1h LqO51kVR3eMAVhrO7d+2ZKDZqEN6w1OzCZrAWr9lUOxhTmkvAWy1Mc3 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE44326B76D; Tue, 30 Sep 2025 16:55:25 +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=1759251327; cv=none; b=F8QShiUBjQgo+EStMKd5kKC3USaGJ0F7mht/Emik1Rigixd+OIfDK63lyAHrzc1XmkxfBnaa79XYX3KgWnHI/V2ZDmfEKXtAJH4NtSL+zAx8GpVwZYzKnGsA3IO0/abj12HdXcZ8Mlp3HeKV/w8e0KIb1hWllUnWuz9ZH+vFDtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251327; c=relaxed/simple; bh=cmg2aP/OdJEbju4k0iOcFl8K9ZROTOnbUW84a1thBFk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kJRfIuGsMKpHe9XIyHsEc+Y7eNtRzszVwNxzNAJOtHAOk0SqzAavZYm6ETlM80wIQ4KR7NLNmFXF/s1YyFSppO/jqmLIW+MGOdqzsyvon9vmJ7Ud4wK9tW7GhpcLdiSWKf9V5515MevOfbVAn5Xt81ZSUJF5gk1QPlg0L5sKdN8= 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 68925106F; Tue, 30 Sep 2025 09:55:17 -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 EBC5D3F59E; Tue, 30 Sep 2025 09:55:22 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:52 +0100 Subject: [PATCH v2 4/8] 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: <20250930-perf_build_android_ndk-v2-4-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=1020; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=cmg2aP/OdJEbju4k0iOcFl8K9ZROTOnbUW84a1thBFk=; b=NzpFUhV66bUX0M0Pm4Pz/PqkXq7i194l89hn5IBh5wwZxXbjFJrR5wji5ol2lgY1iOPzIKbUJ 7G7Jfxa7djGB4lRZv8rn38KcngiSvFQ6kkU5I/55nYuXDh5YsYtJVjU 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4B322FD1DD; Tue, 30 Sep 2025 16:55:28 +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=1759251330; cv=none; b=M5WOYIEj/vH5IM0vWvLmhFsgeHn245SxVrxOYiaot5O3XM5OWE20tyLU1EnRM3XXTnOgckmZjcvcJiBNByZQ1jEX40LehPaXkWtPuBZlCkRRM/r1ntIYBpP4uNNMDaHSYfnD+0VdSfUSZh5rqorgi6Im8vYcz9swJru7tmjQ5RY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251330; c=relaxed/simple; bh=a3IPmV5jlnePssZURERzGDN5YmfphWeM3ATbsnwKAQg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DpS3g86BuRUs+zNmUJi/tM/F/6wmjec65EZOAZ7kgBkXuIRL7WLdnwXi/7JP8scz9HGxpgdlklLEZL0FXKM80mW6Q6c5wIlIhBdLFnV/r5QIHmlW02u2lkH4HpIHBXbx5RxNd1N5EQcFuA/CMd/uLWIdsMPSwnY00cemaYWjXU0= 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 32EA7106F; Tue, 30 Sep 2025 09:55:20 -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 B6E043F59E; Tue, 30 Sep 2025 09:55:25 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:53 +0100 Subject: [PATCH v2 5/8] 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: <20250930-perf_build_android_ndk-v2-5-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=2703; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=a3IPmV5jlnePssZURERzGDN5YmfphWeM3ATbsnwKAQg=; b=vV+Y+NsPePJIfaTYrBDvJtmASIFlh0Nww8t9nCOPormGSRZygLa6d5RlDQhhzRvjeJX8fxoXS FjeM0K78Jm0CfjVXElkV31/v+kBcou/0VrYp5eyf7BbEC/AMDo5VdDY 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A01703064AA; Tue, 30 Sep 2025 16:55:31 +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=1759251333; cv=none; b=LEWpYBCt9BYpa6Tt2GLQkcnqK8+D/DuWiynV0ub9vjWIXiz8DtNZ5jndDAslPABSUICPNXUIuTnWcCJlsfuoK1B4utoIyceIopwILwRu26RujCukvH9KWe4SNn5gTp/H/GakDEf9jCGIMlDN/576fVbXHlS+K9+4waH3yFzt48g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251333; c=relaxed/simple; bh=6JaO7UUmiEVn7pKrHNGJDEz9BYZJxL1KrwbjcRDT7O4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tDsbon7YKdFsDxuU+ZeVHbBH4GhdBjU/3G6oGMVpVKBqCzc8qBqTbZF5qHoUa38Me8i/udujTVOk1XYqZt12zOTKFP3YyfqFru060RyYpgUIjXnzCjHr4+yEXlYw0J8UN6uTcJbeVQUMMlUutJsthioLg18yyFeTzf49KONTTS8= 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 F359E106F; Tue, 30 Sep 2025 09:55:22 -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 82A923F59E; Tue, 30 Sep 2025 09:55:28 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:54 +0100 Subject: [PATCH v2 6/8] 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: <20250930-perf_build_android_ndk-v2-6-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=1677; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=6JaO7UUmiEVn7pKrHNGJDEz9BYZJxL1KrwbjcRDT7O4=; b=IL/PtsxjrtyZRg6KRWstnSYp5wNt6/32M/wHANXmPmbiMF5O1tf7AOPJLXWhrVbYU1Tb3s5/B MMKbuhplGktCHa4HUqCP/OH0wowWkyrD+ugaDL6GNmXy9AZeLgP3bN/ 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36EBD3081A5; Tue, 30 Sep 2025 16:55:34 +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=1759251335; cv=none; b=eeE9qA/+oGuSR88trI4g7SGU0WtngFSY4LjsJRM7NMN7TL2mjbsybPGKeaj62dYPqPAd1cuA+EPx2xfLrN5dVYKDutd4GiJTSiSCAtEf0awa90/+aIkqaQ5HRiR7tR0CkZDWvnqGhW8evxAfgN7SKwtbREJaNT/Qf8pT4WwCmVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251335; c=relaxed/simple; bh=miZL6Yzqk6/EUWPBBeudxyQE12NEiBHtXzL1MUUXC30=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RK6WPfto/qPfh9PHaPTiWLpIvwv5RZVDlECR0DSuQHqeitEg1kPRlx/yTaPR6RbuQB/ooadC2xVpYhGHWBTo0URFrfC1V1iixw+YjdO9BvojVnSDBeN7ZLEkuR1kIxS8eoj8vYoljPZ0LqrYqKAcA15662Gk25BsUEXJ0AmCf9A= 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 C0EA6106F; Tue, 30 Sep 2025 09:55:25 -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 4F1943F59E; Tue, 30 Sep 2025 09:55:31 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:55 +0100 Subject: [PATCH v2 7/8] 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: <20250930-perf_build_android_ndk-v2-7-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=2752; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=miZL6Yzqk6/EUWPBBeudxyQE12NEiBHtXzL1MUUXC30=; b=MWei7t108/0dA/kXy0ivVqULgek1bY/nXrQfnZA/ANTPxo7folMUdgQgOSBpxfxzC5Cgo+9Fu BBwu05SO9FQB5jfviSiUmBw2xM//AI4LOcPrkUAdjauckTx51vIaZbC 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 | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5a5832ee7b53c604ec0d90c5ca7e2bee5bfa6a17..a2b5c291a364cbf331c16384764= 520dfe330a04c 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -23,8 +23,38 @@ 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 + + # Default to host architecture if ARCH is not explicitly given. + ifeq ($(ARCH),) + 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 Wed Oct 1 21:24:17 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D054309DCC; Tue, 30 Sep 2025 16:55:36 +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=1759251338; cv=none; b=iFIXfWlPnEOHpQItg6ae83DbEp4ZJBRIPCzmilBJkjcDuKs5k2UVyT3gdxv3YI2Kn3QEIah55vxyNrfDHiFPUDoTrJHaImRIDEt09fMYvynem8FIy/n79qQMg8G+mt5Ut0vAim9TTWi5rOfbWaIPev8Ky4ZXWx6mDxP90bmdJMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759251338; c=relaxed/simple; bh=yLdtJoXXg2ZofvQ3tks4npYZRXDJBWfYweloxYQbePU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mlDx1FTcdcCuRdRoijxuL/ipe9qBk9fh4Jk0AzmvOPKjJF84Zaq4u5+mYrqO12Gq9iRZo80+O0T1vqKdTxFaOPDxHYPSFICEj0nSHaLfnx2gNjOhwA/qlQ7+GZoC48gPMdBIlJYGGtAKJdULCOrov/t8nfGKNodmRLjTAV5rV38= 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 8C47F2008; Tue, 30 Sep 2025 09:55:28 -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 1AFB83F59E; Tue, 30 Sep 2025 09:55:33 -0700 (PDT) From: Leo Yan Date: Tue, 30 Sep 2025 17:54:56 +0100 Subject: [PATCH v2 8/8] 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: <20250930-perf_build_android_ndk-v2-8-2ea440b7ef01@arm.com> References: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@arm.com> In-Reply-To: <20250930-perf_build_android_ndk-v2-0-2ea440b7ef01@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=1759251311; l=5456; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=yLdtJoXXg2ZofvQ3tks4npYZRXDJBWfYweloxYQbePU=; b=FAHvogt9BofB+eIklO3kgKv4aDBql7NZWnSq1CV1Ut4b5S2ajzlknnf8ataA62OL5M2om3hlJ FpXCimKSy9fBOmaFofQlJyp/VQTvmsbG6UiFoeGj/r9e8o/n5eCKsET 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