Re: [RFC/PATCH] lib/vsprintf: Add support to store cpumask

From: Steven Rostedt
Date: Wed Jun 29 2016 - 11:42:44 EST


On Wed, 29 Jun 2016 08:43:48 +0200
Jiri Olsa <jolsa@xxxxxxxxxx> wrote:

>
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 94aa10ffe156..62693900cc4b 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -631,7 +631,24 @@ do { \
> > \
> > __trace_printk_check_format(fmt, ##args); \
> > \
> > - if (__builtin_constant_p(fmt)) \
> > + if (__builtin_constant_p(fmt) && \
> > + !__builtin_strstr(fmt, "%pF") && \
> > + !__builtin_strstr(fmt, "%pf") && \
> > + !__builtin_strstr(fmt, "%pR") && \
> > + !__builtin_strstr(fmt, "%pr") && \
> > + !__builtin_strstr(fmt, "%pb") && \
> > + !__builtin_strstr(fmt, "%pM") && \
> > + !__builtin_strstr(fmt, "%pI") && \
> > + !__builtin_strstr(fmt, "%pE") && \
> > + !__builtin_strstr(fmt, "%pU") && \
> > + !__builtin_strstr(fmt, "%pV") && \
> > + !__builtin_strstr(fmt, "%pN") && \
> > + !__builtin_strstr(fmt, "%pa") && \
> > + !__builtin_strstr(fmt, "%pd") && \
> > + !__builtin_strstr(fmt, "%pC") && \
> > + !__builtin_strstr(fmt, "%pD") && \
> > + !__builtin_strstr(fmt, "%pg") && \
> > + !__builtin_strstr(fmt, "%pG")) \
> > __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
> > else \
> > __trace_printk(_THIS_IP_, fmt, ##args); \
>
> is this one working? it seems better to me than adding new trace_printk_ptr

The problem with this is that it would require a bunch more conditions
as you see it would not have helped your own use case (requiring the *p)

I'm actually looking into extending your patch to handle all cases that
vbin_printf() is an issue.

Thinking about it more, as vbin_printf() is a two part process, it
should by default not depend on any dereferencing, as I can't think of
any use case for it where it wouldn't be an issue.

-- Steve