public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: xur@google•com
To: Yabin Cui <yabinc@google•com>, Will Deacon <will@kernel•org>,
	Han Shen <shenhan@google•com>,
	 Thomas Gleixner <tglx@linutronix•de>,
	Ingo Molnar <mingo@redhat•com>, Borislav Petkov <bp@alien8•de>,
	 Dave Hansen <dave.hansen@linux•intel.com>,
	"H. Peter Anvin" <hpa@zytor•com>, Kees Cook <kees@kernel•org>,
	 Nathan Chancellor <nathan@kernel•org>,
	Nicolas Schier <nicolas.schier@linux•dev>,
	 Linus Walleij <linusw@kernel•org>, Arnd Bergmann <arnd@arndb•de>,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios•com>,
	Rong Xu <xur@google•com>,  Miguel Ojeda <ojeda@kernel•org>,
	Peter Zijlstra <peterz@infradead•org>,
	 Jinjie Ruan <ruanjinjie@huawei•com>,
	Lukas Bulwahn <lukas.bulwahn@redhat•com>,
	 linux-kernel@vger•kernel.org, Juergen Gross <jgross@suse•com>,
	 Helge Deller <deller@gmx•de>,
	Ryan Roberts <ryan.roberts@arm•com>,
	Marc Zyngier <maz@kernel•org>,  Ard Biesheuvel <ardb@kernel•org>,
	Vincent Donnefort <vdonnefort@google•com>,
	 Alice Ryhl <aliceryhl@google•com>
Cc: x86@kernel•org, linux-arm-kernel@lists•infradead.org
Subject: [PATCH v4 2/2] kconfig: Remove the architecture specific config for Propeller
Date: Thu,  4 Jun 2026 12:56:08 -0700	[thread overview]
Message-ID: <20260604195612.3757860-3-xur@google.com> (raw)
In-Reply-To: <20260604195612.3757860-1-xur@google.com>

From: Rong Xu <xur@google•com>

The CONFIG_PROPELLER_CLANG option currently depends on
ARCH_SUPPORTS_PROPELLER_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_PROPELLER_CLANG and allow users to control
Propeller builds solely through CONFIG_PROPELLER_CLANG. This simplifies
the kconfig and avoids potential confusion.

Move the .llvm_bb_addr_map sections grouping to
include/asm-generic/vmlinux.lds.h.

The Propeller documentation has been updated to reflect the most
recent tool location and now includes instructions for arm64.

Contributor Acknowledgments:
  * SPE instructions: Daniel Hoekwater <hoekwater@google•com>

Signed-off-by: Rong Xu <xur@google•com>
Suggested-by: Will Deacon <will@kernel•org>
Suggested-by: Nathan Chancellor <nathan@kernel•org>
Tested-by: Yabin Cui <yabinc@google•com>
Reviewed-by: Kees Cook <kees@kernel•org>
---
 Documentation/dev-tools/propeller.rst | 49 ++++++++++++++++++++-------
 arch/Kconfig                          |  5 +--
 arch/arm64/kernel/vmlinux.lds.S       |  1 +
 arch/x86/Kconfig                      |  1 -
 arch/x86/kernel/vmlinux.lds.S         |  5 +--
 include/asm-generic/vmlinux.lds.h     |  6 ++++
 6 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/Documentation/dev-tools/propeller.rst b/Documentation/dev-tools/propeller.rst
index 92195958e3db..e927319941c9 100644
--- a/Documentation/dev-tools/propeller.rst
+++ b/Documentation/dev-tools/propeller.rst
@@ -28,8 +28,10 @@ A few important notes about adopting Propeller optimization:
    and the linker(ld.lld).
 
 #. In addition to LLVM toolchain, Propeller requires a profiling
-   conversion tool: https://github.com/google/autofdo with a release
-   after v0.30.1: https://github.com/google/autofdo/releases/tag/v0.30.1.
+   conversion tool: https://github.com/google/llvm-propeller.
+
+Current supported architectures include x86/X86_64 (via LBR),
+and arm64 (via SPE).
 
 The Propeller optimization process involves the following steps:
 
@@ -124,17 +126,30 @@ Here is an example workflow for building an AutoFDO+Propeller kernel:
 
       $ perf record --pfm-event RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a -N -b -c <count> -o <perf_file> -- <loadtest>
 
-   Note you can repeat the above steps to collect multiple <perf_file>s.
+   - For arm64 with SPE::
+     There are a few kernel features that must be enabled to collect SPE profiles on Arm.
+     Below is a list of the required features:
+
+      - CONFIG_ARM_SPE_PMU=y
+      - CONFIG_PID_IN_CONTEXTIDR=y
+      - kpti=off
+
+     Use the following command to generate SPE perf data file::
+
+      $ perf record -e 'arm_spe_0/branch_filter=1,load_filter=0,store_filter=0/' -a -N -c <count> --no-switch-events -o <perf_file> -- <loadtest>
+
+     Note you can repeat the above steps to collect multiple <perf_file>s.
 
 4) (Optional) Download the raw perf file(s) to the host machine.
 
-5) Use the create_llvm_prof tool (https://github.com/google/autofdo) to
+5) Use the generate_propeller_profiles tool (https://github.com/google/llvm-propeller) to
    generate Propeller profile. ::
 
-      $ create_llvm_prof --binary=<vmlinux> --profile=<perf_file>
-                         --format=propeller --propeller_output_module_name
-                         --out=<propeller_profile_prefix>_cc_profile.txt
-                         --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt
+      $ generate_propeller_profiles \
+             --binary=<vmlinux> --profile=<perf_file> \
+             --format=propeller --propeller_output_module_name \
+             --out=<propeller_profile_prefix>_cc_profile.txt \
+             --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt
 
    "<propeller_profile_prefix>" can be something like "/home/user/dir/any_string".
 
@@ -146,10 +161,20 @@ Here is an example workflow for building an AutoFDO+Propeller kernel:
    you can create a temp list file "<perf_file_list>" with each line
    containing one perf file name and run::
 
-      $ create_llvm_prof --binary=<vmlinux> --profile=@<perf_file_list>
-                         --format=propeller --propeller_output_module_name
-                         --out=<propeller_profile_prefix>_cc_profile.txt
-                         --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt
+      $ generate_propeller_profiles \
+             --binary=<vmlinux> --profile=@<perf_file_list> \
+             --format=propeller --propeller_output_module_name \
+             --out=<propeller_profile_prefix>_cc_profile.txt \
+             --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt
+
+   For arm64 SPE, add the option '--profiler=perf_spe', like::
+
+      $ generate_propeller_profiles  \
+             --binary=<vmlinux> --profile=<perf_file> \
+             --profiler=perf_spe \
+             --format=propeller --propeller_output_module_name \
+             --out=<propeller_profile_prefix>_cc_profile.txt \
+             --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt
 
 6) Rebuild the kernel using the AutoFDO and Propeller
    profiles. ::
diff --git a/arch/Kconfig b/arch/Kconfig
index 5e878924939a..99c2017eb515 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -895,13 +895,10 @@ config AUTOFDO_CLANG
 
 	  If unsure, say N.
 
-config ARCH_SUPPORTS_PROPELLER_CLANG
-	bool
-
 config PROPELLER_CLANG
 	bool "Enable Clang's Propeller build"
-	depends on ARCH_SUPPORTS_PROPELLER_CLANG
 	depends on CC_IS_CLANG && CLANG_VERSION >= 190000
+	depends on $(cc-option,-fbasic-block-sections=list=/dev/null)
 	help
 	  This option enables Clang’s Propeller build. When the Propeller
 	  profiles is specified in variable CLANG_PROPELLER_PROFILE_PREFIX
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index e1ac876200a3..8aaf404980a7 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -368,6 +368,7 @@ SECTIONS
 
 	STABS_DEBUG
 	DWARF_DEBUG
+	PROPELLER_DATA
 	MODINFO
 	ELF_DETAILS
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 10bf3984102e..b875d2f27e48 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -130,7 +130,6 @@ config X86
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_RT
-	select ARCH_SUPPORTS_PROPELLER_CLANG    if X86_64
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF		if X86_CX8
 	select ARCH_USE_MEMTEST
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 4711a35e706c..74e336d7f9dd 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -423,10 +423,7 @@ SECTIONS
 
 	STABS_DEBUG
 	DWARF_DEBUG
-#ifdef CONFIG_PROPELLER_CLANG
-	.llvm_bb_addr_map : { *(.llvm_bb_addr_map) }
-#endif
-
+	PROPELLER_DATA
 	MODINFO
 	ELF_DETAILS
 
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 60c8c22fd3e4..5659f4b5a125 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1011,6 +1011,12 @@
 #define PERCPU_DECRYPTED_SECTION
 #endif
 
+#ifdef CONFIG_PROPELLER_CLANG
+#define PROPELLER_DATA                                                     \
+	.llvm_bb_addr_map : { *(.llvm_bb_addr_map) }
+#else
+#define PROPELLER_DATA
+#endif
 
 /*
  * Default discarded sections.
-- 
2.54.0.1032.g2f8565e1d1-goog



      parent reply	other threads:[~2026-06-04 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 19:56 [PATCH v4 0/2] kconfig: Remove the architecture specific config for AutoFDO and Propeller xur
2026-06-04 19:56 ` [PATCH v4 1/2] kconfig: Remove the architecture specific config for AutoFDO xur
2026-06-04 19:56 ` xur [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260604195612.3757860-3-xur@google.com \
    --to=xur@google$(echo .)com \
    --cc=aliceryhl@google$(echo .)com \
    --cc=ardb@kernel$(echo .)org \
    --cc=arnd@arndb$(echo .)de \
    --cc=bp@alien8$(echo .)de \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=deller@gmx$(echo .)de \
    --cc=hpa@zytor$(echo .)com \
    --cc=jgross@suse$(echo .)com \
    --cc=kees@kernel$(echo .)org \
    --cc=linusw@kernel$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=lukas.bulwahn@redhat$(echo .)com \
    --cc=mathieu.desnoyers@efficios$(echo .)com \
    --cc=maz@kernel$(echo .)org \
    --cc=mingo@redhat$(echo .)com \
    --cc=nathan@kernel$(echo .)org \
    --cc=nicolas.schier@linux$(echo .)dev \
    --cc=ojeda@kernel$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=ruanjinjie@huawei$(echo .)com \
    --cc=ryan.roberts@arm$(echo .)com \
    --cc=shenhan@google$(echo .)com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=vdonnefort@google$(echo .)com \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    --cc=yabinc@google$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox