Skip to content
  • Vegard Nossum's avatar
    sched/debug: Make the "Preemption disabled at ..." message more useful · d1c6d149
    Vegard Nossum authored
    This message is currently really useless since it always prints a value
    that comes from the printk() we just did, e.g.:
    
        BUG: sleeping function called from invalid context at mm/slab.h:388
        in_atomic(): 0, irqs_disabled(): 0, pid: 31996, name: trinity-c1
        Preemption disabled at:[<ffffffff8119db33>] down_trylock+0x13/0x80
    
        BUG: sleeping function called from invalid context at include/linux/freezer.h:56
        in_atomic(): 0, irqs_disabled(): 0, pid: 31996, name: trinity-c1
        Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930
    
    Here, both down_trylock() and console_unlock() is somewhere in the
    printk() path.
    
    We should save the value before calling printk() and use the saved value
    instead. That immediately reveals the offending callsite:
    
        BUG: sleeping function called from invalid context at mm/slab.h:388
        in_atomic(): 0, irqs_disabled(): 0, pid: 14971, name: trinity-c2
        Preemption disabled at:[<ffffffff819bcd46>] rhashtable_walk_start+0x46/0x150
    
    Bug report:
    
      http://marc.info/?l=linux-netdev&m=146925979821849&w=2
    
    
    
    Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rusty Russel <rusty@rustcorp.com.au>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    d1c6d149