virtio: use one way barrier for split vring avail index
authorJoyce Kong <joyce.kong@arm.com>
Thu, 30 Apr 2020 09:14:37 +0000 (17:14 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 5 May 2020 13:54:26 +0000 (15:54 +0200)
commit3fc1d87c2a2055b6a0c9e0f3c456bfe14f95c217
treec01b09dd66668ffb5325b059c9420fbc66e9c1f0
parentea5207c158edb00d7e5da17369ea45a462a40dcc
virtio: use one way barrier for split vring avail index

In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for avail
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtqueue.h
lib/librte_vhost/virtio_net.c