From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: aik@au1.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform
Date: Tue, 22 Apr 2014 15:44:37 +0800 [thread overview]
Message-ID: <20140422074437.GB6431@richard> (raw)
In-Reply-To: <20140421233423.GA4023@shangw>
On Tue, Apr 22, 2014 at 09:34:23AM +1000, Gavin Shan wrote:
>On Mon, Apr 21, 2014 at 10:25:18AM +0800, Wei Yang wrote:
>>When pcibios_remove_pci_devices() is removing pci devices, it will release
>>pci device respectively. When the refcount of the device is 0, the pci_dev
>>structure will be destroyed.
>>
>>On PowerNV platform, the pci_dev will not be destroyed since the refcount is
>>not 0.
>>
>
>Richard, the above description is true. However, it's not relevant to the
>issue (backtrace). I don't quite understand the scenario you had. You're
>doing hotplug on VFs or PF? I guess it would be full-hotplug instead of
>partial hotplug.
I am doing hotplug on PF.
>
>It seems that the IOMMU group wasn't detached correctly and then we tried
>to attach it again. Or the IOMMU group was attached for towice? :-)
Did more tests and find it is a little out of expectation. The conclusion is:
1. The iommu group is detached correctly,
2. The iommu group is attached three times
3. The warning is cleared based on the first patch instead of this one.
The three times to attach the iommu_group is:
pci_device_add
...
set_iommu_table_base_and_group <- 1st time, fail
device_add
...
tce_iommu_bus_notifier <- 2nd time, succees
pcibios_add_pci_devices
...
pcibios_setup_bus_devices <- 3rd time, re-attach
The error in patch 1 happens at the first time, since the dev->kobj->sd is not
initialized.
The warning in patch 2 happens at the 3rd time, since iommu group is already
attached in the 2nd time.
So this patch(the 2nd one) doesn't contribute to clear the warning and error.
Only the first patch did it. Please ignore this one.
>
>The IOMMU group is expected to be detached like this, please investigate
>for more why it wasn't detached correctly.
>
>pcibios_remove_pci_devices()
>pci_stop_and_remove_bus_device()
>pci_remove_bus_device()
>pci_destroy_dev()
>
>static void pci_destroy_dev(struct pci_dev *dev)
>{
> if (!dev->dev.kobj.parent)
> return;
>
> device_del(&dev->dev); /* It's calling iommu_del_device() */
>
> down_write(&pci_bus_sem);
> list_del(&dev->bus_list);
> up_write(&pci_bus_sem);
>
> pci_free_resources(dev);
> put_device(&dev->dev); /* It's calling pcibios_release_device() */
>}
>
--
Richard Yang
Help you, Help me
next prev parent reply other threads:[~2014-04-22 7:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 2:25 [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform Wei Yang
2014-04-21 2:25 ` [PATCH 2/2] powerpc/powernc: revert part of commit d905c5df(PPC: POWERNV: move iommu_add_device earlier) Wei Yang
2014-04-21 3:37 ` Benjamin Herrenschmidt
2014-04-21 5:22 ` Wei Yang
2014-04-21 6:11 ` Wei Yang
2014-04-21 3:35 ` [PATCH 1/2] powerpc/powernv: clear the refcount for pci_dev on powernv platform Benjamin Herrenschmidt
2014-04-21 6:03 ` Wei Yang
2014-04-21 23:34 ` Gavin Shan
2014-04-22 7:44 ` Wei Yang [this message]
2014-04-22 8:25 ` Benjamin Herrenschmidt
2014-04-22 9:44 ` Wei Yang
2014-04-22 23:00 ` Gavin Shan
2014-04-23 0:26 ` Benjamin Herrenschmidt
2014-04-23 1:56 ` Wei Yang
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=20140422074437.GB6431@richard \
--to=weiyang@linux.vnet.ibm.com \
--cc=aik@au1.ibm.com \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).