* [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
[not found] ` <CGME20190124165914eucas1p111b991d9e398368f63da918290e768de@eucas1p1.samsung.com>
@ 2019-01-24 16:59 ` Ilya Maximets
2019-01-25 12:43 ` Jens Freimann
2019-01-25 12:49 ` Jens Freimann
0 siblings, 2 replies; 7+ messages in thread
From: Ilya Maximets @ 2019-01-24 16:59 UTC (permalink / raw)
To: dev, Maxime Coquelin, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann, Ilya Maximets, stable
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-stable] [PATCH 2/3] net/virtio: add barriers for extra descriptors on Rx split
[not found] ` <CGME20190124165917eucas1p21b83186e336b1099ee32937fa81d8cc7@eucas1p2.samsung.com>
@ 2019-01-24 16:59 ` Ilya Maximets
0 siblings, 0 replies; 7+ messages in thread
From: Ilya Maximets @ 2019-01-24 16:59 UTC (permalink / raw)
To: dev, Maxime Coquelin, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann, Ilya Maximets, stable
There should be read barrier between checking VIRTQUEUE_NUSED (reading
the used->idx) and reading these descriptors. It's done for the first
checks at the beginning of these functions but missed while checking
for extra required descriptors.
Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx")
Fixes: 13ce5e7eb94f ("virtio: mergeable buffers")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
drivers/net/virtio/virtio_rxtx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 63e4370e4..5ffed6a51 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1456,6 +1456,7 @@ virtio_recv_pkts_inorder(void *rx_queue,
prev = rcv_pkts[nb_rx];
if (likely(VIRTQUEUE_NUSED(vq) >= rcv_cnt)) {
+ virtio_rmb(hw->weak_barriers);
num = virtqueue_dequeue_rx_inorder(vq, rcv_pkts, len,
rcv_cnt);
uint16_t extra_idx = 0;
@@ -1642,6 +1643,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,
prev = rcv_pkts[nb_rx];
if (likely(VIRTQUEUE_NUSED(vq) >= rcv_cnt)) {
+ virtio_rmb(hw->weak_barriers);
num = virtqueue_dequeue_burst_rx(vq, rcv_pkts, len,
rcv_cnt);
uint16_t extra_idx = 0;
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-stable] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue
[not found] ` <CGME20190124165921eucas1p1fee7e668285fc26bc4f01c6b5ec0b66a@eucas1p1.samsung.com>
@ 2019-01-24 16:59 ` Ilya Maximets
2019-01-25 12:44 ` Jens Freimann
2019-01-25 12:48 ` Jens Freimann
0 siblings, 2 replies; 7+ messages in thread
From: Ilya Maximets @ 2019-01-24 16:59 UTC (permalink / raw)
To: dev, Maxime Coquelin, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann, Ilya Maximets, stable
Read barrier is required between reading the flags (desc_is_used)
and the content of descriptor to ensure the ordering.
Otherwise, speculative read of desc.id could be reordered with
reading of the desc.flags.
Fixes: a76290c8f1cf ("net/virtio: implement Rx path for packed queues")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
drivers/net/virtio/virtio_rxtx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5ffed6a51..4c701c514 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -124,6 +124,7 @@ virtqueue_dequeue_burst_rx_packed(struct virtqueue *vq,
used_idx = vq->vq_used_cons_idx;
if (!desc_is_used(&desc[used_idx], vq))
return i;
+ virtio_rmb(vq->hw->weak_barriers);
len[i] = desc[used_idx].len;
id = desc[used_idx].id;
cookie = (struct rte_mbuf *)vq->vq_descx[id].cookie;
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
2019-01-24 16:59 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup Ilya Maximets
@ 2019-01-25 12:43 ` Jens Freimann
2019-01-25 12:49 ` Jens Freimann
1 sibling, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2019-01-25 12:43 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Michael S . Tsirkin, Tiwei Bie,
Zhihong Wang, stable
On Thu, Jan 24, 2019 at 07:59:00PM +0300, Ilya Maximets wrote:
>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(-)
>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue
2019-01-24 16:59 ` [dpdk-stable] [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
1 sibling, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2019-01-25 12:44 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Michael S . Tsirkin, Tiwei Bie,
Zhihong Wang, stable
On Thu, Jan 24, 2019 at 07:59:02PM +0300, Ilya Maximets wrote:
>Read barrier is required between reading the flags (desc_is_used)
>and the content of descriptor to ensure the ordering.
>Otherwise, speculative read of desc.id could be reordered with
>reading of the desc.flags.
>
>Fixes: a76290c8f1cf ("net/virtio: implement Rx path for packed queues")
>Cc: stable@dpdk.org
>
>Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>---
> drivers/net/virtio/virtio_rxtx.c | 1 +
> 1 file changed, 1 insertion(+)
>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue
2019-01-24 16:59 ` [dpdk-stable] [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
1 sibling, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2019-01-25 12:48 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Michael S . Tsirkin, Tiwei Bie,
Zhihong Wang, stable
On Thu, Jan 24, 2019 at 07:59:02PM +0300, Ilya Maximets wrote:
>Read barrier is required between reading the flags (desc_is_used)
>and the content of descriptor to ensure the ordering.
>Otherwise, speculative read of desc.id could be reordered with
>reading of the desc.flags.
>
>Fixes: a76290c8f1cf ("net/virtio: implement Rx path for packed queues")
>Cc: stable@dpdk.org
I don't thing cc stable is required as a76290c8f1cf is only in
v19.02-rc1 and newer.
regards,
Jens
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
2019-01-24 16:59 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup Ilya Maximets
2019-01-25 12:43 ` Jens Freimann
@ 2019-01-25 12:49 ` Jens Freimann
1 sibling, 0 replies; 7+ messages in thread
From: Jens Freimann @ 2019-01-25 12:49 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Michael S . Tsirkin, Tiwei Bie,
Zhihong Wang, stable
On Thu, Jan 24, 2019 at 07:59:00PM +0300, Ilya Maximets wrote:
>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
I don't think cc stable is required as 892dc798fa9c is only in
v19.02-rc1 and newer.
regards,
Jens
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-25 12:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190124165902.24178-1-i.maximets@samsung.com>
[not found] ` <CGME20190124165914eucas1p111b991d9e398368f63da918290e768de@eucas1p1.samsung.com>
2019-01-24 16:59 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup Ilya Maximets
2019-01-25 12:43 ` Jens Freimann
2019-01-25 12:49 ` Jens Freimann
[not found] ` <CGME20190124165917eucas1p21b83186e336b1099ee32937fa81d8cc7@eucas1p2.samsung.com>
2019-01-24 16:59 ` [dpdk-stable] [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-stable] [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
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).