Re: [ACPI/PCI] possible recursive locking detected

From: Yinghai Lu
Date: Sat Sep 22 2012 - 03:05:53 EST


On Fri, Sep 21, 2012 at 9:53 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> On Fri, Sep 21, 2012 at 5:35 PM, Fengguang Wu <fengguang.wu@xxxxxxxxx> wrote:
>> Hi Taku,
>>
>> The below oops is pretty reproducible, and shows up first in:
>>
>> tree: git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/taku-acpi-pci-host-bridge-v3
>> head: e3faec8ea9c8aa683c56fa20ff2c58a4c5857960
>> commit: d3c663236318a43fed5d86a643e6ea2534e9220e [5/7] PCI/ACPI: Protect acpi_pci_roots list with mutex
>>
>> [ 8.613239] (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81741e5f>] acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81741e5f>] acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81742398>] acpi_pci_register_driver+0x21/0x79
>> [ 8.613239] lock(acpi_pci_root_lock);
>> [ 8.613239] lock(acpi_pci_root_lock);
>> [ 8.613239] #0: (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81742398>] acpi_pci_register_driver+0x21/0x79
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff81741e5f>] acpi_get_pci_rootbridge_handle+0x22/0x63
>>
>> [ 8.610859]
>> [ 8.611385] =============================================
>> [ 8.612505] [ INFO: possible recursive locking detected ]
>> [ 8.613239] 3.6.0-rc1-00022-gd3c6632 #7512 Not tainted
>> [ 8.613239] ---------------------------------------------
>> [ 8.613239] swapper/0/1 is trying to acquire lock:
>> [ 8.613239] (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81741e5f>] acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239]
>> [ 8.613239] but task is already holding lock:
>> [ 8.613239] (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81742398>] acpi_pci_register_driver+0x21/0x79
>> [ 8.613239]
>> [ 8.613239] other info that might help us debug this:
>> [ 8.613239] Possible unsafe locking scenario:
>> [ 8.613239]
>> [ 8.613239] CPU0
>> [ 8.613239] ----
>> [ 8.613239] lock(acpi_pci_root_lock);
>> [ 8.613239] lock(acpi_pci_root_lock);
>> [ 8.613239]
>> [ 8.613239] *** DEADLOCK ***
>> [ 8.613239]
>> [ 8.613239] May be due to missing lock nesting notation
>> [ 8.613239]
>> [ 8.613239] 1 lock held by swapper/0/1:
>> [ 8.613239] #0: (acpi_pci_root_lock){+.+.+.}, at: [<ffffffff81742398>] acpi_pci_register_driver+0x21/0x79
>> [ 8.613239]
>> [ 8.613239] stack backtrace:
>> [ 8.613239] Pid: 1, comm: swapper/0 Not tainted 3.6.0-rc1-00022-gd3c6632 #7512
>> [ 8.613239] Call Trace:
>> [ 8.613239] [<ffffffff810d7ae5>] __lock_acquire+0xbef/0xd04
>> [ 8.613239] [<ffffffff8106e60b>] ? kvm_clock_read+0x2e/0x36
>> [ 8.613239] [<ffffffff810d80a3>] lock_acquire+0xd5/0x119
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff8270c01b>] __mutex_lock_common+0x58/0x387
>> [ 8.613239] [<ffffffff81741e5f>] ? acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff8106e60b>] ? kvm_clock_read+0x2e/0x36
>> [ 8.613239] [<ffffffff81118ea4>] ? irq_trace+0x14/0x21
>> [ 8.613239] [<ffffffff8270c459>] mutex_lock_nested+0x40/0x45
>> [ 8.613239] [<ffffffff81741e5f>] acpi_get_pci_rootbridge_handle+0x22/0x63
>> [ 8.613239] [<ffffffff816beb25>] acpi_pci_get_bridge_handle+0x2c/0x2e
>> [ 8.613239] [<ffffffff816beb3f>] acpi_pci_check_ejectable+0x18/0x49
>> [ 8.613239] [<ffffffff8270ea46>] ? _raw_spin_unlock_irqrestore+0x45/0x61
>> [ 8.613239] [<ffffffff816c6981>] register_slot+0x2f/0x460
>> [ 8.613239] [<ffffffff810afbf8>] ? up+0x39/0x3e
>> [ 8.613239] [<ffffffff81757575>] acpi_ns_walk_namespace+0xbe/0x179
>> [ 8.613239] [<ffffffff8173c09a>] ? acpi_os_wait_semaphore+0x45/0x5a
>> [ 8.613239] [<ffffffff816c6952>] ? kzalloc.constprop.14+0x10/0x10
>> [ 8.613239] [<ffffffff816c6952>] ? kzalloc.constprop.14+0x10/0x10
>> [ 8.613239] [<ffffffff81757a1d>] acpi_walk_namespace+0x98/0xcb
>> [ 8.613239] [<ffffffff816c6dfe>] init_bridge_misc+0x4c/0xd5
>> [ 8.613239] [<ffffffff816c6f70>] add_bridge+0xe9/0x138
>> [ 8.613239] [<ffffffff817423c9>] acpi_pci_register_driver+0x52/0x79
>> [ 8.613239] [<ffffffff838ce2b2>] ? shpcd_init+0xf0/0xf0
>> [ 8.613239] [<ffffffff838ce34a>] acpiphp_glue_init+0x48/0x51
>> [ 8.613239] [<ffffffff838ce2dd>] acpiphp_init+0x2b/0x50
>> [ 8.613239] [<ffffffff81002099>] do_one_initcall+0x7f/0x13a
>> [ 8.613239] [<ffffffff8389ccef>] kernel_init+0x13c/0x1c0
>> [ 8.613239] [<ffffffff8389c590>] ? do_early_param+0x8c/0x8c
>> [ 8.613239] [<ffffffff82716944>] kernel_thread_helper+0x4/0x10
>> [ 8.613239] [<ffffffff8270ee70>] ? retint_restore_args+0x13/0x13
>> [ 8.613239] [<ffffffff8389cbb3>] ? start_kernel+0x3d1/0x3d1
>> [ 8.613239] [<ffffffff82716940>] ? gs_change+0x13/0x13
>
> Please check attached patch that should fix the problem.

updated more aggressive version. two patches.

-Yinghai

Attachment: pci_root_bus_to_handle_1.patch
Description: Binary data

Attachment: pci_root_bus_to_handle_2.patch
Description: Binary data