From patchwork Tue Feb 9 04:59:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8258431 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 73ACDBEEE5 for ; Tue, 9 Feb 2016 05:03:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72E9A20270 for ; Tue, 9 Feb 2016 05:03:15 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7322E2026D for ; Tue, 9 Feb 2016 05:03:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aT0P1-0003eb-M5; Tue, 09 Feb 2016 04:59:51 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aT0P0-0003eW-08 for xen-devel@lists.xen.org; Tue, 09 Feb 2016 04:59:50 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 0A/55-09708-54279B65; Tue, 09 Feb 2016 04:59:49 +0000 X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-11.tower-21.messagelabs.com!1454993987!14682977!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9515 invoked from network); 9 Feb 2016 04:59:48 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-11.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Feb 2016 04:59:48 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u194xUjT031612 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Feb 2016 04:59:30 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u194xTWX014182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 9 Feb 2016 04:59:30 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u194xREj031653; Tue, 9 Feb 2016 04:59:28 GMT Received: from localhost.localdomain (/74.87.24.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 08 Feb 2016 20:59:27 -0800 Date: Mon, 8 Feb 2016 23:59:27 -0500 From: Konrad Rzeszutek Wilk To: Marek =?iso-8859-1?Q?Marczykowski-G=F3recki?= Message-ID: <20160209045927.GC3853@localhost.localdomain> References: <20160127183005.GB3134@char.us.oracle.com> <1454323426.28781.73.camel@citrix.com> <20160201145053.GA21826@char.us.oracle.com> <20160203142230.GC24446@mail-itl> <20160203152657.GE20732@char.us.oracle.com> <20160208173917.GD24446@mail-itl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160208173917.GD24446@mail-itl> User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Tommi Airikka , Ian Campbell , 810379@bugs.debian.org, xen-devel@lists.xen.org Subject: Re: [Xen-devel] [BUG] pci-passthrough generates "xen:events: Failed to obtain physical IRQ" for some devices X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 Conflicts: drivers/xen/xen-pciback/pciback_ops.c Conflicts: drivers/xen/xen-pciback/pciback_ops.c > > -- > 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? 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;