virtio_ring: Update weak barriers to use dma_wmb/rmb
This change makes it so that instead of using smp_wmb/rmb which varies depending on the kernel configuration we can can use dma_wmb/rmb which for most architectures should be equal to or slightly more strict than smp_wmb/rmb. The advantage to this is that these barriers are available to uniprocessor builds as well so the performance should improve under such a configuration. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a8557d32fe
commit
9e1a27ea42
1 changed files with 4 additions and 19 deletions
|
|
@ -21,46 +21,31 @@
|
||||||
* actually quite cheap.
|
* actually quite cheap.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
static inline void virtio_mb(bool weak_barriers)
|
static inline void virtio_mb(bool weak_barriers)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
if (weak_barriers)
|
if (weak_barriers)
|
||||||
smp_mb();
|
smp_mb();
|
||||||
else
|
else
|
||||||
mb();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void virtio_rmb(bool weak_barriers)
|
|
||||||
{
|
|
||||||
if (weak_barriers)
|
|
||||||
smp_rmb();
|
|
||||||
else
|
|
||||||
rmb();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void virtio_wmb(bool weak_barriers)
|
|
||||||
{
|
|
||||||
if (weak_barriers)
|
|
||||||
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
|
#endif
|
||||||
|
mb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void virtio_rmb(bool weak_barriers)
|
||||||
|
{
|
||||||
|
if (weak_barriers)
|
||||||
|
dma_rmb();
|
||||||
|
else
|
||||||
|
rmb();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void virtio_wmb(bool weak_barriers)
|
||||||
|
{
|
||||||
|
if (weak_barriers)
|
||||||
|
dma_wmb();
|
||||||
|
else
|
||||||
|
wmb();
|
||||||
|
}
|
||||||
|
|
||||||
struct virtio_device;
|
struct virtio_device;
|
||||||
struct virtqueue;
|
struct virtqueue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue