From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0E6733D8; Tue, 4 Mar 2025 01:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741052646; cv=none; b=ajpJoocNxcgtDbxaVEoNtDauL0PBlMXtLxIGp7I7ESO57pbiujW39yN59OM8bhIYrez2cW72VIuxenf21f6eizNTs1J9XlBptRLKLaktz6PS6JTaSZgBFRge+HlQ2sYdWuI/EdmnkLAMrZWNMVzsFfRhigAaxrqnQ9JqYatbyAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741052646; c=relaxed/simple; bh=Hm8/JkSd6ej479ogJ1QTyYgA3ezyJHCm2ycDRDJXQAE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hli6e3NDUzYi+n+hzLHl5luYKINqwmvQ8kHIuCTTZ6yA2ww2SH/tXGMgsMmoGmCGpGeyHxBeRKynL4o464nzftqfpXAlAMdaSyCTuurmH2mreR28SBJ8wFchf0FqFQN7N6n3DpIqI9vbVCpQJ9cUsCqBjpwberDbthhecECaWcU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E424C4CEE4; Tue, 4 Mar 2025 01:44:02 +0000 (UTC) Date: Mon, 3 Mar 2025 20:44:55 -0500 From: Steven Rostedt To: Joel Granados Cc: Kees Cook , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , "David S. Miller" , Andreas Larsson , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Gerald Schaefer , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, sparclinux@vger.kernel.org, linux-s390@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH 3/8] ftrace: Move trace sysctls into trace.c Message-ID: <20250303204455.69723c20@gandalf.local.home> In-Reply-To: <20250218-jag-mv_ctltables-v1-3-cd3698ab8d29@kernel.org> References: <20250218-jag-mv_ctltables-v1-0-cd3698ab8d29@kernel.org> <20250218-jag-mv_ctltables-v1-3-cd3698ab8d29@kernel.org> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 18 Feb 2025 10:56:19 +0100 Joel Granados wrote: Nit, change the subject to: tracing: Move trace sysctls into trace.c as I try to only have the "ftrace:" label for modifications that affect attaching to functions, and "tracing:" for everything else. Acked-by: Steven Rostedt (Google) -- Steve > 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 > --- > 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 fbabc3d848b3..59774513ae45 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 6514c13800a4..baa250e223a2 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -51,7 +51,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -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 0e6d517e74e0..abfc0e56173b 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 */ >