Re: [PATCH 0/3][RFC] trace_printk() using percpu buffers
From: Peter Zijlstra
Date: Mon Oct 10 2011 - 08:57:22 EST
On Mon, 2011-10-10 at 08:31 -0400, Steven Rostedt wrote:
> > > By default, it still uses the single buffer protected by a spinlock
> > > and an atomic (for NMIs). The NMI case can cause dropped prints if
> > > the NMI happens while a trace_printk() is processing.
> >
> > Why bother keeping that?
>
> Because very few developers debug nmi's. printk is known not to work
> there.
>
> I still find it useful to have without having to switch on a config
> option or kernel command line.
But its also a massive scalability fail. There's simply no sane reason
to keep the shared buffer trace_printk() implementation.
> > > When trace_printk_percpu is enabled, either via the trace options or
> > > the kernel command line, then two sets of percpu buffers are made,
> > > one for normal and irqs (interrupts are still disabled), and the other
> > > is for NMIs. These can be added or removed at anytime.
> >
> > So why not allocate 4, one for {task, softirq, irq, NMI} resp, then all
> > you need to do is disable preemption.
> >
> > depending on tracing/options/trace_printk ?
>
> Preemption still needs to be disabled. But if you think that's better
> than disabling interrupts, I could do that too.
I guess it doesn't really matter that much..
> > > The last patch adds a CONFIG_TRACE_PRINTK_PERCPU that makes trace_printk()
> > > permanently use two sets of per_cpu buffers, and these can not be
> > > removed. This will give the least amount of overhead for trace_printk()
> > > with the sacrifice of memory overhead. This is an option I could imagine
> > > you would just set and forget about.
> >
> > Is that one dereference really that expensive?
>
> It's also a compare and jump, but I added this option for you :)
Ah, right :-)
> That way, you could set this option and forget about it.
Well, if all we have is the per-cpu option I'm fine either way.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/