lkml.org 
[lkml]   [2008]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] ftrace: printk formatting infrastructure

On Fri, 1 Aug 2008, Randy Dunlap wrote:

> On Fri, 01 Aug 2008 12:26:41 -0400 Steven Rostedt wrote:
>
> > +/**
> > + * ftrace_printk - printf formatting in the ftrace buffer
> > + * @fmt - the printf format for printing.
>
> * @fmt: the printf format for printing
> * @ip: <description>
>
> > + *
> > + * Note: __ftrace_printk is an internal function for ftrace_printk and
> > + * the @ip is passed in via the ftrace_printk macro.

The above note actually explains this ;-)

Should I move the description to the ftrace_printk macro?

In include/linux/ftrace.h you see:

#ifdef CONFIG_TRACING
[...]
# define ftrace_printk(x...) __ftrace_printk(_THIS_IP_, x)
extern int
__ftrace_printk(unsigned long ip, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#else
[...]
static inline int
ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1,
0)))
{
return 0;
}
#endif

The true API is ftrace_printk(const char *fmt) and the __ftrace_printk
version should not be used.

Do you still think I should document the @ip?

I could also just remove the passing of _THIS_IP_ and use _RET_IP_
inside of ftrace_printk but the _THIS_IP_ seems to be more accurate
especially when we have stack unwinding returns.

-- Steve



> > + *
> > + * This function allows a kernel developer to debug fast path sections
> > + * that printk is not appropriate for. By scattering in various
> > + * printk like tracing in the code, a developer can quickly see
> > + * where problems are occurring.
> > + *
> > + * This is intended as a debugging tool for the developer only.
> > + * Please reframe from leaving ftrace_printks scattered around in
> > + * your code.
> > + */
> > +int __ftrace_printk(unsigned long ip, const char *fmt, ...)
> > +{
>
>
> ---
> ~Randy
> Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
> http://linuxplumbersconf.org/
>


\
 
 \ /
  Last update: 2008-08-01 18:55    [W:0.053 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site