* [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers.
[not found] <CGME20190124165910eucas1p212dd655a34f42e11048e85eb17c7d0d0@eucas1p2.samsung.com>
@ 2019-01-24 16:58 ` Ilya Maximets
[not found] ` <CGME20190124165914eucas1p111b991d9e398368f63da918290e768de@eucas1p1.samsung.com>
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Ilya Maximets @ 2019-01-24 16:58 UTC (permalink / raw)
To: dev, Maxime Coquelin, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann, Ilya Maximets
Ilya Maximets (3):
net/virtio: fix improper read barriers on packed Tx cleanup
net/virtio: add barriers for extra descriptors on Rx split
net/virtio: add missing read barrier for packed dequeue
drivers/net/virtio/virtio_rxtx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [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; 11+ 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] 11+ messages in thread
* [dpdk-dev] [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; 11+ 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] 11+ messages in thread
* [dpdk-dev] [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; 11+ 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] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers.
2019-01-24 16:58 ` [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers Ilya Maximets
` (2 preceding siblings ...)
[not found] ` <CGME20190124165921eucas1p1fee7e668285fc26bc4f01c6b5ec0b66a@eucas1p1.samsung.com>
@ 2019-01-25 4:43 ` Tiwei Bie
2019-01-25 15:50 ` Maxime Coquelin
2019-02-08 18:04 ` Maxime Coquelin
5 siblings, 0 replies; 11+ messages in thread
From: Tiwei Bie @ 2019-01-25 4:43 UTC (permalink / raw)
To: Ilya Maximets
Cc: dev, Maxime Coquelin, Michael S . Tsirkin, Zhihong Wang, Jens Freimann
On Thu, Jan 24, 2019 at 07:58:59PM +0300, Ilya Maximets wrote:
> Ilya Maximets (3):
> net/virtio: fix improper read barriers on packed Tx cleanup
> net/virtio: add barriers for extra descriptors on Rx split
> net/virtio: add missing read barrier for packed dequeue
>
> drivers/net/virtio/virtio_rxtx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
2019-01-24 16:59 ` [dpdk-dev] [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; 11+ 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] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue
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
1 sibling, 0 replies; 11+ 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] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 3/3] net/virtio: add missing read barrier for packed dequeue
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
1 sibling, 0 replies; 11+ 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] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 1/3] net/virtio: fix improper read barriers on packed Tx cleanup
2019-01-24 16:59 ` [dpdk-dev] [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; 11+ 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] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers.
2019-01-24 16:58 ` [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers Ilya Maximets
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 11+ messages in thread
From: Maxime Coquelin @ 2019-01-25 15:50 UTC (permalink / raw)
To: Ilya Maximets, dev, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann
Hi Ilya,
On 1/24/19 5:58 PM, Ilya Maximets wrote:
> Ilya Maximets (3):
> net/virtio: fix improper read barriers on packed Tx cleanup
> net/virtio: add barriers for extra descriptors on Rx split
> net/virtio: add missing read barrier for packed dequeue
>
> drivers/net/virtio/virtio_rxtx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
Thanks for the series, it is sadly too late for v19.02.
I'll pick it as soon as v19.05 merge windo opens.
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Maxime
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers.
2019-01-24 16:58 ` [dpdk-dev] [PATCH 0/3] net/virtio: missing/wrong read barriers Ilya Maximets
` (4 preceding siblings ...)
2019-01-25 15:50 ` Maxime Coquelin
@ 2019-02-08 18:04 ` Maxime Coquelin
5 siblings, 0 replies; 11+ messages in thread
From: Maxime Coquelin @ 2019-02-08 18:04 UTC (permalink / raw)
To: Ilya Maximets, dev, Michael S . Tsirkin
Cc: Tiwei Bie, Zhihong Wang, Jens Freimann
On 1/24/19 5:58 PM, Ilya Maximets wrote:
> Ilya Maximets (3):
> net/virtio: fix improper read barriers on packed Tx cleanup
> net/virtio: add barriers for extra descriptors on Rx split
> net/virtio: add missing read barrier for packed dequeue
>
> drivers/net/virtio/virtio_rxtx.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
Applied to dpdk-next-virtio/master.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-02-08 18:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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 ` [dpdk-dev] [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-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
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).