Re: [PATCH 4/4] tracing/filters: use ring_buffer_discard_commit fordiscarded events

From: Steven Rostedt
Date: Tue Apr 07 2009 - 05:24:21 EST



On Tue, 7 Apr 2009, Tom Zanussi wrote:
>
> > The bug does not stick out in this patch set. Perhaps it is part of the
> > original too? But something somewhere is calling the discard outside the
> > reserve and commit.
> >
>
> It doesn't stick out to me either - the funny thing is that it only
> happens with CONFIG_PREEMPT_VOLUNTARY - with CONFIG_PREEMPT it's fine.
>
> In fact, with CONFIG_PREEMPT_VOLUNTARY, an RB_WARN_ON(!preempt_count())
> right after frace_preempt_disable() triggers immediately, which unless
> I'm missing something, should never happen. Is there a bug in
> PREEMPT_VOLUNTARY?
>
> Tom
>
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 7a6209f..bac9ab7 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1494,6 +1494,8 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length)
> /* If we are tracing schedule, we don't want to recurse */
> resched = ftrace_preempt_disable();
>
> + RB_WARN_ON(buffer, !preempt_count());

Ug, I'm an idiot ;-)

PREEMPT_VOLUNTARY will always have preempt_count return zero. We need a:

RB_WARN_ON_PREEMPT(buffer);

macro, so that we can define it to warn on CONFIG_PREEMPT but have it be a
nop for all else.

Note, I'm currently traveling so my response times will be limited.

-- Steve

> +
> cpu = raw_smp_processor_id();
>
> if (!cpumask_test_cpu(cpu, buffer->cpumask))
>
>
--
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/