Commit 97a545ab authored by Rusty Russell's avatar Rusty Russell

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: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 28ff4ef7
...@@ -36,10 +36,9 @@ ...@@ -36,10 +36,9 @@
panic("%s:in_use = %i\n", \ panic("%s:in_use = %i\n", \
(_vq)->vq.name, (_vq)->in_use); \ (_vq)->vq.name, (_vq)->in_use); \
(_vq)->in_use = __LINE__; \ (_vq)->in_use = __LINE__; \
mb(); \
} while (0) } while (0)
#define END_USE(_vq) \ #define END_USE(_vq) \
do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0) do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; } while(0)
#else #else
#define BAD_RING(_vq, fmt, args...) \ #define BAD_RING(_vq, fmt, args...) \
do { \ do { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment