diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2014-09-29 16:40:11 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-09-29 17:31:08 +0100 |
commit | e8c81b4d8a5a2fd125e559cb02b8a87598419041 (patch) | |
tree | a7fc7c59c24b280e203d4b5b1694c5df1c770aa4 /tests/libqos/virtio.h | |
parent | ed9114356b587b362f5ed10e75366a4f07ed32af (diff) |
libqos: improve event_index test with timeout
The virtio event_index feature lets the device driver tell the device
how many requests to process before raising the next interrupt.
virtio-blk-test.c tries to verify that the device does not raise an
interrupt unnecessarily.
Unfortunately the test has a race condition. It spins checking for an
interrupt up to 100 times and then assumes the request has finished. On
a slow host the I/O request could still be in flight and the test would
fail.
This patch waits for the request to complete, or until a 30-second
timeout is reached. If an interrupt is raised while waiting the test
fails since the device was not supposed to raise interrupts.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/libqos/virtio.h')
-rw-r--r-- | tests/libqos/virtio.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 70b3376360..bc7518e880 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -162,6 +162,11 @@ void qvirtio_set_driver_ok(const QVirtioBus *bus, QVirtioDevice *d); bool qvirtio_wait_queue_isr(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq, uint64_t timeout); +uint8_t qvirtio_wait_status_byte_no_isr(const QVirtioBus *bus, + QVirtioDevice *d, + QVirtQueue *vq, + uint64_t addr, + gint64 timeout_us); bool qvirtio_wait_config_isr(const QVirtioBus *bus, QVirtioDevice *d, uint64_t timeout); QVirtQueue *qvirtqueue_setup(const QVirtioBus *bus, QVirtioDevice *d, |