From: Ilya Maximets <i.maximets@samsung.com>
To: dev@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Cc: Tiwei Bie <tiwei.bie@intel.com>,
Zhihong Wang <zhihong.wang@intel.com>,
Jens Freimann <jfreimann@redhat.com>,
Ilya Maximets <i.maximets@samsung.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
Date: Thu, 24 Jan 2019 19:59:00 +0300 [thread overview]
Message-ID: <20190124165902.24178-2-i.maximets@samsung.com> (raw)
In-Reply-To: <20190124165902.24178-1-i.maximets@samsung.com>
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 <i.maximets@samsung.com>
---
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
next prev parent reply other threads:[~2019-01-24 16:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190124165910eucas1p212dd655a34f42e11048e85eb17c7d0d0@eucas1p2.samsung.com>
2019-01-24 16:58 ` [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers Ilya Maximets
[not found] ` <CGME20190124165914eucas1p111b991d9e398368f63da918290e768de@eucas1p1.samsung.com>
2019-01-24 16:59 ` Ilya Maximets [this message]
2019-01-25 12:43 ` [dpdk-dev] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup Jens Freimann
2019-01-25 12:49 ` Jens Freimann
[not found] ` <CGME20190124165917eucas1p21b83186e336b1099ee32937fa81d8cc7@eucas1p2.samsung.com>
2019-01-24 16:59 ` [dpdk-dev] [PATCH 2/3] net/virtio: add barriers for extra descriptors on Rx split Ilya Maximets
[not found] ` <CGME20190124165921eucas1p1fee7e668285fc26bc4f01c6b5ec0b66a@eucas1p1.samsung.com>
2019-01-24 16:59 ` [dpdk-dev] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue Ilya Maximets
2019-01-25 12:44 ` Jens Freimann
2019-01-25 12:48 ` Jens Freimann
2019-01-25 4:43 ` [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers Tiwei Bie
2019-01-25 15:50 ` Maxime Coquelin
2019-02-08 18:04 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190124165902.24178-2-i.maximets@samsung.com \
--to=i.maximets@samsung.com \
--cc=dev@dpdk.org \
--cc=jfreimann@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=mst@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=zhihong.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).