libqos: use microseconds instead of iterations for virtio timeout
commit70556264a89a268efba1d7e8e341adcdd7881eb4
authorStefan Hajnoczi <stefanha@redhat.com>
Mon, 29 Sep 2014 15:40:12 +0000 (29 16:40 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 29 Sep 2014 16:31:11 +0000 (29 17:31 +0100)
tree3c56c18b872bbd70bdd0471b2a7857c94f5922b1
parente8c81b4d8a5a2fd125e559cb02b8a87598419041
libqos: use microseconds instead of iterations for virtio timeout

Some hosts are slow or overloaded so test execution takes a long time.
Test cases use timeouts to protect against an infinite loop stalling the
test forever (especially important in automated test setups).

Commit 6cd14054b67774cc58a51fca6660cfa1d3c08059 ("libqos virtio:
Increase ISR timeout") increased the clock_step() value in an attempt to
lengthen the virtio interrupt wait timeout, but timeout failures are
still occuring on the Travis automated testing platform.

This is because clock_step() only affects the guest's virtual time.
Virtio requests can be bottlenecked on host disk I/O latency - which
cannot be improved by stepping the clock, so the fix was ineffective.

This patch changes the qvirtio_wait_queue_isr() and
qvirtio_wait_config_isr() timeout mechanism from loop iterations to
microseconds.  This way the test case can specify an absolute 30 second
timeout.  Number of loop iterations is not a reliable timeout mechanism
since the speed depends on many factors including host performance.

Tests should no longer timeout on overloaded Travis instances.

Cc: Marc MarĂ­ <marc.mari.barcelo@gmail.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
tests/libqos/virtio.c
tests/libqos/virtio.h
tests/virtio-blk-test.c