From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 5CE6C8E7C for ; Tue, 20 Oct 2015 16:08:24 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NWI000JZV9YUX00@mailout2.w1.samsung.com> for dev@dpdk.org; Tue, 20 Oct 2015 15:08:22 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-f1-56264ad6117d Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 33.45.05269.6DA46265; Tue, 20 Oct 2015 15:08:22 +0100 (BST) Received: from localhost ([106.109.131.58]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NWI005JAV9Y1V50@eusync3.samsung.com>; Tue, 20 Oct 2015 15:08:22 +0100 (BST) From: Nikita Kalyazin To: dev@dpdk.org Date: Tue, 20 Oct 2015 17:07:46 +0300 Message-id: <1445350066-31818-1-git-send-email-n.kalyazin@samsung.com> X-Mailer: git-send-email 2.5.3 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKJMWRmVeSWpSXmKPExsVy+t/xq7rXvNTCDFZ3yFi8+7SdyeLK7GmM FpNnSzkwe/xasJTVo2/LKsYApigum5TUnMyy1CJ9uwSujDdb0gt2c1e8P7+GpYFxC2cXIyeH hICJxP0VP5ggbDGJC/fWs3UxcnEICSxllGjomMQGkhAS+MoocXVVdhcjBwebgJ7E6dPBIGER AQGJz52LwUqYBUIk7s1dxAhiCws4S2y518kKYrMIqErcmToFzOYVcJNY++8BI8gYCQE5ie6d bhMYuRcwMqxiFE0tTS4oTkrPNdIrTswtLs1L10vOz93ECPHs1x2MS49ZHWIU4GBU4uHViFEN E2JNLCuuzD3EKMHBrCTC2yagFibEm5JYWZValB9fVJqTWnyIUZqDRUmcd+au9yFCAumJJanZ qakFqUUwWSYOTqkGxkOBKzfGMa4/y2WzQyT1wBsGM/fgO0dNzG5zn+o/4ZG6Up974VyeSzcn ZusKPVSK2MsQZWDk/SdphofNFFVP9j+XJkvv9nfIq5K9EnSHc6rutr1CtnEZL/MS2pZ96zH9 qyhSHZJ+28MsOuS1mcydy7l7OEtVEv2P3l5/I2DNS0VPre3RDHZrlFiKMxINtZiLihMB098U IOgBAAA= Cc: Dyasly Sergey Subject: [dpdk-dev] [PATCH] vhost: call write barrier before used index update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2015 14:08:24 -0000 Descriptors that have been put into the used vring must be observable by guest earlier than the new used index value. Although compiler barrier serves well for Intel architectue here, the proper cross-platform solution is to use write barrier before the used index is updated. Signed-off-by: Nikita Kalyazin --- lib/librte_vhost/vhost_rxtx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 7026bfa..d955287 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -216,7 +216,7 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id, } } - rte_compiler_barrier(); + rte_wmb(); /* Wait until it's our turn to add our buffer to the used ring. */ while (unlikely(vq->last_used_idx != res_base_idx)) @@ -512,7 +512,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, entry_success = copy_from_mbuf_to_vring(dev, res_base_idx, res_cur_idx, pkts[pkt_idx]); - rte_compiler_barrier(); + rte_wmb(); /* * Wait until it's our turn to add our buffer @@ -751,7 +751,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, entry_success++; } - rte_compiler_barrier(); + rte_wmb(); vq->used->idx += entry_success; /* Kick guest if required. */ if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) -- 2.5.3