public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Thierry Reding <thierry.reding@gmail.com>,
	Bjorn Helgaas <helgaas@kernel.org>
Cc: Ding Tianhong <dingtianhong@huawei.com>,
	mark.rutland@arm.com, gabriele.paoloni@huawei.com,
	asit.k.mallick@intel.com, catalin.marinas@arm.com,
	will.deacon@arm.com, linuxarm@huawei.com,
	alexander.duyck@gmail.com, ashok.raj@intel.com,
	eric.dumazet@gmail.com, jeffrey.t.kirsher@intel.com,
	linux-pci@vger.kernel.org, ganeshgr@chelsio.com,
	Bob.Shaw@amd.com, leedom@chelsio.com, patrick.j.cramer@intel.com,
	bhelgaas@google.com, werner@chelsio.com,
	linux-arm-kernel@lists.infradead.org, amira@mellanox.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	David.Laight@aculab.com, Suravee.Suthikulpanit@amd.com,
	robin.murphy@arm.com, davem@davemloft.net,
	l.stach@pengutronix.de
Subject: Re: [PATCH net RESEND] PCI: fix oops when try to find Root Port for a PCI device
Date: Thu, 17 Aug 2017 15:12:58 +1000	[thread overview]
Message-ID: <87fucqsrol.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <20170816193303.GA14147@ulmo>

Thierry Reding <thierry.reding@gmail.com> writes:
...
>
> In case of Tegra, dev actually points to the root port. Now if I read
> the above code correctly, highest_pcie_bridge will still be NULL in that
> case, which in turn will return NULL from pci_find_pcie_root_port(). But
> shouldn't it really return dev?
>
> The patch that I used to fix the issue is this:
>
> --->8---
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 2c712dcfd37d..dd56c1c05614 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -514,7 +514,7 @@ EXPORT_SYMBOL(pci_find_resource);
>   */
>  struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
>  {
> -       struct pci_dev *bridge, *highest_pcie_bridge = NULL;
> +       struct pci_dev *bridge, *highest_pcie_bridge = dev;
>  
>         bridge = pci_upstream_bridge(dev);
>         while (bridge && pci_is_pcie(bridge)) {
> --->8---
>
> That works correctly if this function ends up being called on the PCIe
> root port, though perhaps that's not what this function is supposed to
> do. It's somewhat unclear from the kerneldoc what the function should
> be doing when called on a root port device itself.

That also works for me on powerpc (oops reported up thread).

cheers

      parent reply	other threads:[~2017-08-17  5:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 15:24 [PATCH net RESEND] PCI: fix oops when try to find Root Port for a PCI device Ding Tianhong
2017-08-15 17:03 ` Bjorn Helgaas
2017-08-16  0:26   ` David Miller
2017-08-16 19:33   ` Thierry Reding
2017-08-16 20:02     ` Bjorn Helgaas
2017-08-16 20:59       ` David Miller
2017-08-17  1:14         ` Ding Tianhong
2017-08-17  5:12     ` Michael Ellerman [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=87fucqsrol.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=Bob.Shaw@amd.com \
    --cc=David.Laight@aculab.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=alexander.duyck@gmail.com \
    --cc=amira@mellanox.com \
    --cc=ashok.raj@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=dingtianhong@huawei.com \
    --cc=eric.dumazet@gmail.com \
    --cc=gabriele.paoloni@huawei.com \
    --cc=ganeshgr@chelsio.com \
    --cc=helgaas@kernel.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=l.stach@pengutronix.de \
    --cc=leedom@chelsio.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=patrick.j.cramer@intel.com \
    --cc=robin.murphy@arm.com \
    --cc=thierry.reding@gmail.com \
    --cc=werner@chelsio.com \
    --cc=will.deacon@arm.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