linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: David Miller <davem@davemloft.net>
Cc: wangyijing@huawei.com, linux-pci@vger.kernel.org, mroos@linux.ee,
	sparclinux@vger.kernel.org, eric.snowberg@oracle.com,
	benh@kernel.crashing.org
Subject: Re: [PATCH] PCI/ASPM: Fix a NULL pointer crash on sparc64
Date: Thu, 20 Aug 2015 15:21:35 -0500	[thread overview]
Message-ID: <20150820202135.GA14810@google.com> (raw)
In-Reply-To: <20150820.114042.1327127338658980319.davem@davemloft.net>

On Thu, Aug 20, 2015 at 11:40:42AM -0700, David Miller wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> Date: Thu, 20 Aug 2015 11:23:43 -0700
> 
> > On Thu, Aug 20, 2015 at 10:47 AM, David Miller <davem@davemloft.net> wrote:
> >> From: Bjorn Helgaas <bhelgaas@google.com>
> >> Date: Thu, 20 Aug 2015 00:48:00 -0500
> >>
> >>> [+cc Dave, Eric, Ben, sparclinux]
> >>
> >> I think the comment is terrible.
> > 
> > I'll update the comment if you suggest some text.  Do you object
> > mainly to the mention of the specific systems?
> 
> "PCI root complex can not be assumed to be instantiated in the PCI bus
>  hierarchy."

AIUI, the root complex itself (as distinct from root ports) doesn't
normally appear in the PCI hierarchy, so I reworded it as follows.  I hope
this helps address your objection, but if not, I can try again.

    PCI: Tolerate hierarchies with no Root Port
    
    We should not assume any particular hardware topology.  Commit d0751b98dfa3
    ("PCI: Add dev->has_secondary_link to track downstream PCIe links") relied
    on the assumption that every PCIe hierarchy is rooted at a Root Port.  But
    we can't rely on any assumption about what hardware we will find; we just
    have to deal with the world as it is.
    
    On some platforms, PCIe devices (endpoints, switch upstream ports, etc.)
    appear directly on the root bus, and there is no Root Port in the PCI bus
    hierarchy.  For example, Meelis observed these top-level devices on a
    Sparc V245:
    
      0000:02:00.0 PCI bridge to [bus 03-0d]    Switch Upstream Port
      0001:02:00.0 PCI bridge to [bus 03]       PCIe to PCI/PCI-X Bridge
    
    These devices *look* like they have links going upstream, but there really
    are no upstream devices.
    
    In set_pcie_port_type(), we used the parent device to figure out which side
    of a switch port has a link, so if the parent device did not exist, we
    dereferenced a NULL parent pointer.
    
    Check whether the parent device exists before dereferencing it.
    
    Meelis observed this oops on Sparc V245 and T2000.  Ben Herrenschmidt says
    this is also possible on IBM PowerVM guests on PowerPC.

  reply	other threads:[~2015-08-20 20:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 10:47 [PATCH] PCI/ASPM: Fix a NULL pointer crash on sparc64 Yijing Wang
2015-08-18 18:49 ` Bjorn Helgaas
2015-08-18 19:10   ` David Miller
2015-08-19 22:16     ` Bjorn Helgaas
2015-08-19 22:29       ` Benjamin Herrenschmidt
2015-08-20  6:01         ` Bjorn Helgaas
2015-08-20  6:38           ` Benjamin Herrenschmidt
2015-08-20  6:44           ` Kjetil Oftedal
2015-08-20 17:51             ` David Miller
2015-08-20 17:50           ` David Miller
2015-08-20  5:48 ` Bjorn Helgaas
2015-08-20 17:47   ` David Miller
2015-08-20 18:23     ` Bjorn Helgaas
2015-08-20 18:40       ` David Miller
2015-08-20 20:21         ` Bjorn Helgaas [this message]
2015-08-20 20:58           ` David Miller
2015-08-20 21:21             ` Bjorn Helgaas
2015-08-20 21:38               ` David Miller
2015-08-21  1:48               ` wangyijing

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=20150820202135.GA14810@google.com \
    --to=bhelgaas@google.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=eric.snowberg@oracle.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=sparclinux@vger.kernel.org \
    --cc=wangyijing@huawei.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).