* [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU
@ 2026-08-12 19:47 Tejun Heo
2026-08-12 23:33 ` Suren Baghdasaryan
2026-08-17 7:15 ` Gabriele Monaco
0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2026-08-12 19:47 UTC (permalink / raw)
To: Dennis Zhou
Cc: Christoph Lameter, Andrew Morton, Suren Baghdasaryan,
Kent Overstreet, Steven Rostedt, Gabriele Monaco, linux-mm,
linux-trace-kernel, linux-kernel
alpha requires percpu variables in modules to be defined as weak so that the
compiler generates GOT based external references for them. This puts two
extra restrictions on percpu variable definitions. The symbol must be
globally unique even when static and a static percpu variable can't be
defined inside a function. DEBUG_FORCE_WEAK_PER_CPU exists to give generic
code build coverage for these restrictions without building for alpha.
MEM_ALLOC_PROFILING defines a static percpu counter at each allocation call
site and thus can't be built with weak percpu definitions, so it depends on
!DEBUG_FORCE_WEAK_PER_CPU. As allmodconfig enables DEBUG_FORCE_WEAK_PER_CPU,
this knocks MEM_ALLOC_PROFILING out of allmodconfig build coverage.
allmodconfig coverage for MEM_ALLOC_PROFILING is worth more than build
coverage for restrictions which only matter to alpha module builds. Drop
DEBUG_FORCE_WEAK_PER_CPU. Restriction violations will now show up only on
alpha builds.
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
---
include/linux/percpu-defs.h | 7 +------
include/rv/da_monitor.h | 2 +-
lib/Kconfig.debug | 16 ----------------
3 files changed, 2 insertions(+), 23 deletions(-)
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -65,13 +65,8 @@
*
* Archs which need weak percpu definitions should set
* CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU when necessary.
- *
- * To ensure that the generic code observes the above two
- * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
- * definition is used for all cases.
*/
-#if (defined(CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU) && defined(MODULE)) || \
- defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU)
+#if defined(CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU) && defined(MODULE)
/*
* __pcpu_scope_* dummy variable is used to enforce scope. It
* receives the static modifier when it's used in front of
--- a/include/rv/da_monitor.h
+++ b/include/rv/da_monitor.h
@@ -24,7 +24,7 @@
/*
* Per-cpu variables require a unique name although static in some
- * configurations (e.g. CONFIG_DEBUG_FORCE_WEAK_PER_CPU or alpha modules).
+ * configurations (e.g. alpha modules).
*/
#define DA_MON_NAME CONCATENATE(da_mon_, MONITOR_NAME)
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -613,21 +613,6 @@ config BUILTIN_MODULE_RANGES
It also records an anchor symbol to determine the load address of the
section.
-config DEBUG_FORCE_WEAK_PER_CPU
- bool "Force weak per-cpu definitions"
- depends on DEBUG_KERNEL
- help
- s390 and alpha require percpu variables in modules to be
- defined weak to work around addressing range issue which
- puts the following two restrictions on percpu variable
- definitions.
-
- 1. percpu symbols must be unique whether static or not
- 2. percpu variables can't be defined inside a function
-
- To ensure that generic code follows the above rules, this
- option forces all percpu variables to be defined as weak.
-
config WARN_CONTEXT_ANALYSIS
bool "Compiler context-analysis warnings"
depends on CC_IS_CLANG && CLANG_VERSION >= 230000
@@ -1053,7 +1038,6 @@ config MEM_ALLOC_PROFILING
default n
depends on MMU
depends on PROC_FS
- depends on !DEBUG_FORCE_WEAK_PER_CPU
select CODE_TAGGING
select PAGE_EXTENSION
select SLAB_OBJ_EXT
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU
2026-08-12 19:47 [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU Tejun Heo
@ 2026-08-12 23:33 ` Suren Baghdasaryan
2026-08-17 7:15 ` Gabriele Monaco
1 sibling, 0 replies; 3+ messages in thread
From: Suren Baghdasaryan @ 2026-08-12 23:33 UTC (permalink / raw)
To: Tejun Heo
Cc: Dennis Zhou, Christoph Lameter, Andrew Morton, Kent Overstreet,
Steven Rostedt, Gabriele Monaco, linux-mm, linux-trace-kernel,
linux-kernel
On Wed, Aug 12, 2026 at 12:55 PM Tejun Heo <tj@kernel.org> wrote:
>
> alpha requires percpu variables in modules to be defined as weak so that the
> compiler generates GOT based external references for them. This puts two
> extra restrictions on percpu variable definitions. The symbol must be
> globally unique even when static and a static percpu variable can't be
> defined inside a function. DEBUG_FORCE_WEAK_PER_CPU exists to give generic
> code build coverage for these restrictions without building for alpha.
>
> MEM_ALLOC_PROFILING defines a static percpu counter at each allocation call
> site and thus can't be built with weak percpu definitions, so it depends on
> !DEBUG_FORCE_WEAK_PER_CPU. As allmodconfig enables DEBUG_FORCE_WEAK_PER_CPU,
> this knocks MEM_ALLOC_PROFILING out of allmodconfig build coverage.
>
> allmodconfig coverage for MEM_ALLOC_PROFILING is worth more than build
> coverage for restrictions which only matter to alpha module builds. Drop
> DEBUG_FORCE_WEAK_PER_CPU. Restriction violations will now show up only on
> alpha builds.
>
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Thanks Tejun and Andrew!
> ---
> include/linux/percpu-defs.h | 7 +------
> include/rv/da_monitor.h | 2 +-
> lib/Kconfig.debug | 16 ----------------
> 3 files changed, 2 insertions(+), 23 deletions(-)
>
> --- a/include/linux/percpu-defs.h
> +++ b/include/linux/percpu-defs.h
> @@ -65,13 +65,8 @@
> *
> * Archs which need weak percpu definitions should set
> * CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU when necessary.
> - *
> - * To ensure that the generic code observes the above two
> - * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
> - * definition is used for all cases.
> */
> -#if (defined(CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU) && defined(MODULE)) || \
> - defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU)
> +#if defined(CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU) && defined(MODULE)
> /*
> * __pcpu_scope_* dummy variable is used to enforce scope. It
> * receives the static modifier when it's used in front of
> --- a/include/rv/da_monitor.h
> +++ b/include/rv/da_monitor.h
> @@ -24,7 +24,7 @@
>
> /*
> * Per-cpu variables require a unique name although static in some
> - * configurations (e.g. CONFIG_DEBUG_FORCE_WEAK_PER_CPU or alpha modules).
> + * configurations (e.g. alpha modules).
> */
> #define DA_MON_NAME CONCATENATE(da_mon_, MONITOR_NAME)
>
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -613,21 +613,6 @@ config BUILTIN_MODULE_RANGES
> It also records an anchor symbol to determine the load address of the
> section.
>
> -config DEBUG_FORCE_WEAK_PER_CPU
> - bool "Force weak per-cpu definitions"
> - depends on DEBUG_KERNEL
> - help
> - s390 and alpha require percpu variables in modules to be
> - defined weak to work around addressing range issue which
> - puts the following two restrictions on percpu variable
> - definitions.
> -
> - 1. percpu symbols must be unique whether static or not
> - 2. percpu variables can't be defined inside a function
> -
> - To ensure that generic code follows the above rules, this
> - option forces all percpu variables to be defined as weak.
> -
> config WARN_CONTEXT_ANALYSIS
> bool "Compiler context-analysis warnings"
> depends on CC_IS_CLANG && CLANG_VERSION >= 230000
> @@ -1053,7 +1038,6 @@ config MEM_ALLOC_PROFILING
> default n
> depends on MMU
> depends on PROC_FS
> - depends on !DEBUG_FORCE_WEAK_PER_CPU
> select CODE_TAGGING
> select PAGE_EXTENSION
> select SLAB_OBJ_EXT
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU
2026-08-12 19:47 [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU Tejun Heo
2026-08-12 23:33 ` Suren Baghdasaryan
@ 2026-08-17 7:15 ` Gabriele Monaco
1 sibling, 0 replies; 3+ messages in thread
From: Gabriele Monaco @ 2026-08-17 7:15 UTC (permalink / raw)
To: Tejun Heo, Dennis Zhou
Cc: Christoph Lameter, Andrew Morton, Suren Baghdasaryan,
Kent Overstreet, Steven Rostedt, linux-mm, linux-trace-kernel,
linux-kernel
On Wed, 2026-08-12 at 09:47 -1000, Tejun Heo wrote:
> alpha requires percpu variables in modules to be defined as weak so that the
> compiler generates GOT based external references for them. This puts two
> extra restrictions on percpu variable definitions. The symbol must be
> globally unique even when static and a static percpu variable can't be
> defined inside a function. DEBUG_FORCE_WEAK_PER_CPU exists to give generic
> code build coverage for these restrictions without building for alpha.
>
> MEM_ALLOC_PROFILING defines a static percpu counter at each allocation call
> site and thus can't be built with weak percpu definitions, so it depends on
> !DEBUG_FORCE_WEAK_PER_CPU. As allmodconfig enables DEBUG_FORCE_WEAK_PER_CPU,
> this knocks MEM_ALLOC_PROFILING out of allmodconfig build coverage.
>
> allmodconfig coverage for MEM_ALLOC_PROFILING is worth more than build
> coverage for restrictions which only matter to alpha module builds. Drop
> DEBUG_FORCE_WEAK_PER_CPU. Restriction violations will now show up only on
> alpha builds.
>
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
> --- a/include/rv/da_monitor.h
> +++ b/include/rv/da_monitor.h
> @@ -24,7 +24,7 @@
>
> /*
> * Per-cpu variables require a unique name although static in some
> - * configurations (e.g. CONFIG_DEBUG_FORCE_WEAK_PER_CPU or alpha modules).
> + * configurations (e.g. alpha modules).
> */
> #define DA_MON_NAME CONCATENATE(da_mon_, MONITOR_NAME)
For the tiny change in the RV header:
Acked-by: Gabriele Monaco <gmonaco@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-17 7:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 19:47 [PATCH] percpu: Drop CONFIG_DEBUG_FORCE_WEAK_PER_CPU Tejun Heo
2026-08-12 23:33 ` Suren Baghdasaryan
2026-08-17 7:15 ` Gabriele Monaco
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox