Re: [PATCH] tracing: Choose static tp_printk buffer by explicit nesting count

From: Peter Zijlstra
Date: Wed May 25 2016 - 13:59:56 EST


On Wed, May 25, 2016 at 03:16:40PM +0200, Peter Zijlstra wrote:
> On Tue, May 24, 2016 at 03:52:28PM -0700, Andy Lutomirski wrote:
> > + struct trace_buffer_struct *buffer = this_cpu_ptr(trace_percpu_buffer);
> >
> > + if (!buffer || buffer->nesting >= 4)
> > return NULL;
>
> This is buggy fwiw; you need to unconditionally increment
> buffer->nesting to match the unconditional decrement.
>
> Otherwise 5 'increments' and 5 decrements will land you at -1.

Urgh, never mind me; if you don't dec when returning NULL this should
work out fine.

My head really aint working right today.