Skip to content

Commit

Permalink
Revert "virtio_ring: Update weak barriers to use dma_wmb/rmb"
Browse files Browse the repository at this point in the history
This reverts commit 9e1a27e.

While that commit optimizes !CONFIG_SMP, it mixes
up DMA and SMP concepts, making the code hard
to figure out.

A better way to optimize this is with the new __smp_XXX
barriers.

As a first step, go back to full rmb/wmb barriers
for !SMP.
We switch to __smp_XXX barriers in the next patch.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
  • Loading branch information
Michael S. Tsirkin committed Jan 12, 2016
1 parent 6a65d26 commit d307fb1
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions include/linux/virtio_ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,46 @@
* actually quite cheap.
*/

#ifdef CONFIG_SMP
static inline void virtio_mb(bool weak_barriers)
{
#ifdef CONFIG_SMP
if (weak_barriers)
smp_mb();
else
#endif
mb();
}

static inline void virtio_rmb(bool weak_barriers)
{
if (weak_barriers)
dma_rmb();
smp_rmb();
else
rmb();
}

static inline void virtio_wmb(bool weak_barriers)
{
if (weak_barriers)
dma_wmb();
smp_wmb();
else
wmb();
}
#else
static inline void virtio_mb(bool weak_barriers)
{
mb();
}

static inline void virtio_rmb(bool weak_barriers)
{
rmb();
}

static inline void virtio_wmb(bool weak_barriers)
{
wmb();
}
#endif

struct virtio_device;
struct virtqueue;
Expand Down

0 comments on commit d307fb1

Please sign in to comment.