History

tracing: Move trace sysctls into trace.c

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 kernel/sysctl.c.

Joel Granados committed 1 year ago

Commit dd293df1 parent 256db5c3 files · +35 −32Browse files

Unified · Split

3 files
  1. include/linux/ftrace.h +0 −7
  2. kernel/sysctl.c +0 −24
  3. kernel/trace/trace.c +35 −1
include/linux/ftrace.h+0−7
@@ -1298,16 +1298,9 @@ static inline void unpause_graph_tracing(void) { } · 1297 unmodified lines
1298#ifdef CONFIG_TRACING1298#ifdef CONFIG_TRACING
1299enum ftrace_dump_mode;1299enum ftrace_dump_mode;
1300 1300
1301#define MAX_TRACER_SIZE 100
1302extern char ftrace_dump_on_oops[];
1303extern int ftrace_dump_on_oops_enabled(void);1301extern int ftrace_dump_on_oops_enabled(void);
1304extern int tracepoint_printk;
1305 1302
1306extern void disable_trace_on_warning(void);1303extern void disable_trace_on_warning(void);
1307extern int __disable_trace_on_warning;
1308
1309int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
1310 void *buffer, size_t *lenp, loff_t *ppos);
1311 1304
1312#else /* CONFIG_TRACING */1305#else /* CONFIG_TRACING */
1313static inline void disable_trace_on_warning(void) { }1306static inline void disable_trace_on_warning(void) { }
kernel/sysctl.c+0−24
@@ -44,7 +44,6 @@ · 43 unmodified lines
44#include <linux/nfs_fs.h>44#include <linux/nfs_fs.h>
45#include <linux/acpi.h>45#include <linux/acpi.h>
46#include <linux/reboot.h>46#include <linux/reboot.h>
47#include <linux/ftrace.h>
48#include <linux/kmod.h>47#include <linux/kmod.h>
49#include <linux/capability.h>48#include <linux/capability.h>
50#include <linux/binfmts.h>49#include <linux/binfmts.h>
@@ -1662,29 +1661,6 @@ static const struct ctl_table kern_table[] = { · 1611 unmodified lines
1662 .proc_handler = stack_trace_sysctl,1661 .proc_handler = stack_trace_sysctl,
1663 },1662 },
1664#endif1663#endif
1665#ifdef CONFIG_TRACING
1666 {
1667 .procname = "ftrace_dump_on_oops",
1668 .data = &ftrace_dump_on_oops,
1669 .maxlen = MAX_TRACER_SIZE,
1670 .mode = 0644,
1671 .proc_handler = proc_dostring,
1672 },
1673 {
1674 .procname = "traceoff_on_warning",
1675 .data = &__disable_trace_on_warning,
1676 .maxlen = sizeof(__disable_trace_on_warning),
1677 .mode = 0644,
1678 .proc_handler = proc_dointvec,
1679 },
1680 {
1681 .procname = "tracepoint_printk",
1682 .data = &tracepoint_printk,
1683 .maxlen = sizeof(tracepoint_printk),
1684 .mode = 0644,
1685 .proc_handler = tracepoint_printk_sysctl,
1686 },
1687#endif
1688#ifdef CONFIG_MODULES1664#ifdef CONFIG_MODULES
1689 {1665 {
1690 .procname = "modprobe",1666 .procname = "modprobe",
kernel/trace/trace.c+35−1
@@ -120,6 +120,7 @@ static int tracing_disabled = 1; · 119 unmodified lines
120 120
121cpumask_var_t __read_mostly tracing_buffer_mask;121cpumask_var_t __read_mostly tracing_buffer_mask;
122 122
123#define MAX_TRACER_SIZE 100
123/*124/*
124 * ftrace_dump_on_oops - variable to dump ftrace buffer on oops125 * ftrace_dump_on_oops - variable to dump ftrace buffer on oops
125 *126 *
@@ -142,7 +143,40 @@ cpumask_var_t __read_mostly tracing_buffer_mask; · 16 unmodified lines
142char ftrace_dump_on_oops[MAX_TRACER_SIZE] = "0";143char ftrace_dump_on_oops[MAX_TRACER_SIZE] = "0";
143 144
144/* When set, tracing will stop when a WARN*() is hit */145/* When set, tracing will stop when a WARN*() is hit */
145int __disable_trace_on_warning;146static int __disable_trace_on_warning;
147
148int tracepoint_printk_sysctl(const struct ctl_table *table, int write,
149 void *buffer, size_t *lenp, loff_t *ppos);
150static const struct ctl_table trace_sysctl_table[] = {
151 {
152 .procname = "ftrace_dump_on_oops",
153 .data = &ftrace_dump_on_oops,
154 .maxlen = MAX_TRACER_SIZE,
155 .mode = 0644,
156 .proc_handler = proc_dostring,
157 },
158 {
159 .procname = "traceoff_on_warning",
160 .data = &__disable_trace_on_warning,
161 .maxlen = sizeof(__disable_trace_on_warning),
162 .mode = 0644,
163 .proc_handler = proc_dointvec,
164 },
165 {
166 .procname = "tracepoint_printk",
167 .data = &tracepoint_printk,
168 .maxlen = sizeof(tracepoint_printk),
169 .mode = 0644,
170 .proc_handler = tracepoint_printk_sysctl,
171 },
172};
173
174static int __init init_trace_sysctls(void)
175{
176 register_sysctl_init("kernel", trace_sysctl_table);
177 return 0;
178}
179subsys_initcall(init_trace_sysctls);
146 180
147#ifdef CONFIG_TRACE_EVAL_MAP_FILE181#ifdef CONFIG_TRACE_EVAL_MAP_FILE
148/* Map of enums to their values, for "eval_map" file */182/* Map of enums to their values, for "eval_map" file */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t