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

Ingo Molnar
2009-04-29T05:55:33Z

* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 29 Apr 2009 00:48:15 -0400 Steven Rostedt <rostedt@goodmis.org> 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