libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c
PATCH 1/1 libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c
The MSIX interrupt was always acked without checking its value, which caused a race condition. If the ISR was raised between the read and the acking, the ISR was never detected and it timed out.
--- tests/libqos/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
tests/libqos/virtio-pci.c +12 -4
@@ -140,8 +140,12 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)return qpci_msix_pending (dev->pdev, vqpci->msix_entry); }else { data =readl (vqpci->msix_addr); -writel (vqpci->msix_addr,0 ); -return data == vqpci->msix_data; +if (data == vqpci->msix_data) { +writel (vqpci->msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb (dev->pdev, dev->addr +QVIRTIO_ISR_STATUS ) &1 ;
@@ -160,8 +164,12 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)return qpci_msix_pending (dev->pdev, dev->config_msix_entry); }else { data =readl (dev->config_msix_addr); -writel (dev->config_msix_addr,0 ); -return data == dev->config_msix_data; +if (data == dev->config_msix_data) { +writel (dev->config_msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb (dev->pdev, dev->addr +QVIRTIO_ISR_STATUS ) &2 ;
Signature · 1 line
1.7.10.4
Quoted 34 lines · Marc Marí
The MSIX interrupt was always acked without checking its value, which caused a race condition. If the ISR was raised between the read and the acking, the ISR was never detected and it timed out.
Signed-off-by Marc Marí <[email protected]>--- tests/libqos/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)tests/libqos/virtio-pci.c +6
-3@@ -140,8 +140,12 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)return qpci_msix_pending (dev->pdev, vqpci->msix_entry); }else { data =readl (vqpci->msix_addr); -writel (vqpci->msix_addr,0 ); -return data == vqpci->msix_data; +if (data == vqpci->msix_data) { +writel (vqpci->msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb (dev->pdev, dev->addr +QVIRTIO_ISR_STATUS ) &1 ;@@ -160,8 +164,12 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)return qpci_msix_pending (dev->pdev, dev->config_msix_entry); }else { data =readl (dev->config_msix_addr); -writel (dev->config_msix_addr,0 );
tests/libqos/virtio-pci.c static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) · line 175
Quoted 10 lines
tests/libqos/virtio-pci.c +6
-1-return data == dev->config_msix_data; +if (data == dev->config_msix_data) { +writel (dev->config_msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb (dev->pdev, dev->addr +QVIRTIO_ISR_STATUS ) &2 ;
1,600+ runs and no hang, thanks :)
Quoted 57 lines · John Snow
Quoted 49 lines · Marc Marí
The MSIX interrupt was always acked without checking its value, which caused a
race condition. If the ISR was raised between the read and the acking, the ISR
was never detected and it timed out.Signed-off-by Marc Marí <[email protected]>--- tests/libqos/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)tests/libqos/virtio-pci.c +6
-2@@ -140,8 +140,12 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)return qpci_msix_pending (dev->pdev, vqpci->msix_entry); }else { data =readl (vqpci->msix_addr); -writel (vqpci->msix_addr,0 ); -return data == vqpci->msix_data; +if (data == vqpci->msix_data) { +writel (vqpci->msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb(dev->pdev, dev->addr +
QVIRTIO_ISR_STATUS) & 1;tests/libqos/virtio-pci.c +6
-2@@ -160,8 +164,12 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)return qpci_msix_pending (dev->pdev, dev->config_msix_entry); }else { data =readl (dev->config_msix_addr); -writel (dev->config_msix_addr,0 ); -return data == dev->config_msix_data; +if (data == dev->config_msix_data) { +writel (dev->config_msix_addr,0 ); +return true; + }else { +return false; + } }} else { return qpci_io_readb(dev->pdev, dev->addr +Quoted 2 lines
QVIRTIO_ISR_STATUS) & 2;1,600+ runs and no hang, thanks :)
Quoted 3 lines
Tested-by John Snow <[email protected]>Reviewed-by John Snow <[email protected]>
Ping?
Still hitting this failure upstream.
Quoted 60 lines · El Tue, 10 Mar 2015 16:50:48 -0400 John Snow <[email protected]> escribió:
Quoted 57 lines · John Snow
Quoted 49 lines · Marc Marí
The MSIX interrupt was always acked without checking its value, which caused a
race condition. If the ISR was raised between the read and the acking, the ISR
was never detected and it timed out.Signed-off-by Marc Marí <[email protected]>--- tests/libqos/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)tests/libqos/virtio-pci.c +6
-2@@ -140,8 +140,12 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)return qpci_msix_pending (dev->pdev, vqpci->msix_entry); }else { data =readl (vqpci->msix_addr); -writel (vqpci->msix_addr,0 ); -return data == vqpci->msix_data; +if (data == vqpci->msix_data) { +writel (vqpci->msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb(dev->pdev, dev->addr +
QVIRTIO_ISR_STATUS) & 1;tests/libqos/virtio-pci.c +6
-2@@ -160,8 +164,12 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)return qpci_msix_pending (dev->pdev, dev->config_msix_entry); }else { data =readl (dev->config_msix_addr); -writel (dev->config_msix_addr,0 ); -return data == dev->config_msix_data; +if (data == dev->config_msix_data) { +writel (dev->config_msix_addr,0 ); +return true; + }else { +return false; + } }} else { return qpci_io_readb(dev->pdev, dev->addr +Quoted 2 lines
QVIRTIO_ISR_STATUS) & 2;1,600+ runs and no hang, thanks :)
Quoted 7 lines
Quoted 3 lines
Tested-by John Snow <[email protected]>Reviewed-by John Snow <[email protected]>Ping?
Still hitting this failure upstream.
I think this is in Stefan's pull request, which has issues merging.
Marc
Am 10.03.2015 um 21:50 schrieb John Snow:
Quoted 56 lines · John Snow
Quoted 55 lines · Marc Marí
Quoted 49 lines
The MSIX interrupt was always acked without checking its value, which caused a
race condition. If the ISR was raised between the read and the acking, the ISR
was never detected and it timed out.Signed-off-by Marc Marí <[email protected]>--- tests/libqos/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)tests/libqos/virtio-pci.c +6
-2@@ -140,8 +140,12 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)return qpci_msix_pending (dev->pdev, vqpci->msix_entry); }else { data =readl (vqpci->msix_addr); -writel (vqpci->msix_addr,0 ); -return data == vqpci->msix_data; +if (data == vqpci->msix_data) { +writel (vqpci->msix_addr,0 ); +return true; + }else { +return false; + } } }else {return qpci_io_readb(dev->pdev, dev->addr +
QVIRTIO_ISR_STATUS) & 1;tests/libqos/virtio-pci.c +6
-2@@ -160,8 +164,12 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)return qpci_msix_pending (dev->pdev, dev->config_msix_entry); }else { data =readl (dev->config_msix_addr); -writel (dev->config_msix_addr,0 ); -return data == dev->config_msix_data; +if (data == dev->config_msix_data) { +writel (dev->config_msix_addr,0 ); +return true; + }else { +return false; + } }} else { return qpci_io_readb(dev->pdev, dev->addr +Quoted 2 lines
QVIRTIO_ISR_STATUS) & 2;1,600+ runs and no hang, thanks :)
Quoted 7 lines
Quoted 3 lines
Tested-by John Snow <[email protected]>Reviewed-by John Snow <[email protected]>Ping?
Still hitting this failure upstream.
CC'ing the PCI/virtio maintainer might help. ;)
Cheers,
Andreas
Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton; HRB 21284 (AG Nürnberg)