Re: [PATCH 1/5] tracing: convert ftrace_dump spinlocks to raw

From: Ingo Molnar
Date: Wed Apr 29 2009 - 01:55:34 EST



* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 29 Apr 2009 00:48:15 -0400 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > + local_irq_save(flags);
> > + __raw_spin_lock(&ftrace_dump_lock);
>
> I'm counting twentyish instances of this. [...]

there's 9 in the tracing code, two more in the rest of the kernel.

> [...] Maybe it's time to give up and implement
> raw_spin_lock_irqsave().

There's a difference between:

local_irq_save(flags);
__raw_spin_lock(&ftrace_dump_lock);

and:

raw_local_irq_save(flags);
__raw_spin_lock(&ftrace_dump_lock);

raw_spin_lock_irqsave() would map to the latter logic-wise - but in
the tracing code we want the former.

But the main reason is that using raw locks has its costs - it skips
lockdep coverage, is preempt unsafe, etc. The APIs are not complete
and intentionally so: they are minimal building blocks for the real
APIs. Instrumentation goes deep in the guts of the kernel so using
very low level primitives is justified there - but we dont want to
make it _too_ easy to use a raw-anything locking facility.

Ingo
--
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/