Re: WARNING: at kernel/mutex.c:386 __mutex_lock_common()

From: Fengguang Wu
Date: Tue Feb 19 2013 - 22:24:13 EST


> > [ 0.000000]
> > [ 0.000000] ------------[ cut here ]------------
> > [ 0.000000] WARNING: at /c/kernel-tests/src/tip/kernel/mutex.c:386 __mutex_lock_common+0x5a9/0x870()
> > [ 0.000000] Hardware name: Bochs
> > [ 0.000000] Modules linked in:
> > [ 0.000000] Pid: 0, comm: swapper/0 Not tainted 3.8.0-rc7-00071-g11eb5a2 #180
> > [ 0.000000] Call Trace:
> > [ 0.000000] [<ffffffff81047102>] warn_slowpath_common+0xb2/0x120
> > [ 0.000000] [<ffffffff81047195>] warn_slowpath_null+0x25/0x30
> > [ 0.000000] [<ffffffff814ebdd9>] __mutex_lock_common+0x5a9/0x870
> > [ 0.000000] [<ffffffff81a66ef8>] ? rcu_cpu_notify+0xa8/0x451
> > [ 0.000000] [<ffffffff810bcb8f>] ? trace_hardirqs_off_caller+0xaf/0x120
> > [ 0.000000] [<ffffffff81a66ef8>] ? rcu_cpu_notify+0xa8/0x451
> > [ 0.000000] [<ffffffff810be38c>] ? lockdep_init_map+0xfc/0x230
> > [ 0.000000] [<ffffffff814ec621>] mutex_lock_nested+0x61/0x80
> > [ 0.000000] [<ffffffff810bcc1d>] ? trace_hardirqs_off+0x1d/0x30
> > [ 0.000000] [<ffffffff81a66ef8>] rcu_cpu_notify+0xa8/0x451
> > [ 0.000000] [<ffffffff814ecc31>] ? mutex_unlock+0x11/0x20
> > [ 0.000000] [<ffffffff81a3f952>] rcu_init+0x3b3/0x408
> > [ 0.000000] [<ffffffff81a21e0c>] start_kernel+0x34a/0x744
> > [ 0.000000] [<ffffffff81a216e6>] ? repair_env_string+0x81/0x81
> > [ 0.000000] [<ffffffff81a21120>] ? early_idt_handlers+0x120/0x120
> > [ 0.000000] [<ffffffff81a212fd>] x86_64_start_reservations+0x185/0x190
> > [ 0.000000] [<ffffffff81a214a8>] x86_64_start_kernel+0x1a0/0x1b6
> > [ 0.000000] ---[ end trace 8e966724b1809892 ]---
> Weird, that code path should not be hit from __mutex_lock_common from
> mutex_lock_nested, I'll create a patch with some tests to make sure
> that lib/locking-selftests.c will perform tests on common mutexes to
> ensure that code path is not hit, and this bug will not happen again.
>
> Can you change __mutex_lock_common from inline to __always_inline and
> check if that gets rid of the warning?

Maarten, that trick worked! Thanks!

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