diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-24 15:22:22 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-23 22:52:24 -0500 |
commit | 97a545ab6ce922a0f868d192718a48a0091ebc5e (patch) | |
tree | 1593d2a0f0ff19c4deb731d6079997e79989c8b1 | |
parent | 28ff4ef71795fe6f6c0cc06a04911c9ca09c2c11 (diff) |
virtio: remove bogus barriers from DEBUG version of virtio_ring.c
With DEBUG defined, we add an ->in_use flag to detect if the caller
invokes two virtio methods in parallel. The barriers attempt to ensure
timely update of the ->in_use flag.
But they're voodoo: if we need these barriers it implies that the
calling code doesn't have sufficient synchronization to ensure the
code paths aren't invoked at the same time anyway, and we want to
detect it.
Also, adding barriers changes timing, so turning on debug has more
chance of hiding real problems.
Thanks to MST for drawing my attention to this code...
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | drivers/virtio/virtio_ring.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index fbd2ecde93e4..1ee97d402a48 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -36,10 +36,9 @@ | |||
36 | panic("%s:in_use = %i\n", \ | 36 | panic("%s:in_use = %i\n", \ |
37 | (_vq)->vq.name, (_vq)->in_use); \ | 37 | (_vq)->vq.name, (_vq)->in_use); \ |
38 | (_vq)->in_use = __LINE__; \ | 38 | (_vq)->in_use = __LINE__; \ |
39 | mb(); \ | ||
40 | } while (0) | 39 | } while (0) |
41 | #define END_USE(_vq) \ | 40 | #define END_USE(_vq) \ |
42 | do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0) | 41 | do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; } while(0) |
43 | #else | 42 | #else |
44 | #define BAD_RING(_vq, fmt, args...) \ | 43 | #define BAD_RING(_vq, fmt, args...) \ |
45 | do { \ | 44 | do { \ |