From: Joyce Kong Date: Mon, 21 Dec 2020 15:50:27 +0000 (+0800) Subject: examples/vhost_blk: replace SMP barrier with thread fence X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=96d1d898dcbc4319d8416b222aa6ba081e605823;p=dpdk.git examples/vhost_blk: replace SMP barrier with thread fence Simply replace the rte_smp_mb barriers with SEQ_CST atomic thread fence, if there is no load/store operations. Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang --- diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c index bb293d492f..7ea60863da 100644 --- a/examples/vhost_blk/vhost_blk.c +++ b/examples/vhost_blk/vhost_blk.c @@ -86,9 +86,9 @@ enqueue_task(struct vhost_blk_task *task) */ used->ring[used->idx & (vq->vring.size - 1)].id = task->req_idx; used->ring[used->idx & (vq->vring.size - 1)].len = task->data_len; - rte_smp_mb(); + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); used->idx++; - rte_smp_mb(); + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); rte_vhost_clr_inflight_desc_split(task->ctrlr->vid, vq->id, used->idx, task->req_idx); @@ -112,12 +112,12 @@ enqueue_task_packed(struct vhost_blk_task *task) desc->id = task->buffer_id; desc->addr = 0; - rte_smp_mb(); + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); if (vq->used_wrap_counter) desc->flags |= VIRTQ_DESC_F_AVAIL | VIRTQ_DESC_F_USED; else desc->flags &= ~(VIRTQ_DESC_F_AVAIL | VIRTQ_DESC_F_USED); - rte_smp_mb(); + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); rte_vhost_clr_inflight_desc_packed(task->ctrlr->vid, vq->id, task->inflight_idx);