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 C67C058FA for ; Thu, 24 Jan 2019 17:59:16 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190124165915euoutp029137f4baab6a9e1ab447b54eb616d9a1~811qRp5or2097420974euoutp02Q for ; Thu, 24 Jan 2019 16:59:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190124165915euoutp029137f4baab6a9e1ab447b54eb616d9a1~811qRp5or2097420974euoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1548349155; bh=KC2jpYUiOezLK67n0153TwJFP9NZ+yZgrjCpRxJBebo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qerakZEL2Du7gBl6RY9u1FSo1povfOqBkf7Wd3W4RL9CroV44YLbBn6VbWydrT9j+ hizds1l3DyFN5231L3bWp11+FufDxCvKl21/pxKLRhFeQ+EJA/i00hKDQHixuZKUrk LdLtQdkN2gbRn2VVUWxVDMVykBYs3/msusEWI4UM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190124165915eucas1p2cd948d4a6e2aab194b5d96b7cc61b4a1~811p5n_B40263802638eucas1p2N; Thu, 24 Jan 2019 16:59:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A8.62.04294.3EEE94C5; Thu, 24 Jan 2019 16:59:15 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190124165914eucas1p111b991d9e398368f63da918290e768de~811osR5CL2227922279eucas1p1E; Thu, 24 Jan 2019 16:59:14 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190124165913eusmtrp1d5093e03f431f9d40d45bdd75aaa739a~811oeAZuY2842228422eusmtrp1D; Thu, 24 Jan 2019 16:59:13 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-26-5c49eee32a83 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 22.26.04128.1EEE94C5; Thu, 24 Jan 2019 16:59:13 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190124165912eusmtip2a8f932ec5fc003577bf1ad75eaa57bbf~811ngaERh1449914499eusmtip2D; Thu, 24 Jan 2019 16:59:12 +0000 (GMT) From: Ilya Maximets To: dev@dpdk.org, Maxime Coquelin , "Michael S . Tsirkin" Cc: Tiwei Bie , Zhihong Wang , Jens Freimann , Ilya Maximets , stable@dpdk.org Date: Thu, 24 Jan 2019 19:59:00 +0300 Message-Id: <20190124165902.24178-2-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190124165902.24178-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsWy7djP87qP33nGGPz4yWnx7tN2Josr7T/Z Lc6tWcpicaxzD4vF/1+vWC3+dfxht9ja8J/JYvPFSUwOHB6/Fixl9Vi85yWTx/t9V9k8+ras YgxgieKySUnNySxLLdK3S+DK6Jk2nbVgFU/FnFezGRsYF3F1MXJySAiYSGxuWcXexcjFISSw glFi9cTVLBDOF0aJpkn/mCCcz4wSM/7vYIVp+bGoBSqxnFHi24frzBDOD0aJzyeOg1WxCehI nFp9hBHEFhHIkDh5+zkjSBGzwFpGibOdT5hAEsICQRLvLu0Fa2ARUJVYvXQtWJxXwFrixeGd UOvkJVZvOMAMYnMK2Eh8vjiNDSL+nU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tOOQZI8Sa WFZcmXuIUYKDWUmE1/WiW4wQb0piZVVqUX58UWlOavEhRlOgoyYyS4km5wNjKq8k3tDU0NzC 0tDc2NzYzEJJnPe8QWWUkEB6YklqdmpqQWoRTB8TB6dUA6Ph9FzDq/8rl5rs175yOyNz0byz bunKQSLemfVrgy6eT3JyYZa8UuE8SWevWtFU5rhX5w7lr/JYxl3Cobjl6+rLopInp+7Yk2B2 8k+B6Iurzj0bmIsetAlsYGRumDbt+IK29t1nExmrTtsLtj7hu2xaHrA4a7rDsTk+kRfd/k1e Jyw6J+P00StKLMUZiYZazEXFiQCMOHs5cQIAAA== X-CMS-MailID: 20190124165914eucas1p111b991d9e398368f63da918290e768de X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190124165914eucas1p111b991d9e398368f63da918290e768de X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190124165914eucas1p111b991d9e398368f63da918290e768de References: <20190124165902.24178-1-i.maximets@samsung.com> Subject: [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup 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: Thu, 24 Jan 2019 16:59:16 -0000 Read barrier must be implied between reading descriptor flags and descriptor id. Otherwise, in case of reordering, we could read wrong descriptor id. For the reference, similar barrier for split rings is the read barrier between VIRTQUEUE_NUSED (reading the used->idx) and the call to the virtio_xmit_cleanup(). Additionally removed double update of 'used_idx'. It's enough to set it in the end of the loop. Fixes: 892dc798fa9c ("net/virtio: implement Tx path for packed queues") Cc: stable@dpdk.org Signed-off-by: Ilya Maximets --- drivers/net/virtio/virtio_rxtx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index cc476b898..63e4370e4 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -234,7 +234,7 @@ virtio_xmit_cleanup_packed(struct virtqueue *vq, int num) used_idx = vq->vq_used_cons_idx; while (num-- && desc_is_used(&desc[used_idx], vq)) { - used_idx = vq->vq_used_cons_idx; + virtio_rmb(vq->hw->weak_barriers); id = desc[used_idx].id; dxp = &vq->vq_descx[id]; vq->vq_used_cons_idx += dxp->ndescs; @@ -1940,7 +1940,6 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts, /* Positive value indicates it need free vring descriptors */ if (unlikely(need > 0)) { - virtio_rmb(hw->weak_barriers); need = RTE_MIN(need, (int)nb_pkts); virtio_xmit_cleanup_packed(vq, need); need = slots - vq->vq_free_cnt; -- 2.17.1