From: Bjorn Helgaas <helgaas@kernel.org>
To: jakeo@microsoft.com
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
gregkh@linuxfoundation.org, kys@microsoft.com,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com,
tglx@linutronix.de, haiyangz@microsoft.com, marc.zyngier@arm.com,
haddenh@microsoft.com
Subject: Re: [PATCH] PCI: Remove usage of pci_domain_nr when the PCI bus doesn't yet exist
Date: Thu, 25 Feb 2016 09:10:40 -0600 [thread overview]
Message-ID: <20160225151040.GB23155@localhost> (raw)
In-Reply-To: <1456340196-13717-1-git-send-email-jakeo@microsoft.com>
On Wed, Feb 24, 2016 at 06:56:36PM +0000, jakeo@microsoft.com wrote:
> From: Jake Oshins <jakeo@microsoft.com>
>
> This patch fixes a race condition in this driver. Using the
> function pci_domain_nr() only works if the PCI bus has already
> been fully created. This patch just deletes one call site,
> as it was in debug prints which aren't strictly necessary.
> Another call site is changed to look for the data in the same
> structure that is passed in when creating the PCI bus in the
> first place.
>
> Signed-off-by: Jake Oshins <jakeo@microsoft.com>
I folded this into the original "Add paravirtual PCI front-end for
Microsoft Hyper-V VMs" patch and updated the pci/host-hv branch.
Thanks, Jake!
> ---
> drivers/pci/host/pci-hyperv.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index 9391dee..ed651ba 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -1265,11 +1265,6 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus,
> if (!hpdev)
> return NULL;
>
> - dev_info(&hbus->hdev->device,
> - "New child device (%p) [%04x:%04x] at %04x:00:00.%02x\n",
> - hpdev, desc->v_id, desc->d_id, pci_domain_nr(hbus->pci_bus),
> - desc->win_slot.bits.func);
> -
> hpdev->hbus = hbus;
>
> memset(&pkt, 0, sizeof(pkt));
> @@ -1558,9 +1553,15 @@ static void hv_eject_device_work(struct work_struct *work)
> return;
> }
>
> + /*
> + * Ejection can come before or after the PCI bus has been set up, so
> + * attempt to find it and tear down the bus state, if it exists. This
> + * must be done without constructs like pci_domain_nr(hbus->pci_bus)
> + * because hbus->pci_bus may not exist yet.
> + */
> wslot = wslot_to_devfn(hpdev->desc.win_slot.slot);
> - pdev = pci_get_domain_bus_and_slot(pci_domain_nr(hpdev->hbus->pci_bus),
> - 0, wslot);
> + pdev = pci_get_domain_bus_and_slot(hpdev->hbus->sysdata.domain, 0,
> + wslot);
> if (pdev) {
> pci_stop_and_remove_bus_device(pdev);
> pci_dev_put(pdev);
> --
> 1.9.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
prev parent reply other threads:[~2016-02-25 15:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 18:56 [PATCH] PCI: Remove usage of pci_domain_nr when the PCI bus doesn't yet exist jakeo
2016-02-25 15:10 ` Bjorn Helgaas [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=20160225151040.GB23155@localhost \
--to=helgaas@kernel.org \
--cc=apw@canonical.com \
--cc=bhelgaas@google.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=haddenh@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jakeo@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=olaf@aepfle.de \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
/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).