Message ID | 20201221142321.51606-5-joyce.kong@arm.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Maxime Coquelin |
Headers | show |
Series | replace smp barriers in virtio with C11 atomic | expand |
Context | Check | Description |
---|---|---|
ci/iol-testing | success | Testing PASS |
ci/iol-abi-testing | success | Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-broadcom-Functional | success | Functional Testing PASS |
ci/iol-broadcom-Performance | success | Performance Testing PASS |
ci/Intel-compilation | success | Compilation OK |
ci/checkpatch | success | coding style OK |
On 12/21/20 3:23 PM, Joyce Kong wrote: > Replace the smp barriers with atomic thread fence for synchronization > between different threads, if there are no load/store operations. > > Signed-off-by: Joyce Kong <joyce.kong@arm.com> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> > --- > drivers/net/virtio/virtqueue.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Thanks, Maxime
diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index ac3d9e750..d78b94344 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -26,7 +26,7 @@ struct rte_mbuf; /* * Per virtio_ring.h in Linux. * For virtio_pci on SMP, we don't need to order with respect to MMIO - * accesses through relaxed memory I/O windows, so smp_mb() et al are + * accesses through relaxed memory I/O windows, so thread_fence is * sufficient. * * For using virtio to talk to real devices (eg. vDPA) we do need real @@ -36,7 +36,7 @@ static inline void virtio_mb(uint8_t weak_barriers) { if (weak_barriers) - rte_smp_mb(); + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); else rte_mb(); } @@ -45,7 +45,7 @@ static inline void virtio_rmb(uint8_t weak_barriers) { if (weak_barriers) - rte_smp_rmb(); + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); else rte_io_rmb(); } @@ -54,7 +54,7 @@ static inline void virtio_wmb(uint8_t weak_barriers) { if (weak_barriers) - rte_smp_wmb(); + rte_atomic_thread_fence(__ATOMIC_RELEASE); else rte_io_wmb(); }