[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aURlK1gpCrfLEKN9@yury>
Date: Thu, 18 Dec 2025 15:33:47 -0500
From: Yury Norov <yury.norov@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Randy Dunlap <rdunlap@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Christophe Leroy <chleroy@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
David Laight <david.laight@...box.com>,
Petr Pavlu <petr.pavlu@...e.com>,
Andi Shyti <andi.shyti@...nel.org>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>,
Daniel Gomez <da.gomez@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-modules@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Kees Cook <kees@...nel.org>
Subject: Re: [PATCH v3 4/4] tracing: move tracing declarations from kernel.h
to a dedicated header
On Thu, Dec 18, 2025 at 12:43:26PM -0500, Steven Rostedt wrote:
> On Thu, 18 Dec 2025 12:33:49 -0500
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
> > On Wed, 17 Dec 2025 22:59:33 -0500
> > Yury Norov <yury.norov@...il.com> wrote:
> >
> > > I deem to drop trace_printk.h from kernel.h - it is more aligned with
> > > the idea of unloading the header. The original motivation to keep
> > > trace_printk.h in kernel.h was just because a similar printk.h is living
> > > there. But after all, this is a purely debugging header, so no need for
> > > almost every C file to bear debugging stuff.
> >
> > It is a big deal for debugging stuff. A lot of developers debug their code
> > with trace_printk(), and do the "shotgun approach", where they cut and
> > paste trace_printk()s all over their code in several files. Having to now add:
> >
> > #include <linux/trace_printk.h>
> >
> > whenever a trace_printk() is added is going to be a big PITA and slow down
> > all debugging efforts.
> >
>
> I don't actually remember why I had __trace_puts() pass in the size. I
> could change it to:
This is the best approach. I'll schedule it for v4. Would you like me to
take it as-is, or you'd send a patch?
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 5b46924fdff5..d5a939b8c391 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -331,10 +331,10 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
> if (__builtin_constant_p(str)) \
> __trace_bputs(_THIS_IP_, trace_printk_fmt); \
> else \
> - __trace_puts(_THIS_IP_, str, strlen(str)); \
> + __trace_puts(_THIS_IP_, str); \
> })
> extern int __trace_bputs(unsigned long ip, const char *str);
> -extern int __trace_puts(unsigned long ip, const char *str, int size);
> +extern int __trace_puts(unsigned long ip, const char *str);
>
> extern void trace_dump_stack(int skip);
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index e575956ef9b5..686741edb803 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1178,11 +1178,10 @@ EXPORT_SYMBOL_GPL(__trace_array_puts);
> * __trace_puts - write a constant string into the trace buffer.
> * @ip: The address of the caller
> * @str: The constant string to write
> - * @size: The size of the string.
> */
> -int __trace_puts(unsigned long ip, const char *str, int size)
> +int __trace_puts(unsigned long ip, const char *str)
> {
> - return __trace_array_puts(printk_trace, ip, str, size);
> + return __trace_array_puts(printk_trace, ip, str, strlen(str));
> }
> EXPORT_SYMBOL_GPL(__trace_puts);
>
> @@ -1201,7 +1200,7 @@ int __trace_bputs(unsigned long ip, const char *str)
> int size = sizeof(struct bputs_entry);
>
> if (!printk_binsafe(tr))
> - return __trace_puts(ip, str, strlen(str));
> + return __trace_puts(ip, str);
>
> if (!(tr->trace_flags & TRACE_ITER(PRINTK)))
> return 0;
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index b6d42fe06115..de4e6713b84e 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -2116,7 +2116,7 @@ extern void tracing_log_err(struct trace_array *tr,
> * about performance). The internal_trace_puts() is for such
> * a purpose.
> */
> -#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str))
> +#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str)
>
> #undef FTRACE_ENTRY
> #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \
>
>
>
> Which removes the strlen() altogether.
>
> -- Steve
Powered by blists - more mailing lists