xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: Tommi Airikka <tommi@airikka.net>,
	Ian Campbell <ian.campbell@citrix.com>,
	810379@bugs.debian.org, xen-devel@lists.xen.org
Subject: Re: [BUG] pci-passthrough generates "xen:events: Failed to obtain physical IRQ" for some devices
Date: Mon, 8 Feb 2016 23:59:27 -0500	[thread overview]
Message-ID: <20160209045927.GC3853@localhost.localdomain> (raw)
In-Reply-To: <20160208173917.GD24446@mail-itl>

On Mon, Feb 08, 2016 at 06:39:17PM +0100, Marek Marczykowski-Górecki wrote:
> On Wed, Feb 03, 2016 at 10:26:58AM -0500, Konrad Rzeszutek Wilk wrote:
> > On Wed, Feb 03, 2016 at 03:22:30PM +0100, Marek Marczykowski-Górecki wrote:
> > > On Mon, Feb 01, 2016 at 09:50:53AM -0500, Konrad Rzeszutek Wilk wrote:
> > > > > The second bullet looks at first pretty interesting from this PoV,
> > > > > see http://xenbits.xen.org/xsa/advisory-157.html for info on the XSA and
> > > > > the various patches. Konrad is on the CC already so hopefully he has some
> > > > > ideas.
> > > > 
> > > > Thanks. I will try to reproduce this with the upstream kernel first as
> > > > those patches are there.
> > > 
> > > According to one Qubes OS user report[1], the bug was introduced between
> > > version, which differs only by XSA-155 patches (including one for
> > > pciback), especially not XSA-157. 
> > > Maybe on some code path, some value is not copied back to pdev->sh_info->op?
> > 
> > I found two bugs (attached the draft not-compiled patches). Upstream
> > wise I seem to be tripping over another issue.
> > 
> > There is also some more work required in there to fix the MSI-x enable op.
> 
> What exactly do you have in mind here? That four patches in your next
> email? Or something not yet fixed?

I posted it at some point. It was that the MSI-X enable op stashes the
error value in op->value. But 'op->value' is an unsigned int so the
value ends up being 0xfffffe or such. And the other PV frontends only
check for !0 - and manufacture their own value (-EINVAL).

Hence I want to update the pciff.h .. Oh here is the patch:
Oh man. A year?!

Anyhow this can be posted as a cleanup patch seperately of the
bug-fixes.

commit 393be47782bca7a24d3e365448d4d3d1a303abfe
Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date:   Wed Apr 1 17:01:26 2015 -0400

    xen/pcifront/pciback: Update pciif.h with ->err and ->result values.
    
    The '->err' should contain only the XEN_PCI_ERR_* type values.
    The '->result' may contain -EXX values or any other value
    that the XEN_PCI_OP_* deems appropiate.
    
    As such update the header and also the implementations.
    
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    
    Conflicts:
    	drivers/xen/xen-pciback/pciback_ops.c
    
    Conflicts:
    	drivers/xen/xen-pciback/pciback_ops.c

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index b1ffebe..353c8a2 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -297,7 +297,7 @@ static int pci_frontend_enable_msix(struct pci_dev *dev,
 	} else {
 		dev_err(&dev->dev, "enable msix get err %x\n", err);
 	}
-	return err;
+	return err ? -EINVAL : 0;
 }
 
 static void pci_frontend_disable_msix(struct pci_dev *dev)
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index fa2b222..4db6c19 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -266,7 +266,7 @@ error:
 		pr_warn_ratelimited("%s: error enabling MSI-X for guest %u: err %d!\n",
 				    pci_name(dev), pdev->xdev->otherend_id,
 				    result);
-	return result > 0 ? 0 : result;
+	return result >= 0 ? 0 : XEN_PCI_ERR_op_failed;
 }
 
 #endif
diff --git a/include/xen/interface/io/pciif.h b/include/xen/interface/io/pciif.h
index d9922ae..c8b674f 100644
--- a/include/xen/interface/io/pciif.h
+++ b/include/xen/interface/io/pciif.h
@@ -70,7 +70,7 @@ struct xen_pci_op {
 	/* IN: what action to perform: XEN_PCI_OP_* */
 	uint32_t cmd;
 
-	/* OUT: will contain an error number (if any) from errno.h */
+	/* OUT: will contain an XEN_PCI_ERR_* number. */
 	int32_t err;
 
 	/* IN: which device to touch */
@@ -82,7 +82,9 @@ struct xen_pci_op {
 	int32_t offset;
 	int32_t size;
 
-	/* IN/OUT: Contains the result after a READ or the value to WRITE */
+	/* IN/OUT: Contains the result after a READ or the value to WRITE.
+	 * If the err does not have XEN_PCI_ERR_success, depending on
+	 * XEN_PCI_OP_* might have the errno value. */
 	uint32_t value;
 	/* IN: Contains extra infor for this operation */
 	uint32_t info;


> 
> -- 
> Best Regards,
> Marek Marczykowski-Górecki
> Invisible Things Lab
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?

  reply	other threads:[~2016-02-09  4:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANQMFx4YULqKctKZqeESesTQjLQun7rQ0ZjGzq96TXTtUw6VWA@mail.gmail.com>
2016-01-27 18:30 ` [BUG] pci-passthrough generates "xen:events: Failed to obtain physical IRQ" for some devices Konrad Rzeszutek Wilk
2016-01-30  2:13   ` Marek Marczykowski-Górecki
2016-01-30 13:18   ` Tommi Airikka
2016-02-01 10:43     ` Ian Campbell
2016-02-01 14:50       ` Konrad Rzeszutek Wilk
2016-02-03 14:22         ` Marek Marczykowski-Górecki
2016-02-03 15:26           ` Konrad Rzeszutek Wilk
2016-02-08 17:39             ` Marek Marczykowski-Górecki
2016-02-09  4:59               ` Konrad Rzeszutek Wilk [this message]
2016-02-03 20:28     ` Konrad Rzeszutek Wilk
2016-02-04  9:37       ` Ian Campbell
2016-02-04 23:35         ` Tommi Airikka
2016-02-12 21:36           ` Konrad Rzeszutek Wilk
2016-02-12 21:53             ` Tommi Airikka
2016-01-23 16:12 Tommi Airikka

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=20160209045927.GC3853@localhost.localdomain \
    --to=konrad.wilk@oracle.com \
    --cc=810379@bugs.debian.org \
    --cc=ian.campbell@citrix.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=tommi@airikka.net \
    --cc=xen-devel@lists.xen.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).