[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111123131622.GA10669@somewhere.redhat.com>
Date: Wed, 23 Nov 2011 14:16:28 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Christoph Hellwig <hch@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2] printk: add console output tracing
On Fri, Nov 18, 2011 at 07:59:12PM +0100, Johannes Berg wrote:
> On Fri, 2011-11-18 at 19:54 +0100, Frederic Weisbecker wrote:
> > On Fri, Nov 18, 2011 at 07:46:15PM +0100, Johannes Berg wrote:
> > > On Fri, 2011-11-18 at 19:44 +0100, Frederic Weisbecker wrote:
> > >
> > > > > +TRACE_EVENT_CONDITION(console,
> > > > > + TP_PROTO(const char *log_buf, unsigned start, unsigned end,
> > > > > + unsigned log_buf_len),
> > > > > +
> > > > > + TP_ARGS(log_buf, start, end, log_buf_len),
> > > > > +
> > > > > + TP_CONDITION(start != end),
> > > > > +
> > > > > + TP_STRUCT__entry(
> > > > > + __dynamic_array(char, msg,
> > > > > + ((end - start + log_buf_len) &
> > > > > + (log_buf_len - 1)) + 1)
> > > >
> > > > Is all that care about log_buf_len necessary? It seems that
> > > > printk ensures that log_end - con_start never exceeds log_buf_len,
> > > > looking at emit_log_char()
> > >
> > > I think it is. The buffer can wrap around so in that case end < start,
> > > which just end-start won't handle here.
> >
> > Even if it wraps, end - start should always give a positive result.
> >
> > We have that check in call_console_drivers():
> >
> > BUG_ON(((int)(start - end)) > 0)
>
> That's .. confusing, start - end > 0 <=> start > end ??
Yeah. Both are unsigned, so converting the result into an int
and getting a positive value means we have wrapped INT_MAX.
>
> Also, call_console_drivers() doesn't pass this start/end through to
> _call_console_drivers(), it has loops and stuff there...
Yeah but looking at the loop there, start and end passed to
__call_console_drivers() are bounded between start and end passed to
call_console_drivers().
>
> In any case -- feel free to clean it all up, I basically copied the
> logic from _call_console_drivers assuming it was needed.
I'm just reviewing and suggesting a way to keep the patch more simple.
Outside that, I don't really need that patch myself ;)
> I don't really want to know about the printk details :-)
Well, it's like working out outside in winter. It may not sound
very entertaining in the beginning but then it quickly becomes
invigorating, toning and good for the mood...I think...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists