From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 2564D3256 for ; Tue, 11 Dec 2018 11:38:51 +0100 (CET) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181211103850euoutp010750de5e60d48f09eb65986c17dabeeb~vQQ8HShv62157621576euoutp01x for ; Tue, 11 Dec 2018 10:38:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181211103850euoutp010750de5e60d48f09eb65986c17dabeeb~vQQ8HShv62157621576euoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544524730; bh=cSFOrI3ilywYCCTLasuSgrvC9/zzJwnj4eMr/7gVAZ4=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=rFYnHx8dkf+AylDzplsaIaN9p4BboAL//dlcXj4s6+mgDJjBoI7+0Lrt483Sab2Wi lmQjUc9RNBSdcg/jUM3kmdJ2bJMF+KUfU36Zhp48RIIeBE8mtvRs84WusQd6DAtdWD bDn2rW9v6KfX6WnJo63boVGHInRr1XEkh6xRAnog= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181211103849eucas1p1a0c45f06eb1478bf7b3e21a198029e01~vQQ7g-9n-0244002440eucas1p1Q; Tue, 11 Dec 2018 10:38:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 10.17.04441.8B39F0C5; Tue, 11 Dec 2018 10:38:49 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181211103848eucas1p10c270ca8997fea8a2f55c2d94d02baea~vQQ6uJZN52593425934eucas1p15; Tue, 11 Dec 2018 10:38:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181211103848eusmtrp12fdf3ac37c6378e0d21bed24ccbb0b79~vQQ6fd0hK2580625806eusmtrp1V; Tue, 11 Dec 2018 10:38:48 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-c7-5c0f93b84fdb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 04.7E.04284.8B39F0C5; Tue, 11 Dec 2018 10:38:48 +0000 (GMT) Received: from [106.109.129.180] (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181211103847eusmtip2834448100bc82f5dc9a3e327af131636~vQQ58O5iR1981619816eusmtip2v; Tue, 11 Dec 2018 10:38:47 +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: <60168064-6a09-318b-1f62-78b3520e00f4@samsung.com> Date: Tue, 11 Dec 2018 13:38:46 +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-2-maxime.coquelin@redhat.com> Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsWy7djPc7o7J/PHGPxfz2Tx7tN2Josr7T/Z LZZd+sxkcW7NUhaLY517WCz+dfxht9ja8J/JYvPFSUwOHB6/Fixl9Vi85yWTx/t9V9k8+ras YgxgieKySUnNySxLLdK3S+DK+N10ha3gJ2/Fg8tX2RoYl3B3MXJySAiYSLw4tom5i5GLQ0hg BaPExq+LWSCcL4wSz/d9ZYNwPjNKPJvZzwTTsuXeZ6iW5YwSza92M0E4Hxkl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rxA4YN/fUHCLAKqEs/WNIF1igpESJx9uQ5sPK+AoMTJmU9YQGxOAXuJ 5hPPGSGmq0v8mXeJGcIWl2j6spIVwpaX2P52DvMERqFZSNpnIWmZhaRlFpKWBYwsqxhFUkuL c9Nziw31ihNzi0vz0vWS83M3MQKjbtuxn5t3MF7aGHyIUYCDUYmHt6KNL0aINbGsuDL3EKME B7OSCK9uGm+MEG9KYmVValF+fFFpTmrxIUZToOcmMkuJJucDE0JeSbyhqaG5haWhubG5sZmF kjjveYPKKCGB9MSS1OzU1ILUIpg+Jg5OqQZG2eQ8H5mKe4Ybkgs3dwauFQ8uuvlr/oKtB7ce Y89ffLGpMzHgXRS36Ow1Szozxe6nVDJZvjdY91TBYOHi15eTd/0NOBWg8XGHTVzYzOSH96b3 3Gl+cUWLWUOGbX5IqFTlt9wPS+b92fag6Na9x1wL5bNtE9ynJ95SnLdiReWm3N3TFVZKsd+a r8RSnJFoqMVcVJwIAPpPJFbQAgAA X-CMS-MailID: 20181211103848eucas1p10c270ca8997fea8a2f55c2d94d02baea X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181211103848eucas1p10c270ca8997fea8a2f55c2d94d02baea X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181211103848eucas1p10c270ca8997fea8a2f55c2d94d02baea References: <20181205094957.1938-2-maxime.coquelin@redhat.com> Subject: Re: [dpdk-stable] [1/5] vhost: enforce avail index and desc read ordering X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 10:38:51 -0000 On 05.12.2018 12:49, Maxime Coquelin wrote: > A read barrier is required to ensure the ordering between > available index and the descriptor reads is enforced. > > Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application") > Cc: stable@dpdk.org > > Reported-by: Jason Wang > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/virtio_net.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > I'd like to have a bit more details about a bad scenario in a commit message because it's not an obvious change at a first glance. Otherwise, Acked-by: Ilya Maximets > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index 5e1a1a727..f11ebb54f 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -791,6 +791,12 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, > rte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]); > avail_head = *((volatile uint16_t *)&vq->avail->idx); > > + /* > + * The ordering between avail index and > + * desc reads needs to be enforced. > + */ > + rte_smp_rmb(); > + > for (pkt_idx = 0; pkt_idx < count; pkt_idx++) { > uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; > uint16_t nr_vec = 0; > @@ -1373,6 +1379,12 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, > if (free_entries == 0) > return 0; > > + /* > + * The ordering between avail index and > + * desc reads needs to be enforced. > + */ > + rte_smp_rmb(); > + > VHOST_LOG_DEBUG(VHOST_DATA, "(%d) %s\n", dev->vid, __func__); > > count = RTE_MIN(count, MAX_PKT_BURST); >