net/virtio: improve perf via one-way barriers on used flag
authorJoyce Kong <joyce.kong@arm.com>
Tue, 17 Sep 2019 05:28:26 +0000 (13:28 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Oct 2019 14:43:09 +0000 (16:43 +0200)
commit2c661d418e4a3fe06c56f024c97c574a609685f7
treeba0d50ace25be4033ff1fbc9b6bc9e9cc0239da7
parent6094557de086702961800fdb1159670231a9f218
net/virtio: improve perf via one-way barriers on used flag

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 used
flags in packed ring.

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