[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 68/69] libqos: Solve bug in interrupt checking when u
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 68/69] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c |
Date: |
Fri, 27 Feb 2015 18:19:06 +0000 |
From: Marc MarĂ <address@hidden>
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Ă <address@hidden>
Reviewed-by: John Snow <address@hidden>
Tested-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/libqos/virtio-pci.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 046a316..f9fb924 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -142,8 +142,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_PCI_ISR_STATUS) &
1;
@@ -162,8 +166,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_PCI_ISR_STATUS) &
2;
--
2.1.0
- [Qemu-devel] [PULL 57/69] qtest/ahci: Add PIO and LBA48 tests, (continued)
- [Qemu-devel] [PULL 57/69] qtest/ahci: Add PIO and LBA48 tests, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 59/69] qtest/ahci: add qcow2 support to ahci-test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 61/69] qtest/ahci: Add simple flush test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 62/69] qtest/ahci: Allow override of default CLI options, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 60/69] qtest/ahci: test different disk sectors, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 63/69] libqtest: add qmp_eventwait, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 64/69] libqtest: add qmp_async, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 65/69] libqos: add blkdebug_prepare_script, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 66/69] qtest/ahci: add flush retry test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 69/69] tests: Check QVIRTIO_F_ANY_LAYOUT flag in virtio-blk test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 68/69] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 67/69] sheepdog: fix confused return values, Stefan Hajnoczi, 2015/02/27
- Re: [Qemu-devel] [PULL 00/69] Block patches, Stefan Hajnoczi, 2015/02/27