For the record, the following commit fixes the issue for later kernels (>4.11). What we're seeing with the 4.4 kernel is most likely a different issue though.
commit ba74b6f7fcc07355d087af6939712eed4a454821 (refs/bisect/new)
Author: Christoph Hellwig <email address hidden>
Date: Thu Aug 24 18:07:02 2017 +0200
virtio_pci: fix cpu affinity support
Commit 0b0f9dc5 ("Revert "virtio_pci: use shared interrupts for
virtqueues"") removed the adjustment of the pre_vectors for the virtio
MSI-X vector allocation which was added in commit fb5e31d9 ("virtio:
allow drivers to request IRQ affinity when creating VQs"). This will
lead to an incorrect assignment of MSI-X vectors, and potential
deadlocks when offlining cpus.
Signed-off-by: Christoph Hellwig <email address hidden>
Fixes: 0b0f9dc5 ("Revert "virtio_pci: use shared interrupts for virtqueues")
Reported-by: YASUAKI ISHIMATSU <email address hidden>
Cc: <email address hidden>
Signed-off-by: Michael S. Tsirkin <email address hidden>
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index 007a4f366086..1c4797e53f68 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -107,6 +107,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
const char *name = dev_name(&vp_dev->vdev.dev);
+ unsigned flags = PCI_IRQ_MSIX;
unsigned i, v;
int err = -ENOMEM;
@@ -126,10 +127,13 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, GFP_KERNEL)) goto error;
For the record, the following commit fixes the issue for later kernels (>4.11). What we're seeing with the 4.4 kernel is most likely a different issue though.
commit ba74b6f7fcc0735 5d087af6939712e ed4a454821 (refs/bisect/new)
Author: Christoph Hellwig <email address hidden>
Date: Thu Aug 24 18:07:02 2017 +0200
virtio_pci: fix cpu affinity support
Commit 0b0f9dc5 ("Revert "virtio_pci: use shared interrupts for
virtqueues"") removed the adjustment of the pre_vectors for the virtio
MSI-X vector allocation which was added in commit fb5e31d9 ("virtio:
allow drivers to request IRQ affinity when creating VQs"). This will
lead to an incorrect assignment of MSI-X vectors, and potential
deadlocks when offlining cpus.
Signed-off-by: Christoph Hellwig <email address hidden>
Fixes: 0b0f9dc5 ("Revert "virtio_pci: use shared interrupts for virtqueues")
Reported-by: YASUAKI ISHIMATSU <email address hidden>
Cc: <email address hidden>
Signed-off-by: Michael S. Tsirkin <email address hidden>
diff --git a/drivers/ virtio/ virtio_ pci_common. c b/drivers/ virtio/ virtio_ pci_common. c .1c4797e53f68 100644 virtio/ virtio_ pci_common. c virtio/ virtio_ pci_common. c msix_vectors( struct virtio_device *vdev, int nvectors, &vp_dev- >vdev.dev) ;
index 007a4f366086.
--- a/drivers/
+++ b/drivers/
@@ -107,6 +107,7 @@ static int vp_request_
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
const char *name = dev_name(
+ unsigned flags = PCI_IRQ_MSIX;
unsigned i, v;
int err = -ENOMEM;
@@ -126,10 +127,13 @@ static int vp_request_ msix_vectors( struct virtio_device *vdev, int nvectors,
GFP_ KERNEL) )
goto error;
+ if (desc) { vectors+ +; /* virtio config vector */ irq_vectors_ affinity( vp_dev- >pci_dev, nvectors,
goto error;
vp_dev- >msix_enabled = 1;
+ flags |= PCI_IRQ_AFFINITY;
+ desc->pre_
+ }
+
err = pci_alloc_
- nvectors, PCI_IRQ_MSIX |
- (desc ? PCI_IRQ_AFFINITY : 0),
- desc);
+ nvectors, flags, desc);
if (err < 0)