diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-06 09:39:11 (GMT) |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-10-30 22:21:43 (GMT) |
commit | d3c3589b8b3cd4fabf4cd137facb42a7fb36bd7f (patch) | |
tree | d71957ed6843a84c8328587604b9bdfe84363094 /tools/virtio/ringtest/main.c | |
parent | 44d65ea1615099ae252407f2554338d450cfdb1c (diff) | |
download | linux-d3c3589b8b3cd4fabf4cd137facb42a7fb36bd7f.tar.xz |
ringtest: commonize implementation of poll_avail/poll_used
Provide new primitives used_empty/avail_empty and
build poll_avail/poll_used on top of it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tools/virtio/ringtest/main.c')
-rw-r--r-- | tools/virtio/ringtest/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/virtio/ringtest/main.c b/tools/virtio/ringtest/main.c index bda7f0d..b00ecd6 100644 --- a/tools/virtio/ringtest/main.c +++ b/tools/virtio/ringtest/main.c @@ -96,6 +96,12 @@ void set_affinity(const char *arg) assert(!ret); } +void poll_used(void) +{ + while (used_empty()) + busy_wait(); +} + static void __attribute__((__flatten__)) run_guest(void) { int completed_before; @@ -149,6 +155,12 @@ static void __attribute__((__flatten__)) run_guest(void) } } +void poll_avail(void) +{ + while (avail_empty()) + busy_wait(); +} + static void __attribute__((__flatten__)) run_host(void) { int completed_before; |