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 564861B141 for ; Wed, 5 Dec 2018 14:33:35 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181205133334euoutp022e5915c2f0977132dd427f58b9ed3852~tcxyr7cZj2028520285euoutp027 for ; Wed, 5 Dec 2018 13:33:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181205133334euoutp022e5915c2f0977132dd427f58b9ed3852~tcxyr7cZj2028520285euoutp027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544016814; bh=eqyoNKYV+cj0JkHL8VQuJe5jOGQfIDRFoAUOwhufpKQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=eQUsksjChp9vBVFMbKKAtcKWppJPNlzuR1iMKS1TzjkKBxib1lJJaGvo8aiPRwxxU 8/6M/PVtgfi5Mub7//62tyhxCb4Gt75HVmv2bFrxt3FTp4dF+ouK6y6RSHYHx9nzwO P1lgTqSD4dvaTq/2f5OpfRnXnfV34poDtUqjHcGk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181205133333eucas1p25075acb752d1d500fad84896c2b43996~tcxyNkXst1625916259eucas1p2f; Wed, 5 Dec 2018 13:33:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 2C.17.04441.DA3D70C5; Wed, 5 Dec 2018 13:33:33 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181205133332eucas1p195b3864ed146403e314d7004d27be285~tcxxX50nf3015330153eucas1p12; Wed, 5 Dec 2018 13:33:32 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181205133332eusmtrp1443b0e4985620f6483021dfebdc887b5~tcxxJUYSH0440904409eusmtrp1F; Wed, 5 Dec 2018 13:33:32 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-27-5c07d3adea21 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7C.37.04128.CA3D70C5; Wed, 5 Dec 2018 13:33:32 +0000 (GMT) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20181205133332eusmtip1dfc3ed5df2758ec02481c34f8b0a2543~tcxwppiFL0209402094eusmtip1J; Wed, 5 Dec 2018 13:33:32 +0000 (GMT) To: Maxime Coquelin , dev@dpdk.org, jfreimann@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, jasowang@redhat.com Cc: stable@dpdk.org From: Ilya Maximets Message-ID: <16a4b2fd-c701-7822-3215-62e431e3f339@samsung.com> Date: Wed, 5 Dec 2018 16:33:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181205094957.1938-3-maxime.coquelin@redhat.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsWy7djP87prL7PHGBx4JGPx7tN2Josr7T/Z LZZd+sxkcW7NUhaLY517WCz+dfxht9ja8J/JYvPFSUwOHB6/Fixl9Vi85yWTx/t9V9k8+ras YgxgieKySUnNySxLLdK3S+DK6Pv+ma3gAlfFxa3L2BsYz3N0MXJySAiYSFw60MDSxcjFISSw glFiadsVRgjnC6PEjGfTmCGcz4wSl7pb2WFafvxbzQ6RWM4oMf3aZKiqj4wSv3a+YwOpEhZw k+g6dw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3iBwgs+vAWzWQRUJJY8egFmiwpESJx9uQ6qRlDi5MwnLCA2p4C9xO1Z u6HGq0v8mXeJGcIWl2j6spIVwpaX2P52DvMERqFZSNpnIWmZhaRlFpKWBYwsqxhFUkuLc9Nz i430ihNzi0vz0vWS83M3MQLjbtuxn1t2MHa9Cz7EKMDBqMTDKzGFLUaINbGsuDL3EKMEB7OS CO8KG/YYId6UxMqq1KL8+KLSnNTiQ4ymQM9NZJYSTc4HpoS8knhDU0NzC0tDc2NzYzMLJXHe 8waVUUIC6YklqdmpqQWpRTB9TBycUg2MOWvunMl8rvBtUlnSa/9YDYF0u0t6y73+s1ycVHjQ x/7DGr9WnoonCW23Fav+Tbnlf+D8JP/CXT/SPutcvhi1gMXn/vQdTgckXpra7mK/63lx0uvV acELfgr7ONYf8Xvrueb19LdrrZf+/2z4W9PH98oisYqCfsX/Ge5p5n7qG968/79F8bnARSWW 4oxEQy3mouJEAO/HYFHRAgAA X-CMS-MailID: 20181205133332eucas1p195b3864ed146403e314d7004d27be285 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181205133332eucas1p195b3864ed146403e314d7004d27be285 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181205133332eucas1p195b3864ed146403e314d7004d27be285 References: <20181205094957.1938-3-maxime.coquelin@redhat.com> Subject: Re: [dpdk-dev] [2/5] vhost: enforce desc flags and content read ordering X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 13:33:35 -0000 On 05.12.2018 12:49, Maxime Coquelin wrote: > A read barrier is required to ensure that the ordering between > descriptor's flags and content reads is enforced. > > Fixes: 2f3225a7d69b ("vhost: add vector filling support for packed ring") > Cc: stable@dpdk.org > > Reported-by: Jason Wang > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/virtio_net.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index f11ebb54f..68b72e7a5 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -520,6 +520,12 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, > if (unlikely(!desc_is_avail(&descs[avail_idx], wrap_counter))) > return -1; > > + /* > + * The ordering between desc flags and desc > + * content reads need to be enforced. > + */ > + rte_smp_rmb(); > + Same here. 'desc_is_avail' reads and uses the flags. i.e. no way for reordering, Writes must be ordered on the virtio side by the write barrier. This means that if flags are updated (desc_is_avail() == true) than the whole descriptor already updated and the data is written. No need to have any read barriers here. > *desc_count = 0; > *len = 0; > >