Skip to contentSkip to conversation

AutoFDO: Remove the architecture specific config

PATCH In review Rong Xu 5 participants 10 messages Dec 11, 2024 – Feb 4, 2025 x86

lore
Share & tools
lore

Rong Xu

author
#0 lore raw

PATCH 1/2 AutoFDO: Remove the architecture specific config

The CONFIG_AUTOFDO_CLANG option currently depends on ARCH_SUPPORTS_AUTOFDO_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_AUTOFDO_CLANG and allow users to control AutoFDO builds solely through CONFIG_AUTOFDO_CLANG. This simplifies the kconfig and avoids potential confusion.

---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)
arch/Kconfig +0 -4
index 6682b2a53e342..0b36d74d47031 100644
@@ -812,12 +812,8 @@ config LTO_CLANG_THIN
 	  If unsure, say Y.
 endchoice
 
-config ARCH_SUPPORTS_AUTOFDO_CLANG
-	bool
-
 config AUTOFDO_CLANG
 	bool "Enable Clang's AutoFDO build (EXPERIMENTAL)"
-	depends on ARCH_SUPPORTS_AUTOFDO_CLANG
 	depends on CC_IS_CLANG && CLANG_VERSION >= 170000
 	help
 	  This option enables Clang’s AutoFDO build. When
arch/x86/Kconfig +0 -1
index 9d7bd0ae48c42..9363d9cc9a00a 100644
@@ -128,7 +128,6 @@ config X86
 	select ARCH_SUPPORTS_LTO_CLANG
 	select ARCH_SUPPORTS_LTO_CLANG_THIN
 	select ARCH_SUPPORTS_RT
-	select ARCH_SUPPORTS_AUTOFDO_CLANG
 	select ARCH_SUPPORTS_PROPELLER_CLANG    if X86_64
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF		if X86_CMPXCHG64

base-commit: f92f4749861b06fed908d336b4dee1326003291b

Signature · 1 line
2.47.0.338.g60cca15819-goog
author
#1 lore raw

PATCH 2/2 Propeller: Remove the architecture specific config

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.

---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)
arch/Kconfig +0 -4
index 0b36d74d47031..83731b858ba65 100644
@@ -828,12 +828,8 @@ 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
 	help
 	  This option enables Clang’s Propeller build. When the Propeller
arch/x86/Kconfig +0 -1
index 9363d9cc9a00a..6c633d93c6390 100644
@@ -128,7 +128,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_CMPXCHG64
 	select ARCH_USE_MEMTEST
Signature · 1 line
2.47.0.338.g60cca15819-goog
#2 lore raw

Re: [PATCH 2/2] Propeller: Remove the architecture specific config

Hi Rong,

Quoted 9 lines · Rong Xu

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.

In commit d5dc95836147 ("kbuild: Add Propeller configuration for kernel build"), you added .llvm_bb_addr_map to arch/x86/kernel/vmlinux.lds.S. Was this to address a orphan section warning from the linker? Is that same change needed in the linker scripts of the other architectures that clang supports building in the kernel?

Cheers,
Nathan

Quoted 37 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)
arch/Kconfig +0 -4
index 0b36d74d47031..83731b858ba65 100644
@@ -828,12 +828,8 @@ 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
 	help
 	  This option enables Clang’s Propeller build. When the Propeller
arch/x86/Kconfig +0 -1
index 9363d9cc9a00a..6c633d93c6390 100644
@@ -128,7 +128,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_CMPXCHG64
 	select ARCH_USE_MEMTEST
Signature · 1 line
2.47.0.338.g60cca15819-goog
author
#3 lore raw

Re: [PATCH 2/2] Propeller: Remove the architecture specific config

(o

Quoted 11 lines · Nathan Chancellor

Hi Rong,

Quoted 7 lines · Rong Xu

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.

Quoted 8 lines
Quoted 2 lines

In commit d5dc95836147 ("kbuild: Add Propeller configuration for kernel build"), you added .llvm_bb_addr_map to arch/x86/kernel/vmlinux.lds.S. Was this to address a orphan section warning from the linker? Is that same change needed in the linker scripts of the other architectures that clang supports building in the kernel?

The .llvm_bb_addr_map section is created when compiling with the -fbasic-block-address-map flag (or the older -fbasic-block-sections=labels option), with LLVM. We need the change in the linker script to group the sections together and emit in the final vmlinux.

This applies to all architectures, as LLVM can generate these sections for any architecture when the corresponding option is used.

The statement that AutoFDO and Propeller are only supported on certain platforms really refers to the availability of *native* profile generation:
the native profile generation is only available on these platforms.

Hope this helps,

-Rong

Quoted 40 lines

Cheers,
Nathan

Quoted 37 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)
arch/Kconfig +0 -4
index 0b36d74d47031..83731b858ba65 100644
@@ -828,12 +828,8 @@ 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
      help
        This option enables Clang’s Propeller build. When the Propeller
arch/x86/Kconfig +0 -2
index 9363d9cc9a00a..6c633d93c6390 100644
@@ -128,7 +128,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_CMPXCHG64
      select ARCH_USE_MEMTEST
--

2.47.0.338.g60cca15819-goog

Tested-by
#4 lore raw

Re: [PATCH 2/2] Propeller: Remove the architecture specific config

Quoted 80 lines · Rong Xu

(o

Quoted 11 lines · Nathan Chancellor

Hi Rong,

Quoted 7 lines · Rong Xu

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.

Quoted 8 lines
Quoted 2 lines

In commit d5dc95836147 ("kbuild: Add Propeller configuration for kernel build"), you added .llvm_bb_addr_map to arch/x86/kernel/vmlinux.lds.S. Was this to address a orphan section warning from the linker? Is that same change needed in the linker scripts of the other architectures that clang supports building in the kernel?

The .llvm_bb_addr_map section is created when compiling with the -fbasic-block-address-map flag (or the older -fbasic-block-sections=labels option), with LLVM. We need the change in the linker script to group the sections together and emit in the final vmlinux.

This applies to all architectures, as LLVM can generate these sections for any architecture when the corresponding option is used.

The statement that AutoFDO and Propeller are only supported on certain platforms really refers to the availability of *native* profile generation:
the native profile generation is only available on these platforms.

Hope this helps,

-Rong

Quoted 40 lines

Cheers,
Nathan

Quoted 37 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)
arch/Kconfig +0 -4
index 0b36d74d47031..83731b858ba65 100644
@@ -828,12 +828,8 @@ 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
      help
        This option enables Clang’s Propeller build. When the Propeller
arch/x86/Kconfig +0 -2
index 9363d9cc9a00a..6c633d93c6390 100644
@@ -128,7 +128,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_CMPXCHG64
      select ARCH_USE_MEMTEST
--

2.47.0.338.g60cca15819-goog

Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] Propeller: Remove the architecture specific config

In reply to Rong Xu
Quoted 8 lines · Rong Xu

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.

With Nathan's question answered, this looks good to me:

Signature · 1 line
Kees Cook
Acked-by on v1 1/2
#6 lore raw
In reply to Rong Xu
Quoted 7 lines · Rong Xu

The CONFIG_AUTOFDO_CLANG option currently depends on ARCH_SUPPORTS_AUTOFDO_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_AUTOFDO_CLANG and allow users to control AutoFDO builds solely through CONFIG_AUTOFDO_CLANG. This simplifies the kconfig and avoids potential confusion.

Quoted 6 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)

However, you've dropped the previous hunk you had to Documentation/dev-tools/autofdo.rst which had some text about using ETM to collect fdo data on arm64. It seems like that might still be useful to have?

Will

author
#7 lore raw

Thanks for the Acked-by.

Regarding the ETM documentation change, I haven't forgotten it. I think it's best for Yabin to submit another patch (or revision of his previous patch), as he has done all the ETM side work.

Best regards,

-Rong

Quoted 24 lines · Will Deacon
Quoted 7 lines · Rong Xu

The CONFIG_AUTOFDO_CLANG option currently depends on ARCH_SUPPORTS_AUTOFDO_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_AUTOFDO_CLANG and allow users to control AutoFDO builds solely through CONFIG_AUTOFDO_CLANG. This simplifies the kconfig and avoids potential confusion.

Quoted 6 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)

However, you've dropped the previous hunk you had to Documentation/dev-tools/autofdo.rst which had some text about using ETM to collect fdo data on arm64. It seems like that might still be useful to have?

Will

Tested-by
#8 lore raw

Hi Rong,

Thanks for the patch! Sorry for the delay in testing it. I will upload another patch to document steps for using ETM.

Thanks,
Yabin

Quoted 36 lines · Rong Xu

Thanks for the Acked-by.

Regarding the ETM documentation change, I haven't forgotten it. I think it's best for Yabin to submit another patch (or revision of his previous patch), as he has done all the ETM side work.

Best regards,

-Rong

Quoted 24 lines · Will Deacon
Quoted 7 lines · Rong Xu

The CONFIG_AUTOFDO_CLANG option currently depends on ARCH_SUPPORTS_AUTOFDO_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_AUTOFDO_CLANG and allow users to control AutoFDO builds solely through CONFIG_AUTOFDO_CLANG. This simplifies the kconfig and avoids potential confusion.

Quoted 6 lines
---
 arch/Kconfig     | 4 ----
 arch/x86/Kconfig | 1 -
 2 files changed, 5 deletions(-)

However, you've dropped the previous hunk you had to Documentation/dev-tools/autofdo.rst which had some text about using ETM to collect fdo data on arm64. It seems like that might still be useful to have?

Will

Reviewed-by on v1 1/2
#9 lore raw
In reply to Rong Xu
Quoted 8 lines · Rong Xu

The CONFIG_AUTOFDO_CLANG option currently depends on ARCH_SUPPORTS_AUTOFDO_CLANG, but this dependency seems unnecessary.

Remove ARCH_SUPPORTS_AUTOFDO_CLANG and allow users to control AutoFDO builds solely through CONFIG_AUTOFDO_CLANG. This simplifies the kconfig and avoids potential confusion.

Looks right to me!

Signature · 1 line
Kees Cook