xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Tommi Airikka <tommi@airikka.net>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	david.vrabel@citrix.com, boris.ostrovsky@oracle.com
Cc: stable@vger.kernel.org, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 2/4] xen/pciback: Save the number of MSI-X entries to be copied later.
Date: Thu, 11 Feb 2016 16:10:24 -0500	[thread overview]
Message-ID: <1455225026-25792-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1455225026-25792-1-git-send-email-konrad.wilk@oracle.com>

c/s  8135cf8b092723dbfcc611fe6fdcb3a36c9951c5
"xen/pciback: Save xen_pci_op commands before processing it"
would copyback the processed values - which was great.

However it missed the case that xen_pcibk_enable_msix - when
completing would overwrite op->value (which had the number
of MSI-X vectors requested) with the return value (which for
success was zero). Hence the copy-back routine (which would use
op->value) would copy exactly zero MSI-X vectors back.

CC: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/xen/xen-pciback/pciback_ops.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index 8c86a53..2fc5880 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -335,7 +335,9 @@ void xen_pcibk_do_op(struct work_struct *data)
 	struct xen_pcibk_dev_data *dev_data = NULL;
 	struct xen_pci_op *op = &pdev->op;
 	int test_intx = 0;
-
+#ifdef CONFIG_PCI_MSI
+	unsigned int nr = 0;
+#endif
 	*op = pdev->sh_info->op;
 	barrier();
 	dev = xen_pcibk_get_pci_dev(pdev, op->domain, op->bus, op->devfn);
@@ -363,6 +365,7 @@ void xen_pcibk_do_op(struct work_struct *data)
 			op->err = xen_pcibk_disable_msi(pdev, dev, op);
 			break;
 		case XEN_PCI_OP_enable_msix:
+			nr = op->value;
 			op->err = xen_pcibk_enable_msix(pdev, dev, op);
 			break;
 		case XEN_PCI_OP_disable_msix:
@@ -385,7 +388,7 @@ void xen_pcibk_do_op(struct work_struct *data)
 	if (op->cmd == XEN_PCI_OP_enable_msix && op->err == 0) {
 		unsigned int i;
 
-		for (i = 0; i < op->value; i++)
+		for (i = 0; i < nr; i++)
 			pdev->sh_info->op.msix_entries[i].vector =
 				op->msix_entries[i].vector;
 	}
-- 
2.1.0

  parent reply	other threads:[~2016-02-11 21:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 21:10 [PATCH] Fixes to Xen pcifront and pciback (v1) Konrad Rzeszutek Wilk
2016-02-11 21:10 ` [PATCH 1/4] xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY Konrad Rzeszutek Wilk
2016-02-12  9:19   ` Jan Beulich
2016-02-11 21:10 ` Konrad Rzeszutek Wilk [this message]
2016-02-12  9:25   ` [PATCH 2/4] xen/pciback: Save the number of MSI-X entries to be copied later Jan Beulich
2016-02-11 21:10 ` [PATCH 3/4] xen/pcifront: Report the errors better Konrad Rzeszutek Wilk
2016-02-11 21:10 ` [PATCH 4/4] xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted Konrad Rzeszutek Wilk
2016-02-14  1:23   ` Boris Ostrovsky
     [not found]   ` <56BFD702.9010708@oracle.com>
2016-02-15 14:05     ` Konrad Rzeszutek Wilk
2016-02-15 14:37       ` Boris Ostrovsky
2016-02-15 14:27   ` David Vrabel
2016-02-15 14:35 ` [PATCH] Fixes to Xen pcifront and pciback (v1) David Vrabel
     [not found] ` <56C1E24C.5040704@citrix.com>
2016-02-15 14:38   ` David Vrabel
     [not found]   ` <56C1E2DE.7030507@citrix.com>
2016-02-15 15:35     ` Konrad Rzeszutek Wilk

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=1455225026-25792-3-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tommi@airikka.net \
    --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;
as well as URLs for NNTP newsgroup(s).