projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'gcc-plugins-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git]
/
tools
/
virtio
/
ringtest
/
main.c
diff --git
a/tools/virtio/ringtest/main.c
b/tools/virtio/ringtest/main.c
index
147abb4
..
f31353f
100644
(file)
--- a/
tools/virtio/ringtest/main.c
+++ b/
tools/virtio/ringtest/main.c
@@
-96,7
+96,13
@@
void set_affinity(const char *arg)
assert(!ret);
}
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;
{
int completed_before;
int completed = 0;
@@
-141,7
+147,7
@@
static void run_guest(void)
assert(completed <= bufs);
assert(started <= bufs);
if (do_sleep) {
assert(completed <= bufs);
assert(started <= bufs);
if (do_sleep) {
- if (enable_call())
+ if (
used_empty() &&
enable_call())
wait_for_call();
} else {
poll_used();
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;
{
int completed_before;
int completed = 0;
@@
-160,7
+172,7
@@
static void run_host(void)
for (;;) {
if (do_sleep) {
for (;;) {
if (do_sleep) {
- if (enable_kick())
+ if (
avail_empty() &&
enable_kick())
wait_for_kick();
} else {
poll_avail();
wait_for_kick();
} else {
poll_avail();