vhost: add vq status check in async enqueue poll
PATCH 1/1 vhost: add vq status check in async enqueue poll
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
--- lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
lib/librte_vhost/virtio_net.c +5 -3
@@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; -__atomic_add_fetch (&vq->used->idx, n_descs, __ATOMIC_RELEASE); - -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }if (start_idx + n_pkts_put <= vq_size) {
Signature · 1 line
2.18.4
Quoted 41 lines
-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 16, 2020 11:30 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v1] vhost: add vq status check in async enqueue pollFrom: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>--- lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)lib/librte_vhost/virtio_net.c index renamed from lib/librte_vhost/virtio_net.c +0
-0
1d0be3dd4..b197d76d3100644lib/librte_vhost/virtio_net.c +5
-3@@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; -__atomic_add_fetch (&vq->used->idx, n_descs, __ATOMIC_RELEASE); - -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }
Quoted 3 lines
if (
start_idx+n_pkts_put<=vq_size) {
--
2.18.4
Ferruh Yigit
AppliedQuoted 9 lines · Chenbo
Quoted 9 lines
-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 16, 2020 11:30 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v1] vhost: add vq status check in async enqueue poll
Quoted 4 lines
Quoted 1 line
From: Patrick Fu <[email protected]>
Reviewed-by Chenbo Xia <[email protected]>
Applied to dpdk-next-net/master, thanks.
What about this commit title?
vhost: fix missing virtqueue status check in async path
Quoted 33 lines · On 7/16/20 5:30 PM, [email protected] wrote:
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>--- lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)lib/librte_vhost/virtio_net.c +5
-3@@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; -__atomic_add_fetch (&vq->used->idx, n_descs, __ATOMIC_RELEASE); - -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }if (start_idx + n_pkts_put <= vq_size) {
Quoted 2 lines · Maxime Coquelin
What about this commit title?
vhost: fix missing virtqueue status check in async path
Existing commit dropped from next-net and patchwork status updated.
Quoted 11 lines · On 7/16/20 5:30 PM, [email protected] wrote:
Quoted 9 lines
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>
<...>
V2 patch sent with revised title
Quoted 47 lines
-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Monday, July 20, 2020 11:58 PM
To: Fu, Patrick <[email protected]>; [email protected]; Xia, Chenbo <[email protected]>
Subject: Re: [PATCH v1] vhost: add vq status check in async enqueue pollWhat about this commit title?
vhost: fix missing virtqueue status check in async pathlib/librte_vhost/virtio_net.c uint16_t
Quoted 18 lines · On 7/16/20 5:30 PM, [email protected] wrote:
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>--- lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/lib/librte_vhost/virtio_net.cindex1d0be3dd4..b197d76d3100644lib/librte_vhost/virtio_net.c +0
-0@@ -1686,9 +1686,11 @@ uint16_trte_vhost_poll_enqueue_completed(int
lib/librte_vhost/virtio_net.c uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
Quoted 5 lines
lib/librte_vhost/virtio_net.c +0
-1vid, uint16_t queue_id, if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; - __atomic_add_fetch(&vq->used->idx, n_descs,
__ATOMIC_RELEASE);Quoted 11 lines
lib/librte_vhost/virtio_net.c +5
-2- -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }if (
start_idx+n_pkts_put<=vq_size) {
PATCH v2 1/1 vhost: fix missing virtqueue status check in async path
In reply to [email protected]From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
---
v2:
revise commit title
lib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
lib/librte_vhost/virtio_net.c +5 -3
@@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; -__atomic_add_fetch (&vq->used->idx, n_descs, __ATOMIC_RELEASE); - -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }if (start_idx + n_pkts_put <= vq_size) {
Signature · 1 line
2.18.4
Re: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
Quoted 26 lines · On 7/21/20 5:35 AM, [email protected] wrote:
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>---
v2:
revise commit titlelib/librte_vhost/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)lib/librte_vhost/virtio_net.c +0
-1@@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; -__atomic_add_fetch (&vq->used->idx, n_descs, __ATOMIC_RELEASE);
lib/librte_vhost/virtio_net.c uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, · line 1696
Quoted 10 lines
lib/librte_vhost/virtio_net.c +5
-2- -vhost_vring_call_split (dev, vq); +if (likely (vq->enabled && vq->access_ok)) { +__atomic_add_fetch (&vq->used->idx, + n_descs, __ATOMIC_RELEASE); +vhost_vring_call_split (dev, vq); + } }if (start_idx + n_pkts_put <= vq_size) {
Thanks,
Maxime
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
Quoted 9 lines · Maxime Coquelin
Quoted 6 lines · On 7/21/20 5:35 AM, [email protected] wrote:
From: Patrick Fu <[email protected]>
Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue.
Quoted 6 lines
Quoted 3 lines
Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")Signed-off-by Patrick Fu <[email protected]>Reviewed-by Maxime Coquelin <[email protected]>
Applied to dpdk-next-net/master, thanks.