• Peter Zijlstra's avatar
    ring-buffer: pass in lockdep class key for reader_lock · 1f8a6a10
    Peter Zijlstra authored
    On Sun, 7 Jun 2009, Ingo Molnar wrote:
    > Testing tracer sched_switch: <6>Starting ring buffer hammer
    > PASSED
    > Testing tracer sysprof: PASSED
    > Testing tracer function: PASSED
    > Testing tracer irqsoff:
    > =============================================
    > PASSED
    > Testing tracer preemptoff: PASSED
    > Testing tracer preemptirqsoff: [ INFO: possible recursive locking detected ]
    > PASSED
    > Testing tracer branch: 2.6.30-rc8-tip-01972-ge5b9078-dirty #5760
    > ---------------------------------------------
    > rb_consumer/431 is trying to acquire lock:
    >  (&cpu_buffer->reader_lock){......}, at: [<c109eef7>] ring_buffer_reset_cpu+0x37/0x70
    >
    > but task is already holding lock:
    >  (&cpu_buffer->reader_lock){......}, at: [<c10a019e>] ring_buffer_consume+0x7e/0xc0
    >
    > other info that might help us debug this:
    > 1 lock held by rb_consumer/431:
    >  #0:  (&cpu_buffer->reader_lock){......}, at: [<c10a019e>] ring_buffer_consume+0x7e/0xc0
    
    The ring buffer is a generic structure, and can be used outside of
    ftrace. If ftrace traces within the use of the ring buffer, it can produce
    false positives with lockdep.
    
    This patch passes in a static lock key into the allocation of the ring
    buffer, so that different ring buffers will have their own lock class.
    Reported-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <1244477919.13761.9042.camel@twins>
    
    [ store key in ring buffer descriptor ]
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    1f8a6a10
ring_buffer.c 77.2 KB