diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-14 08:53:56 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-14 08:53:56 +0100 |
commit | ce0347c2b089eb6ad6c14ab628a0ba5eb42f1492 (patch) | |
tree | ac46f6168ebf7d44e33903f35f699cda2ec21ace /tools/virtio/ringtest/main.c | |
parent | abbdc56b17d662ae710bc0c30cf0d0e9da805fd4 (diff) | |
parent | a25f0944ba9b1d8a6813fd6f1a86f1bd59ac25a6 (diff) | |
download | linux-ce0347c2b089eb6ad6c14ab628a0ba5eb42f1492.tar.bz2 |
Merge 4.9-rc5 into staging-next
We want the staging/iio fixes in here as well to resolve issues and
merge problems.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/virtio/ringtest/main.c')
-rw-r--r-- | tools/virtio/ringtest/main.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c index 147abb452a6c..f31353fac541 100644 --- a/tools/virtio/ringtest/main.c +++ b/tools/virtio/ringtest/main.c @@ -96,7 +96,13 @@ void set_affinity(const char *arg) assert(!ret); } -static void run_guest(void) +void poll_used(void) +{ + while (used_empty()) + busy_wait(); +} + +static void __attribute__((__flatten__)) run_guest(void) { int completed_before; int completed = 0; @@ -141,7 +147,7 @@ static void run_guest(void) assert(completed <= bufs); assert(started <= bufs); if (do_sleep) { - if (enable_call()) + if (used_empty() && enable_call()) wait_for_call(); } else { poll_used(); @@ -149,7 +155,13 @@ static void run_guest(void) } } -static void run_host(void) +void poll_avail(void) +{ + while (avail_empty()) + busy_wait(); +} + +static void __attribute__((__flatten__)) run_host(void) { int completed_before; int completed = 0; @@ -160,7 +172,7 @@ static void run_host(void) for (;;) { if (do_sleep) { - if (enable_kick()) + if (avail_empty() && enable_kick()) wait_for_kick(); } else { poll_avail(); |