Hello,
I am getting the following deadlock report while booting linux-next on
91dfed74eabcdae9378131546c446442c29bf769 in qemu. Config is attached.
WARNING: possible recursive locking detected
4.13.0-rc4-next-20170811 #2 Not tainted
--------------------------------------------
swapper/0/1 is trying to acquire lock:
(cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff816a19fc>]
stop_machine+0x1c/0x40 kernel/stop_machine.c:596
but task is already holding lock:
(cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
get_online_cpus include/linux/cpu.h:126 [inline]
(cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(cpu_hotplug_lock.rw_sem);
lock(cpu_hotplug_lock.rw_sem);
*** DEADLOCK ***
May be due to missing lock nesting notation
5 locks held by swapper/0/1:
#0: (&dev->mutex){....}, at: [<ffffffff834aa073>] device_lock
include/linux/device.h:1081 [inline]
#0: (&dev->mutex){....}, at: [<ffffffff834aa073>]
__driver_attach+0xd3/0x1c0 drivers/base/dd.c:788
#1: (&dev->mutex){....}, at: [<ffffffff834aa086>] device_lock
include/linux/device.h:1081 [inline]
#1: (&dev->mutex){....}, at: [<ffffffff834aa086>]
__driver_attach+0xe6/0x1c0 drivers/base/dd.c:789
#2: (drm_global_mutex){+.+.}, at: [<ffffffff8285e40d>]
drm_dev_register+0x4d/0x660 drivers/gpu/drm/drm_drv.c:780
#3: (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
get_online_cpus include/linux/cpu.h:126 [inline]
#3: (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
#4: (mtrr_mutex){+.+.}, at: [<ffffffff812aad7b>]
mtrr_add_page+0x1cb/0xe80 arch/x86/kernel/cpu/mtrr/main.c:331
stack backtrace:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc4-next-20170811 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
print_deadlock_bug kernel/locking/lockdep.c:1797 [inline]
check_deadlock kernel/locking/lockdep.c:1844 [inline]
validate_chain kernel/locking/lockdep.c:2453 [inline]
__lock_acquire+0xed5/0x3bc0 kernel/locking/lockdep.c:3498
lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002
percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:35 [inline]
percpu_down_read include/linux/percpu-rwsem.h:58 [inline]
cpus_read_lock+0x42/0x90 kernel/cpu.c:218
stop_machine+0x1c/0x40 kernel/stop_machine.c:596
set_mtrr arch/x86/kernel/cpu/mtrr/main.c:237 [inline]
mtrr_add_page+0x6b7/0xe80 arch/x86/kernel/cpu/mtrr/main.c:373
mtrr_add+0x97/0xb0 arch/x86/kernel/cpu/mtrr/main.c:448
arch_phys_wc_add+0x55/0x90 arch/x86/kernel/cpu/mtrr/main.c:562
cirrus_mm_init+0x43f/0x6a0 drivers/gpu/drm/cirrus/cirrus_ttm.c:274
cirrus_driver_load+0xcd/0x250 drivers/gpu/drm/cirrus/cirrus_main.c:182
drm_dev_register+0x34f/0x660 drivers/gpu/drm/drm_drv.c:801
drm_get_pci_dev+0x1ee/0x600 drivers/gpu/drm/drm_pci.c:262
cirrus_pci_probe+0x198/0x210 drivers/gpu/drm/cirrus/cirrus_drv.c:75
local_pci_probe+0xdc/0x190 drivers/pci/pci-driver.c:307
__pci_device_probe drivers/pci/pci-driver.c:361 [inline]
pci_device_probe+0x5a3/0x6a0 drivers/pci/pci-driver.c:426
really_probe drivers/base/dd.c:413 [inline]
driver_probe_device+0x63c/0xa20 drivers/base/dd.c:557
__driver_attach+0x181/0x1c0 drivers/base/dd.c:791
bus_for_each_dev+0x154/0x1e0 drivers/base/bus.c:313
driver_attach+0x3d/0x50 drivers/base/dd.c:810
bus_add_driver+0x48f/0x660 drivers/base/bus.c:669
driver_register+0x1bf/0x3c0 drivers/base/driver.c:168
__pci_register_driver+0x1d2/0x2c0 drivers/pci/pci-driver.c:1313
cirrus_init+0x52/0x5e drivers/gpu/drm/cirrus/cirrus_drv.c:168
do_one_initcall+0x9e/0x330 init/main.c:824
do_initcall_level init/main.c:890 [inline]
do_initcalls init/main.c:898 [inline]
do_basic_setup init/main.c:916 [inline]
kernel_init_freeable+0x46e/0x526 init/main.c:1066
kernel_init+0x13/0x172 init/main.c:991
ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
Hi Dmitry,
At 08/15/2017 03:18 PM, Dmitry Vyukov wrote:
> Hello,
>
> I am getting the following deadlock report while booting linux-next on
> 91dfed74eabcdae9378131546c446442c29bf769 in qemu. Config is attached.
>
>
> WARNING: possible recursive locking detected
> 4.13.0-rc4-next-20170811 #2 Not tainted
> --------------------------------------------
> swapper/0/1 is trying to acquire lock:
> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff816a19fc>]
> stop_machine+0x1c/0x40 kernel/stop_machine.c:596
>
> but task is already holding lock:
> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
> get_online_cpus include/linux/cpu.h:126 [inline]
> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
> mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
>
I guess you may want this.
https://lkml.org/lkml/2017/8/14/7
and the solution by Thomas
https://lkml.org/lkml/2017/8/14/64
Thanks,
dou.
> other info that might help us debug this:
> Possible unsafe locking scenario:
>
> CPU0
> ----
> lock(cpu_hotplug_lock.rw_sem);
> lock(cpu_hotplug_lock.rw_sem);
>
> *** DEADLOCK ***
>
> May be due to missing lock nesting notation
>
> 5 locks held by swapper/0/1:
> #0: (&dev->mutex){....}, at: [<ffffffff834aa073>] device_lock
> include/linux/device.h:1081 [inline]
> #0: (&dev->mutex){....}, at: [<ffffffff834aa073>]
> __driver_attach+0xd3/0x1c0 drivers/base/dd.c:788
> #1: (&dev->mutex){....}, at: [<ffffffff834aa086>] device_lock
> include/linux/device.h:1081 [inline]
> #1: (&dev->mutex){....}, at: [<ffffffff834aa086>]
> __driver_attach+0xe6/0x1c0 drivers/base/dd.c:789
> #2: (drm_global_mutex){+.+.}, at: [<ffffffff8285e40d>]
> drm_dev_register+0x4d/0x660 drivers/gpu/drm/drm_drv.c:780
> #3: (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
> get_online_cpus include/linux/cpu.h:126 [inline]
> #3: (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
> mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
> #4: (mtrr_mutex){+.+.}, at: [<ffffffff812aad7b>]
> mtrr_add_page+0x1cb/0xe80 arch/x86/kernel/cpu/mtrr/main.c:331
>
> stack backtrace:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc4-next-20170811 #2
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
> __dump_stack lib/dump_stack.c:16 [inline]
> dump_stack+0x194/0x257 lib/dump_stack.c:52
> print_deadlock_bug kernel/locking/lockdep.c:1797 [inline]
> check_deadlock kernel/locking/lockdep.c:1844 [inline]
> validate_chain kernel/locking/lockdep.c:2453 [inline]
> __lock_acquire+0xed5/0x3bc0 kernel/locking/lockdep.c:3498
> lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002
> percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:35 [inline]
> percpu_down_read include/linux/percpu-rwsem.h:58 [inline]
> cpus_read_lock+0x42/0x90 kernel/cpu.c:218
> stop_machine+0x1c/0x40 kernel/stop_machine.c:596
> set_mtrr arch/x86/kernel/cpu/mtrr/main.c:237 [inline]
> mtrr_add_page+0x6b7/0xe80 arch/x86/kernel/cpu/mtrr/main.c:373
> mtrr_add+0x97/0xb0 arch/x86/kernel/cpu/mtrr/main.c:448
> arch_phys_wc_add+0x55/0x90 arch/x86/kernel/cpu/mtrr/main.c:562
> cirrus_mm_init+0x43f/0x6a0 drivers/gpu/drm/cirrus/cirrus_ttm.c:274
> cirrus_driver_load+0xcd/0x250 drivers/gpu/drm/cirrus/cirrus_main.c:182
> drm_dev_register+0x34f/0x660 drivers/gpu/drm/drm_drv.c:801
> drm_get_pci_dev+0x1ee/0x600 drivers/gpu/drm/drm_pci.c:262
> cirrus_pci_probe+0x198/0x210 drivers/gpu/drm/cirrus/cirrus_drv.c:75
> local_pci_probe+0xdc/0x190 drivers/pci/pci-driver.c:307
> __pci_device_probe drivers/pci/pci-driver.c:361 [inline]
> pci_device_probe+0x5a3/0x6a0 drivers/pci/pci-driver.c:426
> really_probe drivers/base/dd.c:413 [inline]
> driver_probe_device+0x63c/0xa20 drivers/base/dd.c:557
> __driver_attach+0x181/0x1c0 drivers/base/dd.c:791
> bus_for_each_dev+0x154/0x1e0 drivers/base/bus.c:313
> driver_attach+0x3d/0x50 drivers/base/dd.c:810
> bus_add_driver+0x48f/0x660 drivers/base/bus.c:669
> driver_register+0x1bf/0x3c0 drivers/base/driver.c:168
> __pci_register_driver+0x1d2/0x2c0 drivers/pci/pci-driver.c:1313
> cirrus_init+0x52/0x5e drivers/gpu/drm/cirrus/cirrus_drv.c:168
> do_one_initcall+0x9e/0x330 init/main.c:824
> do_initcall_level init/main.c:890 [inline]
> do_initcalls init/main.c:898 [inline]
> do_basic_setup init/main.c:916 [inline]
> kernel_init_freeable+0x46e/0x526 init/main.c:1066
> kernel_init+0x13/0x172 init/main.c:991
> ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
>
>
On Tue, Aug 15, 2017 at 11:20 AM, Dou Liyang <[email protected]> wrote:
> Hi Dmitry,
>
> At 08/15/2017 03:18 PM, Dmitry Vyukov wrote:
>>
>> Hello,
>>
>> I am getting the following deadlock report while booting linux-next on
>> 91dfed74eabcdae9378131546c446442c29bf769 in qemu. Config is attached.
>>
>>
>> WARNING: possible recursive locking detected
>> 4.13.0-rc4-next-20170811 #2 Not tainted
>> --------------------------------------------
>> swapper/0/1 is trying to acquire lock:
>> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff816a19fc>]
>> stop_machine+0x1c/0x40 kernel/stop_machine.c:596
>>
>> but task is already holding lock:
>> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
>> get_online_cpus include/linux/cpu.h:126 [inline]
>> (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff812aad6d>]
>> mtrr_add_page+0x1bd/0xe80 arch/x86/kernel/cpu/mtrr/main.c:328
>>
>
> I guess you may want this.
>
> https://lkml.org/lkml/2017/8/14/7
>
> and the solution by Thomas
>
> https://lkml.org/lkml/2017/8/14/64
Will try that. Thanks!