DPDK patches and discussions
 help / color / mirror / Atom feed
From: Joyce Kong <joyce.kong@arm.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com,
	honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com
Cc: dev@dpdk.org, nd@arm.com
Subject: [dpdk-dev] [PATCH v1 7/8] vhost: replace smp with thread fence for packed vring
Date: Mon, 21 Dec 2020 23:50:32 +0800
Message-ID: <20201221155033.6771-8-joyce.kong@arm.com> (raw)
In-Reply-To: <20201221155033.6771-1-joyce.kong@arm.com>

Simply relace smp barriers with atomic thread fence for
virtio packed vring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 lib/librte_vhost/virtio_net.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index b779034dc..e145fcbc2 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -171,7 +171,8 @@ vhost_flush_enqueue_shadow_packed(struct virtio_net *dev,
 			used_idx -= vq->size;
 	}
 
-	rte_smp_wmb();
+	/* The ordering for storing desc flags needs to be enforced. */
+	rte_atomic_thread_fence(__ATOMIC_RELEASE);
 
 	for (i = 0; i < vq->shadow_used_idx; i++) {
 		uint16_t flags;
@@ -254,7 +255,7 @@ vhost_flush_enqueue_batch_packed(struct virtio_net *dev,
 		vq->desc_packed[vq->last_used_idx + i].len = lens[i];
 	}
 
-	rte_smp_wmb();
+	rte_atomic_thread_fence(__ATOMIC_RELEASE);
 
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)
 		vq->desc_packed[vq->last_used_idx + i].flags = flags;
@@ -313,7 +314,7 @@ vhost_shadow_dequeue_batch_packed(struct virtio_net *dev,
 		vq->desc_packed[vq->last_used_idx + i].len = 0;
 	}
 
-	rte_smp_wmb();
+	rte_atomic_thread_fence(__ATOMIC_RELEASE);
 	vhost_for_each_try_unroll(i, begin, PACKED_BATCH_SIZE)
 		vq->desc_packed[vq->last_used_idx + i].flags = flags;
 
@@ -2246,7 +2247,7 @@ vhost_reserve_avail_batch_packed(struct virtio_net *dev,
 			return -1;
 	}
 
-	rte_smp_rmb();
+	rte_atomic_thread_fence(__ATOMIC_ACQUIRE);
 
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)
 		lens[i] = descs[avail_idx + i].len;
-- 
2.29.2


  parent reply	other threads:[~2020-12-21 15:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 15:50 [dpdk-dev] [PATCH v1 0/8] replace smp barriers in vhost with C11 atomic Joyce Kong
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 1/8] examples/vhost: relax memory ordering when enqueue/dequeue Joyce Kong
2021-01-07 16:33   ` Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 2/8] examples/vhost_blk: replace smp with thread fence Joyce Kong
2021-01-07 16:35   ` Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 3/8] vhost: remove unnecessary smp barrier for desc flags Joyce Kong
2021-01-07 16:38   ` Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 4/8] vhost: remove unnecessary smp barrier for avail idx Joyce Kong
2021-01-07 16:43   ` Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 5/8] vhost: relax full barriers for desc flags Joyce Kong
2021-01-07 16:45   ` Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 6/8] vhost: relax full barriers for used idx Joyce Kong
2021-01-07 16:46   ` Maxime Coquelin
2020-12-21 15:50 ` Joyce Kong [this message]
2021-01-07 17:06   ` [dpdk-dev] [PATCH v1 7/8] vhost: replace smp with thread fence for packed vring Maxime Coquelin
2020-12-21 15:50 ` [dpdk-dev] [PATCH v1 8/8] vhost: replace smp with thread fence for control path Joyce Kong
2021-01-07 17:15   ` Maxime Coquelin
2021-01-08  9:16 ` [dpdk-dev] [PATCH v1 0/8] replace smp barriers in vhost with C11 atomic Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201221155033.6771-8-joyce.kong@arm.com \
    --to=joyce.kong@arm.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git