From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>
Cc: jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, lenb@kernel.org
Subject: Re: [PATCH v2 3/3] PCI: pci_slot: grab refcount on slot's bus
Date: Tue, 31 Mar 2009 14:00:11 +0900 [thread overview]
Message-ID: <49D1A35B.5080305@jp.fujitsu.com> (raw)
In-Reply-To: <20090330165019.18855.69386.stgit@bob.kio>
I confirmed this patch fix the kernel oops problem I reported.
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
By the way, /sys/bus/pci/slots/<slot> directory by pci_slot are
remaining even after the parent bridge/bus of the slots are
removed. At this point, pci_slot is working with struct pci_bus
for the already disabled pci bus. This might cause something
problem. So I think we also need something mechanism to
unregister slots by pci_slot when the parent bus is removed.
Thanks,
Kenji Kaneshige
Alex Chiang wrote:
> If a logical hot unplug (remove) is performed on a physical PCI slot's
> parent bridge, and then pci_slot is unloaded, we will encounter an oops:
>
> [<ffffffff803a788a>] kobject_release+0x9a/0x290
> [<ffffffff803a77f0>] ? kobject_release+0x0/0x290
> [<ffffffff803a8ce7>] kref_put+0x37/0x80
> [<ffffffff803a76f7>] kobject_put+0x27/0x60
> [<ffffffff803bebcc>] ? pci_destroy_slot+0x3c/0xc0
> [<ffffffff803bebd5>] pci_destroy_slot+0x45/0xc0
> [<ffffffffa000f05c>] acpi_pci_slot_remove+0x5c/0x91 [pci_slot]
> [<ffffffff8040064b>] acpi_pci_unregister_driver+0x4b/0x62
> [<ffffffffa000f5c8>] acpi_pci_slot_exit+0x10/0x12 [pci_slot]
> [<ffffffff80276ce1>] sys_delete_module+0x161/0x250
>
> We need to grab a reference to the parent PCI bus, which will pin
> the bus and prevent it from being released until pci_slot is unloaded.
>
> Cc: lenb@kernel.org
> Reported-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> Signed-off-by: Alex Chiang <achiang@hp.com>
> ---
>
> drivers/acpi/pci_slot.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
> index cd1f446..12158e0 100644
> --- a/drivers/acpi/pci_slot.c
> +++ b/drivers/acpi/pci_slot.c
> @@ -164,6 +164,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
> list_add(&slot->list, &slot_list);
> mutex_unlock(&slot_list_lock);
>
> + get_device(&pci_bus->dev);
> +
> dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n",
> pci_slot, pci_bus->number, device, name);
>
> @@ -310,12 +312,15 @@ static void
> acpi_pci_slot_remove(acpi_handle handle)
> {
> struct acpi_pci_slot *slot, *tmp;
> + struct pci_bus *pbus;
>
> mutex_lock(&slot_list_lock);
> list_for_each_entry_safe(slot, tmp, &slot_list, list) {
> if (slot->root_handle == handle) {
> list_del(&slot->list);
> + pbus = slot->pci_slot->bus;
> pci_destroy_slot(slot->pci_slot);
> + put_device(&pbus->dev);
> kfree(slot);
> }
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
prev parent reply other threads:[~2009-03-31 5:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-30 16:50 [PATCH v2 0/3] PCI core logical hotplug cleanup Alex Chiang
2009-03-30 16:50 ` [PATCH v2 1/3] PCI: allow PCI core hotplug to remove PCI root bus Alex Chiang
2009-03-31 3:26 ` Kenji Kaneshige
2009-04-06 18:45 ` Jesse Barnes
2009-03-30 16:50 ` [PATCH v2 2/3] PCI Hotplug: acpiphp: grab refcount on p2p subordinate bus Alex Chiang
2009-03-31 4:37 ` Kenji Kaneshige
2009-03-30 16:50 ` [PATCH v2 3/3] PCI: pci_slot: grab refcount on slot's bus Alex Chiang
2009-03-31 5:00 ` Kenji Kaneshige [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49D1A35B.5080305@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.