From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Bjorn Helgaas <bhelgaas@google.com>, Amos Kong <akong@redhat.com>
Cc: linux-pci@vger.kernel.org, jbarnes@virtuousgeek.org,
mst@redhat.com, alex.williamson@redhat.com, mtosatti@redhat.com,
kvm@vger.kernel.org, Kevin O'Connor <kevin@koconnor.net>,
seabios@seabios.org
Subject: Re: [PATCH] pci: clean all funcs when hot-removing multifunc device
Date: Fri, 16 Sep 2011 08:56:32 +0900 [thread overview]
Message-ID: <4E7290B0.1040801@jp.fujitsu.com> (raw)
In-Reply-To: <CAErSpo4c9xN2vcR+qYS_Ti4s=ZuvZTNinogUDULT=S0z1+sw9A@mail.gmail.com>
(2011/09/16 4:03), Bjorn Helgaas wrote:
> On Tue, Sep 13, 2011 at 10:55 PM, Amos Kong<akong@redhat.com> wrote:
>> 'slot->funcs' is initialized in acpiphp_glue.c:register_slot() before
>> hotpluging device, and only one entry(func 0) is added to it,
>> no new entry will be added to the list when hotpluging devices to the slot.
>> When we release the whole device, there is only one entry in the list,
>> this causes func1~7 could not be released.
>> I try to add entries for all hotpluged device in enable_device(), but
>> it doesn't work, because 'slot->funcs' is used in many place which we only
>> need to process func 0. This patch just try to clean all funcs in
>> disable_device().
> ...
>> Hotpluging multifunc of WinXp is fine.
>
> I'm going to ignore this patch for now. Please consider these
> questions, then repost it if you still want it:
>
> I assume you mean that Linux and WinXP are both running on top of the
> same SeaBIOS, and hot-remove of a multifunction device works in WinXP
> and fails in Linux. That sounds like Linux is broken, and we should
> fix it. We might want to make a SeaBIOS change for other reasons, but
> it'd still be good to fix Linux in case there are other similar
> BIOSes.
No objection about fixing Linux.
>
> Why do we need pci_scan_single_device()? The device should have been
> scanned already when it was added, and I would think that should have
> set pdev->multifunction.
It should be pci_get_slot() instead. Note that it needs
corresponding pci_dev_put().
Regards,
Kenji Kaneshige
>
> Your patch needs spaces around the operators in the "for" loop.
>
> In the changelog, it would be nice to have the URL of a bugzilla where
> the dmesg and DSDT are attached.
>
> Bjorn
>
>> Signed-off-by: Amos Kong<akong@redhat.com>
>> ---
>> drivers/pci/hotplug/acpiphp_glue.c | 27 ++++++++++++++++++---------
>> 1 files changed, 18 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
>> index a70fa89..3b86d1a 100644
>> --- a/drivers/pci/hotplug/acpiphp_glue.c
>> +++ b/drivers/pci/hotplug/acpiphp_glue.c
>> @@ -880,6 +880,8 @@ static int disable_device(struct acpiphp_slot *slot)
>> {
>> struct acpiphp_func *func;
>> struct pci_dev *pdev;
>> + struct pci_bus *bus = slot->bridge->pci_bus;
>> + int i, num = 1;
>>
>> /* is this slot already disabled? */
>> if (!(slot->flags& SLOT_ENABLED))
>> @@ -893,16 +895,23 @@ static int disable_device(struct acpiphp_slot *slot)
>> func->bridge = NULL;
>> }
>>
>> - pdev = pci_get_slot(slot->bridge->pci_bus,
>> - PCI_DEVFN(slot->device, func->function));
>> - if (pdev) {
>> - pci_stop_bus_device(pdev);
>> - if (pdev->subordinate) {
>> - disable_bridges(pdev->subordinate);
>> - pci_disable_device(pdev);
>> + pdev = pci_scan_single_device(bus,
>> + PCI_DEVFN(slot->device, 0));
>> + if (!pdev)
>> + goto err_exit;
>> + if (pdev->multifunction == 1)
>> + num = 8;
>> + for (i=0; i<num; i++) {
>> + pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, i));
>> + if (pdev) {
>> + pci_stop_bus_device(pdev);
>> + if (pdev->subordinate) {
>> + disable_bridges(pdev->subordinate);
>> + pci_disable_device(pdev);
>> + }
>> + pci_remove_bus_device(pdev);
>> + pci_dev_put(pdev);
>> }
>> - pci_remove_bus_device(pdev);
>> - pci_dev_put(pdev);
>> }
>> }
>>
>> --
>> 1.7.6.1
>>
>> --
>> 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
>>
>
>
next prev parent reply other threads:[~2011-09-15 23:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1315976141-6684-1-git-send-email-akong@redhat.com>
2011-09-14 4:56 ` [PATCH] pci: clean all funcs when hot-removing multifunc device Amos Kong
2011-09-15 19:03 ` Bjorn Helgaas
2011-09-15 23:56 ` Kenji Kaneshige [this message]
2012-05-09 15:25 ` [PATCH v2] " Amos Kong
2012-05-09 15:25 ` [Qemu-devel] " Amos Kong
2012-05-10 15:44 ` [PATCH v3] " Amos Kong
2012-05-10 15:44 ` [Qemu-devel] " Amos Kong
2012-05-10 17:09 ` Jiang Liu
2012-05-10 17:09 ` [Qemu-devel] " Jiang Liu
2012-05-10 18:55 ` Michael S. Tsirkin
2012-05-10 18:55 ` [Qemu-devel] " Michael S. Tsirkin
2012-05-10 23:54 ` Amos Kong
2012-05-10 23:54 ` Amos Kong
2012-05-11 0:24 ` Amos Kong
2012-05-11 0:24 ` Amos Kong
2012-05-11 14:00 ` Jiang Liu
2012-05-16 15:26 ` Bjorn Helgaas
2012-05-16 15:26 ` Bjorn Helgaas
2012-05-20 2:31 ` [PATCH v4] " kongjianjun
2012-05-20 2:31 ` [Qemu-devel] " kongjianjun
2012-05-20 2:36 ` [Qemu-devel] [PATCH v3] " Amos Kong
2012-05-20 2:36 ` Amos Kong
2012-05-20 2:59 ` [PATCH v5] " kongjianjun
2012-05-20 2:59 ` [Qemu-devel] " kongjianjun
[not found] <4E7045C3.6040604@jp.fujitsu.com>
2011-09-14 8:13 ` [PATCH] " Amos Kong
2011-09-14 11:45 ` Amos Kong
2011-09-15 1:59 ` Kevin O'Connor
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=4E7290B0.1040801@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=akong@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=jbarnes@virtuousgeek.org \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=seabios@seabios.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.