From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Jon Derrick <jonathan.derrick@intel.com>
Cc: linux-pci@vger.kernel.org, Bjorn Helgaas <helgaas@kernel.org>,
Keith Busch <keith.busch@intel.com>
Subject: Re: [PATCH 1/2] PCI/VMD: Detach resources after stopping root bus
Date: Thu, 18 Oct 2018 17:43:40 +0100 [thread overview]
Message-ID: <20181018164340.GA32306@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <1539650888-3792-2-git-send-email-jonathan.derrick@intel.com>
On Mon, Oct 15, 2018 at 06:48:07PM -0600, Jon Derrick wrote:
> The VMD removal path calls pci_stop_root_bus, which tears down the pcie
> tree, including detaching all of the attached drivers. During driver
> detachment, devices may use pci_release_region to release resources.
> This path relies on the resource being accessible in resource tree.
>
> By detaching the child domain from the parent resource domain prior to
> stopping the bus, we are preventing the list traversal from finding the
> resource to be freed. If we instead detach the resource after stopping
> the bus, we will have properly freed the resource and detaching is
> simply accounting at that point.
>
> Without this order, the resource is never freed and is orphaned on VMD
> removal, leading to warning:
> [ 181.940162] Trying to free nonexistent resource <e5a10000-e5a13fff>
>
> Fixes 2c2c5c5cd213aea38c850bb6edc9b7f77f29802f:
> "x86/PCI: VMD: Attach VMD resources to parent domain's resource tree"
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> ---
> drivers/pci/controller/vmd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I have applied this patch to pci/vmd for v4.20, thanks.
Lorenzo
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index fd2dbd7..46ed80f 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -813,12 +813,12 @@ static void vmd_remove(struct pci_dev *dev)
> {
> struct vmd_dev *vmd = pci_get_drvdata(dev);
>
> - vmd_detach_resources(vmd);
> sysfs_remove_link(&vmd->dev->dev.kobj, "domain");
> pci_stop_root_bus(vmd->bus);
> pci_remove_root_bus(vmd->bus);
> vmd_cleanup_srcu(vmd);
> vmd_teardown_dma_ops(vmd);
> + vmd_detach_resources(vmd);
> irq_domain_remove(vmd->irq_domain);
> }
>
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2018-10-18 16:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 0:48 [PATCH 0/2] VMD fixes for 4.20 Jon Derrick
2018-10-16 0:48 ` [PATCH 1/2] PCI/VMD: Detach resources after stopping root bus Jon Derrick
2018-10-16 14:48 ` Keith Busch
2018-10-18 16:43 ` Lorenzo Pieralisi [this message]
2018-10-16 0:48 ` [PATCH 2/2] PCI/VMD: Set up firmware-first if capable Jon Derrick
2018-10-16 2:25 ` kbuild test robot
2018-10-17 14:12 ` Lorenzo Pieralisi
2018-10-17 18:16 ` Derrick, Jonathan
2018-10-17 23:01 ` Bjorn Helgaas
-- strict thread matches above, loose matches on Subject: below --
2018-09-05 1:09 [PATCH 1/2] PCI/VMD: Detach resources after stopping root bus Jon Derrick
2018-10-02 9:44 ` Lorenzo Pieralisi
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=20181018164340.GA32306@e107981-ln.cambridge.arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=helgaas@kernel.org \
--cc=jonathan.derrick@intel.com \
--cc=keith.busch@intel.com \
--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 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).