mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Sander Eikelenboom <linux@eikelenboom.it>
Cc: david.vrabel@citrix.com, xen-devel@lists.xenproject.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Xen-devel] Regression due to "device property: Make it possible to use secondary firmware nodes" Re: Xen-unstable + linux 4.1-mergewindow: problems with PV guest pci passthrough: pcifront pci-0: pciback not responding!!!
Date: Tue, 26 May 2015 01:42:16 +0200	[thread overview]
Message-ID: <2059136.yfbqz351P1@vostro.rjw.lan> (raw)
In-Reply-To: <1768370.Rs1vKzEP4D@vostro.rjw.lan>

On Tuesday, May 26, 2015 01:22:12 AM Rafael J. Wysocki wrote:
> On Friday, May 22, 2015 09:53:37 PM Boris Ostrovsky wrote:
> > On 05/22/2015 04:11 AM, Sander Eikelenboom wrote:
> > > Hello Sander,
> > >

[cut]

> > (+Rafael again)
> > 
> > So the immediate cause of those errors is that pdev->evtchn is 0. 
> > Backend is not notified and things not go well then.
> > 
> > And it is indeed caused by 97badf873ab60e841243b66133ff9eff2a46ef29:
> > 
> > We allocate pcifront_sd in pcifront_scan_root() and then pass it to 
> > pci_scan_bus_parented() as sysdata. Eventually this sysdata is used in 
> > pcibios_root_bridge_prepare() as pci_sysdata. It is dereferenced as 
> > pci_sysdata->companion (which I believe is aliased to pcifront_sd->pdev)

Well, there is an int node field between them, so I'm not sure.

> > and then set_primary_fwnode() writes it, thus corrupting 
> > pcifront_sd->pdev (and I think this is what sets evtchn to zero).

So the corruption happens when set_primary_fwnode() writes NULL to the
'secondary' field of object pointed to by 'fwnode'.

This isn't strictly necessary and we might avoid the crash by only
writing to fwnode->secondary if fn is not NULL.

So, Sander please test the patch below too if possible.

Of course, that doesn't solve a problem of passing an incorrect pointer
to ACPI_COMPANION_SET() in pcibios_root_bridge_prepare().

---
 drivers/base/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-pm/drivers/base/core.c
===================================================================
--- linux-pm.orig/drivers/base/core.c
+++ linux-pm/drivers/base/core.c
@@ -2167,7 +2167,9 @@ void set_primary_fwnode(struct device *d
 		if (fwnode_is_primary(fn))
 			fn = fn->secondary;
 
-		fwnode->secondary = fn;
+		if (fn)
+			fwnode->secondary = fn;
+
 		dev->fwnode = fwnode;
 	} else {
 		dev->fwnode = fwnode_is_primary(dev->fwnode) ?


  reply	other threads:[~2015-05-25 23:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-23  1:53 Boris Ostrovsky
2015-05-23  7:58 ` Sander Eikelenboom
2015-05-25 23:22 ` Rafael J. Wysocki
2015-05-25 23:42   ` Rafael J. Wysocki [this message]
2015-05-26  1:08     ` Rafael J. Wysocki
2015-05-26  2:17       ` [PATCH] PCI / ACPI: Do not set ACPI companions for host bridges with parents Rafael J. Wysocki
2015-05-26  7:53         ` Sander Eikelenboom
2015-05-26 14:32         ` Boris Ostrovsky
2015-05-27  0:07           ` Rafael J. Wysocki
2015-05-27  2:15             ` Boris Ostrovsky
2015-05-27 22:58         ` Bjorn Helgaas
2015-05-27 23:18           ` Rafael J. Wysocki

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=2059136.yfbqz351P1@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@eikelenboom.it \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®