linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems
@ 2025-03-06 11:29 Joel Granados
  2025-03-06 11:29 ` [PATCH v2 1/6] panic: Move panic ctl tables into panic.c Joel Granados
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

This series relocates sysctl tables from kern_table to their respective
subsystems. To keep the scope manageable, this patchset focuses on
architecture-specific and core kernel sysctl tables. Further relocations
will follow once this series progresses.

By decentralizing sysctl registrations, subsystem maintainers regain
control over their sysctl interfaces, improving maintainability and
reducing the likelihood of merge conflicts. All this is made possible by
the work done to reduce the ctl_table memory footprint in commit
d7a76ec87195 ("sysctl: Remove check for sentinel element in ctl_table
arrays").

* Birds eye view of what has changed:
    - Archs: sparc, s390 and x86
        arch/s390/{lib/spinlock.c,mm/fault.c}
        arch/sparc/kernel/{Makefile,setup.c}
        arch/x86/include/asm/{setup.h,traps.h}
    - Kernel core:
        kernel/{panic.c,signal.c,trace/trace.c}
        kernel/events/{core.c,callchain.c}

* Testing was done by running sysctl selftests on x86_64 and 0-day.

Comments are greatly appreciated

Changes in v2:
- Dropped the perf and x86 patches as they are making their way
  upstream. Removed relevant ppl from To: and Cc: mail header.
- "ftrace:..." -> "tracing:..." for patch 3
- Moved stac_tracer_enabled to trace_stack.c instead of trace.c
- s390: fixed typo and removed the CONFIG_SMP ifdefs
- Updated trailers
- Link to v1: https://lore.kernel.org/r/20250218-jag-mv_ctltables-v1-0-cd3698ab8d29@kernel.org

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
---
Joel Granados (5):
      panic: Move panic ctl tables into panic.c
      signal: Move signal ctl tables into signal.c
      tracing: Move trace sysctls into trace.c
      stack_tracer: move sysctl registration to kernel/trace/trace_stack.c
      sparc: mv sparc sysctls into their own file under arch/sparc/kernel

joel granados (1):
      s390: mv s390 sysctls into their own file under arch/s390 dir

 arch/s390/lib/spinlock.c   |  18 +++++++
 arch/s390/mm/fault.c       |  17 ++++++
 arch/sparc/kernel/Makefile |   1 +
 arch/sparc/kernel/setup.c  |  46 +++++++++++++++++
 include/linux/ftrace.h     |   7 ---
 kernel/panic.c             |  30 +++++++++++
 kernel/signal.c            |  11 ++++
 kernel/sysctl.c            | 126 ---------------------------------------------
 kernel/trace/trace.c       |  36 ++++++++++++-
 kernel/trace/trace_stack.c |  20 +++++++
 10 files changed, 178 insertions(+), 134 deletions(-)
---
base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
change-id: 20250217-jag-mv_ctltables-cf75e470e085

Best regards,
-- 
Joel Granados <joel.granados@kernel.org>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/6] panic: Move panic ctl tables into panic.c
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
@ 2025-03-06 11:29 ` Joel Granados
  2025-03-06 11:29 ` [PATCH v2 2/6] signal: Move signal ctl tables into signal.c Joel Granados
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move panic, panic_on_oops, panic_print, panic_on_warn into
kerne/panic.c. This is part of a greater effort to move ctl tables into
their respective subsystems which will reduce the merge conflicts in
kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 kernel/panic.c  | 30 ++++++++++++++++++++++++++++++
 kernel/sysctl.c | 31 -------------------------------
 2 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index d8635d5cecb2505da1c08a4f70814e9b87ac3b37..f9bf88f4c26216cd5a93754378a36ea1e841472a 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -96,6 +96,36 @@ static const struct ctl_table kern_panic_table[] = {
 		.extra2         = SYSCTL_ONE,
 	},
 #endif
+	{
+		.procname	= "panic",
+		.data		= &panic_timeout,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+	{
+		.procname	= "panic_on_oops",
+		.data		= &panic_on_oops,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+	{
+		.procname	= "panic_print",
+		.data		= &panic_print,
+		.maxlen		= sizeof(unsigned long),
+		.mode		= 0644,
+		.proc_handler	= proc_doulongvec_minmax,
+	},
+	{
+		.procname	= "panic_on_warn",
+		.data		= &panic_on_warn,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_ONE,
+	},
 	{
 		.procname       = "warn_limit",
 		.data           = &warn_limit,
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cb57da499ebb1216cefb3705694ab62028fee03e..7759b1ed7221f588f49ec3d81b19aeb4d2fdf2f7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -26,7 +26,6 @@
 #include <linux/sysctl.h>
 #include <linux/bitmap.h>
 #include <linux/signal.h>
-#include <linux/panic.h>
 #include <linux/printk.h>
 #include <linux/proc_fs.h>
 #include <linux/security.h>
@@ -1610,13 +1609,6 @@ int proc_do_static_key(const struct ctl_table *table, int write,
 }
 
 static const struct ctl_table kern_table[] = {
-	{
-		.procname	= "panic",
-		.data		= &panic_timeout,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
 #ifdef CONFIG_PROC_SYSCTL
 	{
 		.procname	= "tainted",
@@ -1803,20 +1795,6 @@ static const struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-	{
-		.procname	= "panic_on_oops",
-		.data		= &panic_on_oops,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.procname	= "panic_print",
-		.data		= &panic_print,
-		.maxlen		= sizeof(unsigned long),
-		.mode		= 0644,
-		.proc_handler	= proc_doulongvec_minmax,
-	},
 	{
 		.procname	= "ngroups_max",
 		.data		= (void *)&ngroups_max,
@@ -1990,15 +1968,6 @@ static const struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE_THOUSAND,
 	},
 #endif
-	{
-		.procname	= "panic_on_warn",
-		.data		= &panic_on_warn,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec_minmax,
-		.extra1		= SYSCTL_ZERO,
-		.extra2		= SYSCTL_ONE,
-	},
 #ifdef CONFIG_TREE_RCU
 	{
 		.procname	= "panic_on_rcu_stall",

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/6] signal: Move signal ctl tables into signal.c
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
  2025-03-06 11:29 ` [PATCH v2 1/6] panic: Move panic ctl tables into panic.c Joel Granados
@ 2025-03-06 11:29 ` Joel Granados
  2025-03-06 11:29 ` [PATCH v2 3/6] tracing: Move trace sysctls into trace.c Joel Granados
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move print-fatal-signals into its own const ctl table array in
kernel/signal.c. This is part of a greater effort to move ctl tables
into their respective subsystems which will reduce the merge conflicts
in kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 kernel/signal.c | 11 +++++++++++
 kernel/sysctl.c |  8 --------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 875e97f6205a2c9daecf5bece5d53ed09667f747..347b74800f927f70a1912457f96e833cd03c642d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -4962,9 +4962,20 @@ static const struct ctl_table signal_debug_table[] = {
 #endif
 };
 
+static const struct ctl_table signal_table[] = {
+	{
+		.procname	= "print-fatal-signals",
+		.data		= &print_fatal_signals,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+};
+
 static int __init init_signal_sysctls(void)
 {
 	register_sysctl_init("debug", signal_debug_table);
+	register_sysctl_init("kernel", signal_table);
 	return 0;
 }
 early_initcall(init_signal_sysctls);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7759b1ed7221f588f49ec3d81b19aeb4d2fdf2f7..6514c13800a453dd970ce60040ca8a791f831e17 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -25,7 +25,6 @@
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/bitmap.h>
-#include <linux/signal.h>
 #include <linux/printk.h>
 #include <linux/proc_fs.h>
 #include <linux/security.h>
@@ -1626,13 +1625,6 @@ static const struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif
-	{
-		.procname	= "print-fatal-signals",
-		.data		= &print_fatal_signals,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
 #ifdef CONFIG_SPARC
 	{
 		.procname	= "reboot-cmd",

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/6] tracing: Move trace sysctls into trace.c
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
  2025-03-06 11:29 ` [PATCH v2 1/6] panic: Move panic ctl tables into panic.c Joel Granados
  2025-03-06 11:29 ` [PATCH v2 2/6] signal: Move signal ctl tables into signal.c Joel Granados
@ 2025-03-06 11:29 ` Joel Granados
  2025-03-06 11:29 ` [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c Joel Granados
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move trace ctl tables into their own const array in
kernel/trace/trace.c. The sysctl table register is called with
subsys_initcall placing if after its original place in proc_root_init.
This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 include/linux/ftrace.h |  7 -------
 kernel/sysctl.c        | 24 ------------------------
 kernel/trace/trace.c   | 36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index fbabc3d848b375a114936b635bc695d59ab018a6..59774513ae456a5cc7c3bfe7f93a2189c0e3706e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1298,16 +1298,9 @@ static inline void unpause_graph_tracing(void) { }
 #ifdef CONFIG_TRACING
 enum ftrace_dump_mode;
 
-#define MAX_TRACER_SIZE		100
-extern char ftrace_dump_on_oops[];
 extern int ftrace_dump_on_oops_enabled(void);
-extern int tracepoint_printk;
 
 extern void disable_trace_on_warning(void);
-extern int __disable_trace_on_warning;
-
-int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
-			     void *buffer, size_t *lenp, loff_t *ppos);
 
 #else /* CONFIG_TRACING */
 static inline void  disable_trace_on_warning(void) { }
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6514c13800a453dd970ce60040ca8a791f831e17..baa250e223a26bafc39cb7a7d7635b4f7f5dcf56 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -51,7 +51,6 @@
 #include <linux/nfs_fs.h>
 #include <linux/acpi.h>
 #include <linux/reboot.h>
-#include <linux/ftrace.h>
 #include <linux/perf_event.h>
 #include <linux/oom.h>
 #include <linux/kmod.h>
@@ -1684,29 +1683,6 @@ static const struct ctl_table kern_table[] = {
 		.proc_handler	= stack_trace_sysctl,
 	},
 #endif
-#ifdef CONFIG_TRACING
-	{
-		.procname	= "ftrace_dump_on_oops",
-		.data		= &ftrace_dump_on_oops,
-		.maxlen		= MAX_TRACER_SIZE,
-		.mode		= 0644,
-		.proc_handler	= proc_dostring,
-	},
-	{
-		.procname	= "traceoff_on_warning",
-		.data		= &__disable_trace_on_warning,
-		.maxlen		= sizeof(__disable_trace_on_warning),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.procname	= "tracepoint_printk",
-		.data		= &tracepoint_printk,
-		.maxlen		= sizeof(tracepoint_printk),
-		.mode		= 0644,
-		.proc_handler	= tracepoint_printk_sysctl,
-	},
-#endif
 #ifdef CONFIG_MODULES
 	{
 		.procname	= "modprobe",
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0e6d517e74e0fd19bfb31fcbcb977d57f894c78b..abfc0e56173b9da98236f83c715b155e5e952295 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -117,6 +117,7 @@ static int tracing_disabled = 1;
 
 cpumask_var_t __read_mostly	tracing_buffer_mask;
 
+#define MAX_TRACER_SIZE		100
 /*
  * ftrace_dump_on_oops - variable to dump ftrace buffer on oops
  *
@@ -139,7 +140,40 @@ cpumask_var_t __read_mostly	tracing_buffer_mask;
 char ftrace_dump_on_oops[MAX_TRACER_SIZE] = "0";
 
 /* When set, tracing will stop when a WARN*() is hit */
-int __disable_trace_on_warning;
+static int __disable_trace_on_warning;
+
+int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
+			     void *buffer, size_t *lenp, loff_t *ppos);
+static const struct ctl_table trace_sysctl_table[] = {
+	{
+		.procname	= "ftrace_dump_on_oops",
+		.data		= &ftrace_dump_on_oops,
+		.maxlen		= MAX_TRACER_SIZE,
+		.mode		= 0644,
+		.proc_handler	= proc_dostring,
+	},
+	{
+		.procname	= "traceoff_on_warning",
+		.data		= &__disable_trace_on_warning,
+		.maxlen		= sizeof(__disable_trace_on_warning),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+	{
+		.procname	= "tracepoint_printk",
+		.data		= &tracepoint_printk,
+		.maxlen		= sizeof(tracepoint_printk),
+		.mode		= 0644,
+		.proc_handler	= tracepoint_printk_sysctl,
+	},
+};
+
+static int __init init_trace_sysctls(void)
+{
+	register_sysctl_init("kernel", trace_sysctl_table);
+	return 0;
+}
+subsys_initcall(init_trace_sysctls);
 
 #ifdef CONFIG_TRACE_EVAL_MAP_FILE
 /* Map of enums to their values, for "eval_map" file */

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
                   ` (2 preceding siblings ...)
  2025-03-06 11:29 ` [PATCH v2 3/6] tracing: Move trace sysctls into trace.c Joel Granados
@ 2025-03-06 11:29 ` Joel Granados
  2025-03-06 15:31   ` Steven Rostedt
  2025-03-06 11:29 ` [PATCH v2 5/6] sparc: mv sparc sysctls into their own file under arch/sparc/kernel Joel Granados
  2025-03-06 11:29 ` [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir joel granados
  5 siblings, 1 reply; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move stack_tracer_enabled into trace_stack_sysctl_table. This is part of
a greater effort to move ctl tables into their respective subsystems
which will reduce the merge conflicts in kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 kernel/sysctl.c            | 10 ----------
 kernel/trace/trace_stack.c | 20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index baa250e223a26bafc39cb7a7d7635b4f7f5dcf56..dc3747cc72d470662879e4f2b7f2651505b7ca90 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -68,7 +68,6 @@
 
 #ifdef CONFIG_X86
 #include <asm/nmi.h>
-#include <asm/stacktrace.h>
 #include <asm/io.h>
 #endif
 #ifdef CONFIG_SPARC
@@ -1674,15 +1673,6 @@ static const struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-#ifdef CONFIG_STACK_TRACER
-	{
-		.procname	= "stack_tracer_enabled",
-		.data		= &stack_tracer_enabled,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= stack_trace_sysctl,
-	},
-#endif
 #ifdef CONFIG_MODULES
 	{
 		.procname	= "modprobe",
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 14c6f272c4d8a382070d45e1cf0ee97db38831c9..b7ffbc1da8357f9c252cb8936c8f789daa97eb9a 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -578,3 +578,23 @@ static __init int stack_trace_init(void)
 }
 
 device_initcall(stack_trace_init);
+
+
+static const struct ctl_table trace_stack_sysctl_table[] = {
+	{
+		.procname	= "stack_tracer_enabled",
+		.data		= &stack_tracer_enabled,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= stack_trace_sysctl,
+	},
+};
+
+static int __init init_trace_stack_sysctls(void)
+{
+	register_sysctl_init("kernel", trace_stack_sysctl_table);
+	return 0;
+}
+subsys_initcall(init_trace_stack_sysctls);
+
+

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/6] sparc: mv sparc sysctls into their own file under arch/sparc/kernel
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
                   ` (3 preceding siblings ...)
  2025-03-06 11:29 ` [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c Joel Granados
@ 2025-03-06 11:29 ` Joel Granados
  2025-03-06 11:29 ` [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir joel granados
  5 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move sparc sysctls (reboot-cmd, stop-a, scons-poweroff and tsb-ratio)
into a new file (arch/sparc/kernel/setup.c). This file will be included
for both 32 and 64 bit sparc. Leave "tsb-ratio" under SPARC64 ifdef as
it was in kernel/sysctl.c. The sysctl table register is called with
arch_initcall placing it after its original place in proc_root_init.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 arch/sparc/kernel/Makefile |  1 +
 arch/sparc/kernel/setup.c  | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 kernel/sysctl.c            | 35 -----------------------------------
 3 files changed, 47 insertions(+), 35 deletions(-)

diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 58ea4ef9b622bd18f2160b34762c69b48f3de8c6..3453f330e363cffe430806cd00a32b06202088b3 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -35,6 +35,7 @@ obj-y                   += process.o
 obj-y                   += signal_$(BITS).o
 obj-y                   += sigutil_$(BITS).o
 obj-$(CONFIG_SPARC32)   += ioport.o
+obj-y                   += setup.o
 obj-y                   += setup_$(BITS).o
 obj-y                   += idprom.o
 obj-y                   += sys_sparc_$(BITS).o
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
new file mode 100644
index 0000000000000000000000000000000000000000..4975867d9001b63b25770334116f2038a561c28c
--- /dev/null
+++ b/arch/sparc/kernel/setup.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <asm/setup.h>
+#include <linux/sysctl.h>
+
+static const struct ctl_table sparc_sysctl_table[] = {
+	{
+		.procname	= "reboot-cmd",
+		.data		= reboot_command,
+		.maxlen		= 256,
+		.mode		= 0644,
+		.proc_handler	= proc_dostring,
+	},
+	{
+		.procname	= "stop-a",
+		.data		= &stop_a_enabled,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+	{
+		.procname	= "scons-poweroff",
+		.data		= &scons_pwroff,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+#ifdef CONFIG_SPARC64
+	{
+		.procname	= "tsb-ratio",
+		.data		= &sysctl_tsb_ratio,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+#endif
+};
+
+
+static int __init init_sparc_sysctls(void)
+{
+	register_sysctl_init("kernel", sparc_sysctl_table);
+	return 0;
+}
+
+arch_initcall(init_sparc_sysctls);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index dc3747cc72d470662879e4f2b7f2651505b7ca90..0dc41eea1dbd34396c323118cfd0e3133c6993a1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -70,9 +70,6 @@
 #include <asm/nmi.h>
 #include <asm/io.h>
 #endif
-#ifdef CONFIG_SPARC
-#include <asm/setup.h>
-#endif
 #ifdef CONFIG_RT_MUTEXES
 #include <linux/rtmutex.h>
 #endif
@@ -1623,38 +1620,6 @@ static const struct ctl_table kern_table[] = {
 		.extra2		= SYSCTL_ONE,
 	},
 #endif
-#ifdef CONFIG_SPARC
-	{
-		.procname	= "reboot-cmd",
-		.data		= reboot_command,
-		.maxlen		= 256,
-		.mode		= 0644,
-		.proc_handler	= proc_dostring,
-	},
-	{
-		.procname	= "stop-a",
-		.data		= &stop_a_enabled,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-	{
-		.procname	= "scons-poweroff",
-		.data		= &scons_pwroff,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
-#ifdef CONFIG_SPARC64
-	{
-		.procname	= "tsb-ratio",
-		.data		= &sysctl_tsb_ratio,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 #ifdef CONFIG_PARISC
 	{
 		.procname	= "soft-power",

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir
  2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
                   ` (4 preceding siblings ...)
  2025-03-06 11:29 ` [PATCH v2 5/6] sparc: mv sparc sysctls into their own file under arch/sparc/kernel Joel Granados
@ 2025-03-06 11:29 ` joel granados
  2025-03-07 15:26   ` Heiko Carstens
  5 siblings, 1 reply; 13+ messages in thread
From: joel granados @ 2025-03-06 11:29 UTC (permalink / raw)
  To: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Gerald Schaefer
  Cc: linux-kernel, linux-fsdevel, linux-trace-kernel, sparclinux,
	linux-s390, Joel Granados

Move s390 sysctls (spin_retry and userprocess_debug) into their own
files under arch/s390. We create two new sysctl tables
(2390_{fault,spin}_sysctl_table) which will be initialized with
arch_initcall placing them after their original place in proc_root_init.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.

Signed-off-by: joel granados <joel.granados@kernel.org>
---
 arch/s390/lib/spinlock.c | 18 ++++++++++++++++++
 arch/s390/mm/fault.c     | 17 +++++++++++++++++
 kernel/sysctl.c          | 18 ------------------
 3 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index a81a01c449272ebad77cb031992078ac8e255eb8..6870b9e03456c34a1dc5c0c706f8e8bf1c4140e8 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -16,6 +16,7 @@
 #include <linux/io.h>
 #include <asm/alternative.h>
 #include <asm/asm.h>
+#include <linux/sysctl.h>
 
 int spin_retry = -1;
 
@@ -37,6 +38,23 @@ static int __init spin_retry_setup(char *str)
 }
 __setup("spin_retry=", spin_retry_setup);
 
+static const struct ctl_table s390_spin_sysctl_table[] = {
+	{
+		.procname	= "spin_retry",
+		.data		= &spin_retry,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+};
+
+static int __init init_s390_spin_sysctls(void)
+{
+	register_sysctl_init("kernel", s390_spin_sysctl_table);
+	return 0;
+}
+arch_initcall(init_s390_spin_sysctls);
+
 struct spin_wait {
 	struct spin_wait *next, *prev;
 	int node_id;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 9b681f74dccc1f525bafe150acf91e666a60d2bd..507da355bf68271c30115a797368f950707a2d8e 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -175,6 +175,23 @@ static void dump_fault_info(struct pt_regs *regs)
 
 int show_unhandled_signals = 1;
 
+static const struct ctl_table s390_fault_sysctl_table[] = {
+	{
+		.procname	= "userprocess_debug",
+		.data		= &show_unhandled_signals,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+};
+
+static int __init init_s390_fault_sysctls(void)
+{
+	register_sysctl_init("kernel", s390_fault_sysctl_table);
+	return 0;
+}
+arch_initcall(init_s390_fault_sysctls);
+
 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault)
 {
 	static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0dc41eea1dbd34396c323118cfd0e3133c6993a1..34c525ad0e0e0fe3b64c2ec730e443a75b55f3a3 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1709,15 +1709,6 @@ static const struct ctl_table kern_table[] = {
 		.extra1		= SYSCTL_ZERO,
 		.extra2		= SYSCTL_MAXOLDUID,
 	},
-#ifdef CONFIG_S390
-	{
-		.procname	= "userprocess_debug",
-		.data		= &show_unhandled_signals,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 	{
 		.procname	= "ngroups_max",
 		.data		= (void *)&ngroups_max,
@@ -1798,15 +1789,6 @@ static const struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
-#if defined(CONFIG_S390) && defined(CONFIG_SMP)
-	{
-		.procname	= "spin_retry",
-		.data		= &spin_retry,
-		.maxlen		= sizeof (int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
-#endif
 #if	defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
 	{
 		.procname	= "acpi_video_flags",

-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c
  2025-03-06 11:29 ` [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c Joel Granados
@ 2025-03-06 15:31   ` Steven Rostedt
  2025-03-13 16:19     ` Joel Granados
  0 siblings, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2025-03-06 15:31 UTC (permalink / raw)
  To: Joel Granados
  Cc: Kees Cook, Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers,
	David S. Miller, Andreas Larsson, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Gerald Schaefer, linux-kernel, linux-fsdevel, linux-trace-kernel,
	sparclinux, linux-s390

On Thu, 06 Mar 2025 12:29:44 +0100
Joel Granados <joel.granados@kernel.org> wrote:

> Move stack_tracer_enabled into trace_stack_sysctl_table. This is part of
> a greater effort to move ctl tables into their respective subsystems
> which will reduce the merge conflicts in kerenel/sysctl.c.
> 
> Signed-off-by: Joel Granados <joel.granados@kernel.org>
> ---
>  kernel/sysctl.c            | 10 ----------
>  kernel/trace/trace_stack.c | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index baa250e223a26bafc39cb7a7d7635b4f7f5dcf56..dc3747cc72d470662879e4f2b7f2651505b7ca90 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -68,7 +68,6 @@
>  
>  #ifdef CONFIG_X86
>  #include <asm/nmi.h>
> -#include <asm/stacktrace.h>
>  #include <asm/io.h>
>  #endif
>  #ifdef CONFIG_SPARC
> @@ -1674,15 +1673,6 @@ static const struct ctl_table kern_table[] = {
>  		.proc_handler	= proc_dointvec,
>  	},
>  #endif
> -#ifdef CONFIG_STACK_TRACER
> -	{
> -		.procname	= "stack_tracer_enabled",
> -		.data		= &stack_tracer_enabled,
> -		.maxlen		= sizeof(int),
> -		.mode		= 0644,
> -		.proc_handler	= stack_trace_sysctl,
> -	},
> -#endif
>  #ifdef CONFIG_MODULES
>  	{
>  		.procname	= "modprobe",
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index 14c6f272c4d8a382070d45e1cf0ee97db38831c9..b7ffbc1da8357f9c252cb8936c8f789daa97eb9a 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -578,3 +578,23 @@ static __init int stack_trace_init(void)
>  }
>  
>  device_initcall(stack_trace_init);
> +
> +
> +static const struct ctl_table trace_stack_sysctl_table[] = {
> +	{
> +		.procname	= "stack_tracer_enabled",
> +		.data		= &stack_tracer_enabled,
> +		.maxlen		= sizeof(int),
> +		.mode		= 0644,
> +		.proc_handler	= stack_trace_sysctl,
> +	},
> +};
> +
> +static int __init init_trace_stack_sysctls(void)
> +{
> +	register_sysctl_init("kernel", trace_stack_sysctl_table);
> +	return 0;
> +}
> +subsys_initcall(init_trace_stack_sysctls);
> +
> +
> 

This should also make the variable "stack_tracer_enabled" static and
removed from the ftrace.h header.

-- Steve


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir
  2025-03-06 11:29 ` [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir joel granados
@ 2025-03-07 15:26   ` Heiko Carstens
  2025-03-10 13:41     ` Joel Granados
  0 siblings, 1 reply; 13+ messages in thread
From: Heiko Carstens @ 2025-03-07 15:26 UTC (permalink / raw)
  To: joel granados
  Cc: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, Gerald Schaefer, linux-kernel, linux-fsdevel,
	linux-trace-kernel, sparclinux, linux-s390

On Thu, Mar 06, 2025 at 12:29:46PM +0100, joel granados wrote:
> Move s390 sysctls (spin_retry and userprocess_debug) into their own
> files under arch/s390. We create two new sysctl tables
> (2390_{fault,spin}_sysctl_table) which will be initialized with
> arch_initcall placing them after their original place in proc_root_init.
> 
> This is part of a greater effort to move ctl tables into their
> respective subsystems which will reduce the merge conflicts in
> kernel/sysctl.c.
> 
> Signed-off-by: joel granados <joel.granados@kernel.org>
> ---
>  arch/s390/lib/spinlock.c | 18 ++++++++++++++++++
>  arch/s390/mm/fault.c     | 17 +++++++++++++++++
>  kernel/sysctl.c          | 18 ------------------
>  3 files changed, 35 insertions(+), 18 deletions(-)

Acked-by: Heiko Carstens <hca@linux.ibm.com>

How should this go upstream? Will you take care of this, or should
this go via the s390 tree?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir
  2025-03-07 15:26   ` Heiko Carstens
@ 2025-03-10 13:41     ` Joel Granados
  2025-03-11 11:02       ` Vasily Gorbik
  0 siblings, 1 reply; 13+ messages in thread
From: Joel Granados @ 2025-03-10 13:41 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Kees Cook, Steven Rostedt, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, Gerald Schaefer, linux-kernel, linux-fsdevel,
	linux-trace-kernel, sparclinux, linux-s390

On Fri, Mar 07, 2025 at 04:26:20PM +0100, Heiko Carstens wrote:
> On Thu, Mar 06, 2025 at 12:29:46PM +0100, joel granados wrote:
> > Move s390 sysctls (spin_retry and userprocess_debug) into their own
> > files under arch/s390. We create two new sysctl tables
> > (2390_{fault,spin}_sysctl_table) which will be initialized with
> > arch_initcall placing them after their original place in proc_root_init.
> > 
> > This is part of a greater effort to move ctl tables into their
> > respective subsystems which will reduce the merge conflicts in
> > kernel/sysctl.c.
> > 
> > Signed-off-by: joel granados <joel.granados@kernel.org>
> > ---
> >  arch/s390/lib/spinlock.c | 18 ++++++++++++++++++
> >  arch/s390/mm/fault.c     | 17 +++++++++++++++++
> >  kernel/sysctl.c          | 18 ------------------
> >  3 files changed, 35 insertions(+), 18 deletions(-)
> 
> Acked-by: Heiko Carstens <hca@linux.ibm.com>
> 
> How should this go upstream? Will you take care of this, or should
> this go via the s390 tree?

thx for the review

It would be great if you can push it through the s390 tree. However, if
it is not possible to do so, please let me know and I'll add it to the
sysctl-next changes.

Best

-- 

Joel Granados

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir
  2025-03-10 13:41     ` Joel Granados
@ 2025-03-11 11:02       ` Vasily Gorbik
  2025-03-13 16:02         ` Joel Granados
  0 siblings, 1 reply; 13+ messages in thread
From: Vasily Gorbik @ 2025-03-11 11:02 UTC (permalink / raw)
  To: Joel Granados
  Cc: Heiko Carstens, Kees Cook, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Gerald Schaefer, linux-kernel, linux-fsdevel, linux-trace-kernel,
	sparclinux, linux-s390

On Mon, Mar 10, 2025 at 02:41:59PM +0100, Joel Granados wrote:
> On Fri, Mar 07, 2025 at 04:26:20PM +0100, Heiko Carstens wrote:
> > On Thu, Mar 06, 2025 at 12:29:46PM +0100, joel granados wrote:
> > > Move s390 sysctls (spin_retry and userprocess_debug) into their own
> > > files under arch/s390. We create two new sysctl tables
> > > (2390_{fault,spin}_sysctl_table) which will be initialized with
> > > arch_initcall placing them after their original place in proc_root_init.
> > > 
> > > This is part of a greater effort to move ctl tables into their
> > > respective subsystems which will reduce the merge conflicts in
> > > kernel/sysctl.c.
> > > 
> > > Signed-off-by: joel granados <joel.granados@kernel.org>
> > > ---
> > >  arch/s390/lib/spinlock.c | 18 ++++++++++++++++++
> > >  arch/s390/mm/fault.c     | 17 +++++++++++++++++
> > >  kernel/sysctl.c          | 18 ------------------
> > >  3 files changed, 35 insertions(+), 18 deletions(-)
> > 
> > Acked-by: Heiko Carstens <hca@linux.ibm.com>
> > 
> > How should this go upstream? Will you take care of this, or should
> > this go via the s390 tree?
> 
> thx for the review
> 
> It would be great if you can push it through the s390 tree. However, if
> it is not possible to do so, please let me know and I'll add it to the
> sysctl-next changes.

I've slightly changed the commit message
s390: Move s390 sysctls into their own file under arch/s390

And applied, thank you!

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir
  2025-03-11 11:02       ` Vasily Gorbik
@ 2025-03-13 16:02         ` Joel Granados
  0 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-13 16:02 UTC (permalink / raw)
  To: Vasily Gorbik
  Cc: Heiko Carstens, Kees Cook, Steven Rostedt, Masami Hiramatsu,
	Mark Rutland, Mathieu Desnoyers, David S. Miller, Andreas Larsson,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Gerald Schaefer, linux-kernel, linux-fsdevel, linux-trace-kernel,
	sparclinux, linux-s390

On Tue, Mar 11, 2025 at 12:02:47PM +0100, Vasily Gorbik wrote:
> On Mon, Mar 10, 2025 at 02:41:59PM +0100, Joel Granados wrote:
> > On Fri, Mar 07, 2025 at 04:26:20PM +0100, Heiko Carstens wrote:
> > > On Thu, Mar 06, 2025 at 12:29:46PM +0100, joel granados wrote:
> > > > Move s390 sysctls (spin_retry and userprocess_debug) into their own
> > > > files under arch/s390. We create two new sysctl tables
> > > > (2390_{fault,spin}_sysctl_table) which will be initialized with
> > > > arch_initcall placing them after their original place in proc_root_init.
> > > > 
> > > > This is part of a greater effort to move ctl tables into their
> > > > respective subsystems which will reduce the merge conflicts in
> > > > kernel/sysctl.c.
> > > > 
> > > > Signed-off-by: joel granados <joel.granados@kernel.org>
> > > > ---
> > > >  arch/s390/lib/spinlock.c | 18 ++++++++++++++++++
> > > >  arch/s390/mm/fault.c     | 17 +++++++++++++++++
> > > >  kernel/sysctl.c          | 18 ------------------
> > > >  3 files changed, 35 insertions(+), 18 deletions(-)
> > > 
> > > Acked-by: Heiko Carstens <hca@linux.ibm.com>
> > > 
> > > How should this go upstream? Will you take care of this, or should
> > > this go via the s390 tree?
> > 
> > thx for the review
> > 
> > It would be great if you can push it through the s390 tree. However, if
> > it is not possible to do so, please let me know and I'll add it to the
> > sysctl-next changes.
> 
> I've slightly changed the commit message
> s390: Move s390 sysctls into their own file under arch/s390
> 
> And applied, thank you!
ok. I'll remove it from my future versions.
Thx

-- 

Joel Granados

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c
  2025-03-06 15:31   ` Steven Rostedt
@ 2025-03-13 16:19     ` Joel Granados
  0 siblings, 0 replies; 13+ messages in thread
From: Joel Granados @ 2025-03-13 16:19 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Kees Cook, Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers,
	David S. Miller, Andreas Larsson, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Gerald Schaefer, linux-kernel, linux-fsdevel, linux-trace-kernel,
	sparclinux, linux-s390

On Thu, Mar 06, 2025 at 10:31:38AM -0500, Steven Rostedt wrote:
> On Thu, 06 Mar 2025 12:29:44 +0100
> Joel Granados <joel.granados@kernel.org> wrote:
> 
> > Move stack_tracer_enabled into trace_stack_sysctl_table. This is part of
> > a greater effort to move ctl tables into their respective subsystems
> > which will reduce the merge conflicts in kerenel/sysctl.c.
> > 
> > Signed-off-by: Joel Granados <joel.granados@kernel.org>
> > ---
> >  kernel/sysctl.c            | 10 ----------
> >  kernel/trace/trace_stack.c | 20 ++++++++++++++++++++
> >  2 files changed, 20 insertions(+), 10 deletions(-)
> > 
> > diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> > index baa250e223a26bafc39cb7a7d7635b4f7f5dcf56..dc3747cc72d470662879e4f2b7f2651505b7ca90 100644
> > --- a/kernel/sysctl.c
> > +++ b/kernel/sysctl.c
> > @@ -68,7 +68,6 @@
> >  
> >  #ifdef CONFIG_X86
> >  #include <asm/nmi.h>
> > -#include <asm/stacktrace.h>
> >  #include <asm/io.h>
> >  #endif
> >  #ifdef CONFIG_SPARC
> > @@ -1674,15 +1673,6 @@ static const struct ctl_table kern_table[] = {
> >  		.proc_handler	= proc_dointvec,
> >  	},
> >  #endif
> > -#ifdef CONFIG_STACK_TRACER
> > -	{
> > -		.procname	= "stack_tracer_enabled",
> > -		.data		= &stack_tracer_enabled,
> > -		.maxlen		= sizeof(int),
> > -		.mode		= 0644,
> > -		.proc_handler	= stack_trace_sysctl,
> > -	},
> > -#endif
> >  #ifdef CONFIG_MODULES
> >  	{
> >  		.procname	= "modprobe",
> > diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> > index 14c6f272c4d8a382070d45e1cf0ee97db38831c9..b7ffbc1da8357f9c252cb8936c8f789daa97eb9a 100644
> > --- a/kernel/trace/trace_stack.c
> > +++ b/kernel/trace/trace_stack.c
> > @@ -578,3 +578,23 @@ static __init int stack_trace_init(void)
> >  }
> >  
> >  device_initcall(stack_trace_init);
> > +
> > +
> > +static const struct ctl_table trace_stack_sysctl_table[] = {
> > +	{
> > +		.procname	= "stack_tracer_enabled",
> > +		.data		= &stack_tracer_enabled,
> > +		.maxlen		= sizeof(int),
> > +		.mode		= 0644,
> > +		.proc_handler	= stack_trace_sysctl,
> > +	},
> > +};
> > +
> > +static int __init init_trace_stack_sysctls(void)
> > +{
> > +	register_sysctl_init("kernel", trace_stack_sysctl_table);
> > +	return 0;
> > +}
> > +subsys_initcall(init_trace_stack_sysctls);
> > +
> > +
> > 
> 
> This should also make the variable "stack_tracer_enabled" static and
> removed from the ftrace.h header.
oops, my bad. just sent out V3.

Thx
Best

-- 

Joel Granados

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-03-13 16:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 11:29 [PATCH v2 0/6] sysctl: Move sysctls from kern_table into their respective subsystems Joel Granados
2025-03-06 11:29 ` [PATCH v2 1/6] panic: Move panic ctl tables into panic.c Joel Granados
2025-03-06 11:29 ` [PATCH v2 2/6] signal: Move signal ctl tables into signal.c Joel Granados
2025-03-06 11:29 ` [PATCH v2 3/6] tracing: Move trace sysctls into trace.c Joel Granados
2025-03-06 11:29 ` [PATCH v2 4/6] stack_tracer: move sysctl registration to kernel/trace/trace_stack.c Joel Granados
2025-03-06 15:31   ` Steven Rostedt
2025-03-13 16:19     ` Joel Granados
2025-03-06 11:29 ` [PATCH v2 5/6] sparc: mv sparc sysctls into their own file under arch/sparc/kernel Joel Granados
2025-03-06 11:29 ` [PATCH v2 6/6] s390: mv s390 sysctls into their own file under arch/s390 dir joel granados
2025-03-07 15:26   ` Heiko Carstens
2025-03-10 13:41     ` Joel Granados
2025-03-11 11:02       ` Vasily Gorbik
2025-03-13 16:02         ` Joel Granados

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).