Hi Peter,
0day kernel testing robot got the below dmesg and the first bad commit is
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
commit e274795ea7b7caa0fd74ef651594382a69e2a951
Author: Peter Zijlstra <peterz(a)infradead.org>
AuthorDate: Wed Jan 11 14:17:48 2017 +0100
Commit: Ingo Molnar <mingo(a)kernel.org>
CommitDate: Sat Jan 14 11:14:38 2017 +0100
locking/mutex: Fix mutex handoff
While reviewing the ww_mutex patches, I noticed that it was still
possible to (incorrectly) succeed for (incorrect) code like:
mutex_lock(&a);
mutex_lock(&a);
This was possible if the second mutex_lock() would block (as expected)
but then receive a spurious wakeup. At that point it would find itself
at the front of the queue, request a handoff and instantly claim
ownership and continue, since owner would point to itself.
Avoid this scenario and simplify the code by introducing a third low
bit to signal handoff pickup. So once we request handoff, unlock
clears the handoff bit and sets the pickup bit along with the new
owner.
This also removes the need for the .handoff argument to
__mutex_trylock(), since that becomes superfluous with PICKUP.
In order to guarantee enough low bits, ensure task_struct alignment is
at least L1_CACHE_BYTES (which seems a good ideal regardless).
Signed-off-by: Peter Zijlstra (Intel) <peterz(a)infradead.org>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Linus Torvalds <torvalds(a)linux-foundation.org>
Cc: Paul E. McKenney <paulmck(a)linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Fixes: 9d659ae14b54 ("locking/mutex: Add lock handoff to avoid
starvation")
Signed-off-by: Ingo Molnar <mingo(a)kernel.org>
+------------------------------------------------------------------------+------------+------------+------------+
| | 52b94129f2 |
e274795ea7 | 8e5373fe04 |
+------------------------------------------------------------------------+------------+------------+------------+
| boot_successes | 256 | 31
| 19 |
| boot_failures | 3 | 35
| 8 |
| invoked_oom-killer:gfp_mask=0x | 3 |
| |
| Mem-Info | 3 |
| |
| WARNING:at_arch/x86/include/asm/fpu/internal.h:#__switch_to | 0 | 35
| 8 |
| WARNING:at_arch/x86/include/asm/fpu/internal.h:#copy_fpregs_to_fpstate | 0 | 35
| 8 |
| WARNING:at_arch/x86/include/asm/fpu/internal.h:#copy_kernel_to_xregs | 0 | 35
| 8 |
+------------------------------------------------------------------------+------------+------------+------------+
[ 13.377261] Write protecting the kernel text: 15320k
[ 13.378910] Write protecting the kernel read-only data: 6316k
[ 13.380655] NX-protecting the kernel data: 9256k
[ 13.382475] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[ 13.384781] ------------[ cut here ]------------
[ 13.386327] WARNING: CPU: 0 PID: 1 at arch/x86/include/asm/fpu/internal.h:348
__switch_to+0x1b6/0x260
[ 13.392043] CPU: 0 PID: 1 Comm: init Not tainted 4.10.0-rc3-00137-ge274795 #1
[ 13.393915] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.9.3-20161025_171302-gandalf 04/01/2014
[ 13.396969] Call Trace:
[ 13.398094] ---[ end trace bea5ac2809caed12 ]---
[ 13.400879] ------------[ cut here ]------------
[ 13.402417] WARNING: CPU: 0 PID: 1 at arch/x86/include/asm/fpu/internal.h:348
copy_fpregs_to_fpstate+0x62/0x7b
[ 13.408198] CPU: 0 PID: 1 Comm: init Tainted: G W
4.10.0-rc3-00137-ge274795 #1
[ 13.410959] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.9.3-20161025_171302-gandalf 04/01/2014
[ 13.414112] Call Trace:
[ 13.415350] dump_stack+0x16/0x18
[ 13.416698] __warn+0xa0/0xb7
[ 13.417964] ? copy_fpregs_to_fpstate+0x62/0x7b
[ 13.419464] warn_slowpath_null+0x11/0x16
[ 13.420866] copy_fpregs_to_fpstate+0x62/0x7b
[ 13.422342] fpu__copy+0x68/0x92
[ 13.423615] arch_dup_task_struct+0x21/0x25
[ 13.425070] copy_process+0xee/0x1198
[ 13.426539] ? strncpy_from_user+0x41/0xce
[ 13.427974] ? ___might_sleep+0x2b/0xf4
[ 13.429387] _do_fork+0x9d/0x1d3
[ 13.430673] SyS_clone+0x19/0x1b
[ 13.431999] do_int80_syscall_32+0x44/0x56
[ 13.433557] entry_INT80_32+0x2a/0x2a
[ 13.434910] EIP: 0x47f11df2
[ 13.436113] EFLAGS: 00000286 CPU: 0
[ 13.437427] EAX: ffffffda EBX: 01200011 ECX: 00000000 EDX: 00000000
[ 13.439207] ESI: 00000000 EDI: b7777728 EBP: bfa57788 ESP: bfa57744
[ 13.442636] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
[ 13.444313] ---[ end trace bea5ac2809caed13 ]---
[ 13.446100] ------------[ cut here ]------------
[ 13.447653] WARNING: CPU: 0 PID: 1 at arch/x86/include/asm/fpu/internal.h:363
__switch_to+0x12c/0x260
[ 13.450896] CPU: 0 PID: 1 Comm: init Tainted: G W
4.10.0-rc3-00137-ge274795 #1
[ 13.454647] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.9.3-20161025_171302-gandalf 04/01/2014
[ 13.457800] Call Trace:
[ 13.459040] ---[ end trace bea5ac2809caed14 ]---
[ 13.463277] ------------[ cut here ]------------
[ 13.466253] WARNING: CPU: 0 PID: 213 at arch/x86/include/asm/fpu/internal.h:363
copy_kernel_to_xregs+0x33/0x36
[ 13.469910] CPU: 0 PID: 213 Comm: rcS Tainted: G W
4.10.0-rc3-00137-ge274795 #1
[ 13.472674] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.9.3-20161025_171302-gandalf 04/01/2014
[ 13.475830] Call Trace:
[ 13.476990] dump_stack+0x16/0x18
[ 13.478280] __warn+0xa0/0xb7
[ 13.479505] ? copy_kernel_to_xregs+0x33/0x36
[ 13.481158] warn_slowpath_null+0x11/0x16
[ 13.482556] copy_kernel_to_xregs+0x33/0x36
[ 13.484191] copy_kernel_to_fpregs+0x20/0x35
[ 13.485638] fpu__restore+0x1f/0x27
[ 13.486966] __fpu__restore_sig+0x269/0x398
[ 13.488396] fpu__restore_sig+0x2e/0x32
[ 13.489768] restore_sigcontext+0xd7/0xe0
[ 13.491300] sys_sigreturn+0xa2/0xc2
[ 13.492625] do_int80_syscall_32+0x44/0x56
[ 13.494064] entry_INT80_32+0x2a/0x2a
[ 13.495599] EIP: 0x47ea7ee7
[ 13.496815] EFLAGS: 00000246 CPU: 0
[ 13.498142] EAX: 00000000 EBX: 00000002 ECX: bfe5e3c0 EDX: 00000000
[ 13.499933] ESI: 00000008 EDI: 47fdcff4 EBP: bfe5e3c0 ESP: bfe5e290
[ 13.501720] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
[ 13.503366] ---[ end trace bea5ac2809caed15 ]---
/etc/rcS.d/S00fbsetup: line 3: /sbin/modprobe: No such file or directory
git bisect start 8e5373fe04a362a9db115f875654d82f31bd3d5a
7089db84e356562f8ba737c29e472cc42d530dbc --
git bisect bad cc3d94c407e49e788c2ce358d73c0af6d519fd06 # 10:31 2- 3 Merge
'linux-review/Alexey-Khoroshilov/mtd-spi-nor-hisi-do-not-ignore-clk_prepare_enable-failure/20170218-071622'
into devel-catchup-201702180748
git bisect good 7d0b0c72199ffe0f5e960488d27e3832fc0fbf3c # 10:52 26+ 0 Merge
'linux-review/Colin-King/ext4-fix-spelling-mistake-alligned-aligned/20170218-073533'
into devel-catchup-201702180748
git bisect bad 0885cf212cc1584ef969243f4df16b28926995c6 # 11:10 1- 3 Merge
'linux-review/Waiman-Long/locking-pvqspinlock-Relax-cmpxchg-s-to-improve-performance-on-some-archs/20170218-070718'
into devel-catchup-201702180748
git bisect good 6f5daa6f332fd9861290efcf150f91dbffe62197 # 11:22 28+ 0 Merge
'linux-review/Steven-Rostedt-VMware/sched-rt-Add-comments-describing-the-RT-IPI-pull-method/20170218-072124'
into devel-catchup-201702180748
git bisect bad f2a5fec17395f259d54daa8833d81b00cceb15c3 # 11:34 5- 4
locking/ww_mutex: Begin kselftests for ww_mutex
git bisect bad 3822da3ed0676e01f83fe0518c333c8e9ba249bf # 11:47 2- 1
locking/ww_mutex: Extract stamp comparison to __ww_mutex_stamp_after()
git bisect good 5376f2e722026e91cb46384bda8d8b3e9f88217c # 12:17 63+ 0
drivers/tty: Compute 'current' directly
git bisect good 8f95c90ceb541a38ac16fec48c05142ef1450c25 # 12:38 65+ 0
sched/wait, RCU: Introduce rcuwait machinery
git bisect bad e274795ea7b7caa0fd74ef651594382a69e2a951 # 12:52 3- 12
locking/mutex: Fix mutex handoff
git bisect good 52b94129f274937e4c25dd17b76697664a3c43c9 # 13:13 60+ 1
locking/percpu-rwsem: Replace waitqueue with rcuwait
# first bad commit: [e274795ea7b7caa0fd74ef651594382a69e2a951] locking/mutex: Fix mutex
handoff
git bisect good 52b94129f274937e4c25dd17b76697664a3c43c9 # 13:32 180+ 1
locking/percpu-rwsem: Replace waitqueue with rcuwait
# extra tests with CONFIG_DEBUG_INFO_REDUCED
git bisect bad e274795ea7b7caa0fd74ef651594382a69e2a951 # 13:48 14- 6
locking/mutex: Fix mutex handoff
# extra tests on HEAD of linux-devel/devel-catchup-201702180748
git bisect bad 8e5373fe04a362a9db115f875654d82f31bd3d5a # 13:48 0- 8 0day
head guard for 'devel-catchup-201702180748'
# extra tests on tree/branch linux-next/master
git bisect bad 4ce4a759a3e221b5265ebd03c2f8888b69a7cf3e # 13:51 7- 1 Add
linux-next specific files for 20170217
# extra tests on tree/branch linus/master
git bisect good 6dc39c50e4aeb769c8ae06edf2b1a732f3490913 # 14:33 184+ 0 Merge
branch 'for-linus' of git://git.kernel.dk/linux-block
# extra tests on tree/branch linux-next/master
git bisect bad 4ce4a759a3e221b5265ebd03c2f8888b69a7cf3e # 14:33 0- 72 Add
linux-next specific files for 20170217
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/lkp Intel Corporation