qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests: use g_usleep instead of rem = sleep(time)

Relying on sleep to always return having slept isn't safe as a signal
may have occurred. If signals are constantly incoming the program will
never reach its termination condition. This is believed to be the
mechanism causing time outs for qht-test in Travis.

The glib g_usleep() deals with all of this for us so lets use it instead.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

+6 -12
+2 -4
tests/atomic64-bench.c
··· 74 74 75 75 static void run_test(void) 76 76 { 77 - unsigned int remaining; 78 77 unsigned int i; 79 78 80 79 while (atomic_read(&n_ready_threads) != n_threads) { 81 80 cpu_relax(); 82 81 } 82 + 83 83 atomic_set(&test_start, true); 84 - do { 85 - remaining = sleep(duration); 86 - } while (remaining); 84 + g_usleep(duration * G_USEC_PER_SEC); 87 85 atomic_set(&test_stop, true); 88 86 89 87 for (i = 0; i < n_threads; i++) {
+2 -4
tests/atomic_add-bench.c
··· 76 76 77 77 static void run_test(void) 78 78 { 79 - unsigned int remaining; 80 79 unsigned int i; 81 80 82 81 while (atomic_read(&n_ready_threads) != n_threads) { 83 82 cpu_relax(); 84 83 } 84 + 85 85 atomic_set(&test_start, true); 86 - do { 87 - remaining = sleep(duration); 88 - } while (remaining); 86 + g_usleep(duration * G_USEC_PER_SEC); 89 87 atomic_set(&test_stop, true); 90 88 91 89 for (i = 0; i < n_threads; i++) {
+2 -4
tests/qht-bench.c
··· 398 398 399 399 static void run_test(void) 400 400 { 401 - unsigned int remaining; 402 401 int i; 403 402 404 403 while (atomic_read(&n_ready_threads) != n_rw_threads + n_rz_threads) { 405 404 cpu_relax(); 406 405 } 406 + 407 407 atomic_set(&test_start, true); 408 - do { 409 - remaining = sleep(duration); 410 - } while (remaining); 408 + g_usleep(duration * G_USEC_PER_SEC); 411 409 atomic_set(&test_stop, true); 412 410 413 411 for (i = 0; i < n_rw_threads; i++) {