DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
@ 2020-07-16 15:30 patrick.fu
  2020-07-17  8:09 ` Xia, Chenbo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: patrick.fu @ 2020-07-16 15:30 UTC (permalink / raw)
  To: dev, maxime.coquelin, chenbo.xia; +Cc: patrick.fu

From: Patrick Fu <patrick.fu@intel.com>

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 <patrick.fu@intel.com>
---
 lib/librte_vhost/virtio_net.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 1d0be3dd4..b197d76d3 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -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) {
-- 
2.18.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
  2020-07-16 15:30 [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll patrick.fu
@ 2020-07-17  8:09 ` Xia, Chenbo
  2020-07-17 13:09   ` Ferruh Yigit
  2020-07-20 15:57 ` Maxime Coquelin
  2020-07-21  3:35 ` [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path patrick.fu
  2 siblings, 1 reply; 9+ messages in thread
From: Xia, Chenbo @ 2020-07-17  8:09 UTC (permalink / raw)
  To: Fu, Patrick, dev, maxime.coquelin


> -----Original Message-----
> From: Fu, Patrick <patrick.fu@intel.com>
> Sent: Thursday, July 16, 2020 11:30 PM
> To: dev@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo
> <chenbo.xia@intel.com>
> Cc: Fu, Patrick <patrick.fu@intel.com>
> Subject: [PATCH v1] vhost: add vq status check in async enqueue poll
> 
> From: Patrick Fu <patrick.fu@intel.com>
> 
> 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 <patrick.fu@intel.com>
> ---
>  lib/librte_vhost/virtio_net.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index
> 1d0be3dd4..b197d76d3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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) {
> --
> 2.18.4

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
  2020-07-17  8:09 ` Xia, Chenbo
@ 2020-07-17 13:09   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2020-07-17 13:09 UTC (permalink / raw)
  To: Xia, Chenbo, Fu, Patrick, dev, maxime.coquelin

On 7/17/2020 9:09 AM, Xia, Chenbo wrote:
> 
>> -----Original Message-----
>> From: Fu, Patrick <patrick.fu@intel.com>
>> Sent: Thursday, July 16, 2020 11:30 PM
>> To: dev@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo
>> <chenbo.xia@intel.com>
>> Cc: Fu, Patrick <patrick.fu@intel.com>
>> Subject: [PATCH v1] vhost: add vq status check in async enqueue poll
>>
>> From: Patrick Fu <patrick.fu@intel.com>
> 
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
> 

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
  2020-07-16 15:30 [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll patrick.fu
  2020-07-17  8:09 ` Xia, Chenbo
@ 2020-07-20 15:57 ` Maxime Coquelin
  2020-07-20 16:49   ` Ferruh Yigit
  2020-07-21  3:38   ` Fu, Patrick
  2020-07-21  3:35 ` [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path patrick.fu
  2 siblings, 2 replies; 9+ messages in thread
From: Maxime Coquelin @ 2020-07-20 15:57 UTC (permalink / raw)
  To: patrick.fu, dev, chenbo.xia

What about this commit title?
vhost: fix missing virtqueue status check in async path

On 7/16/20 5:30 PM, patrick.fu@intel.com wrote:
> From: Patrick Fu <patrick.fu@intel.com>
> 
> 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 <patrick.fu@intel.com>
> ---
>  lib/librte_vhost/virtio_net.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..b197d76d3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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) {
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
  2020-07-20 15:57 ` Maxime Coquelin
@ 2020-07-20 16:49   ` Ferruh Yigit
  2020-07-21  3:38   ` Fu, Patrick
  1 sibling, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2020-07-20 16:49 UTC (permalink / raw)
  To: Maxime Coquelin, patrick.fu, dev, chenbo.xia

On 7/20/2020 4:57 PM, Maxime Coquelin wrote:
> What about this commit title?
> vhost: fix missing virtqueue status check in async path

Existing commit dropped from next-net and patchwork status updated.

> 
> On 7/16/20 5:30 PM, patrick.fu@intel.com wrote:
>> From: Patrick Fu <patrick.fu@intel.com>
>>
>> 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 <patrick.fu@intel.com>

<...>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
  2020-07-16 15:30 [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll patrick.fu
  2020-07-17  8:09 ` Xia, Chenbo
  2020-07-20 15:57 ` Maxime Coquelin
@ 2020-07-21  3:35 ` patrick.fu
  2020-07-21  8:36   ` Maxime Coquelin
  2 siblings, 1 reply; 9+ messages in thread
From: patrick.fu @ 2020-07-21  3:35 UTC (permalink / raw)
  To: dev, maxime.coquelin, chenbo.xia; +Cc: Patrick Fu

From: Patrick Fu <patrick.fu@intel.com>

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 <patrick.fu@intel.com>
---
v2:
 revise commit title

 lib/librte_vhost/virtio_net.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 1d0be3dd4..b197d76d3 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -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) {
-- 
2.18.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
  2020-07-20 15:57 ` Maxime Coquelin
  2020-07-20 16:49   ` Ferruh Yigit
@ 2020-07-21  3:38   ` Fu, Patrick
  1 sibling, 0 replies; 9+ messages in thread
From: Fu, Patrick @ 2020-07-21  3:38 UTC (permalink / raw)
  To: Maxime Coquelin, dev, Xia, Chenbo

V2 patch sent with revised title

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, July 20, 2020 11:58 PM
> To: Fu, Patrick <patrick.fu@intel.com>; dev@dpdk.org; Xia, Chenbo
> <chenbo.xia@intel.com>
> Subject: Re: [PATCH v1] vhost: add vq status check in async enqueue poll
> 
> What about this commit title?
> vhost: fix missing virtqueue status check in async path
> 
> On 7/16/20 5:30 PM, patrick.fu@intel.com wrote:
> > From: Patrick Fu <patrick.fu@intel.com>
> >
> > 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 <patrick.fu@intel.com>
> > ---
> >  lib/librte_vhost/virtio_net.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_vhost/virtio_net.c
> > b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..b197d76d3 100644
> > --- a/lib/librte_vhost/virtio_net.c
> > +++ b/lib/librte_vhost/virtio_net.c
> > @@ -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) {
> >


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
  2020-07-21  3:35 ` [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path patrick.fu
@ 2020-07-21  8:36   ` Maxime Coquelin
  2020-07-21 14:53     ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Maxime Coquelin @ 2020-07-21  8:36 UTC (permalink / raw)
  To: patrick.fu, dev, chenbo.xia



On 7/21/20 5:35 AM, patrick.fu@intel.com wrote:
> From: Patrick Fu <patrick.fu@intel.com>
> 
> 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 <patrick.fu@intel.com>
> ---
> v2:
>  revise commit title
> 
>  lib/librte_vhost/virtio_net.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..b197d76d3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -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) {
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path
  2020-07-21  8:36   ` Maxime Coquelin
@ 2020-07-21 14:53     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2020-07-21 14:53 UTC (permalink / raw)
  To: Maxime Coquelin, patrick.fu, dev, chenbo.xia

On 7/21/2020 9:36 AM, Maxime Coquelin wrote:
> 
> 
> On 7/21/20 5:35 AM, patrick.fu@intel.com wrote:
>> From: Patrick Fu <patrick.fu@intel.com>
>>
>> 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 <patrick.fu@intel.com>
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-21 14:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 15:30 [dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll patrick.fu
2020-07-17  8:09 ` Xia, Chenbo
2020-07-17 13:09   ` Ferruh Yigit
2020-07-20 15:57 ` Maxime Coquelin
2020-07-20 16:49   ` Ferruh Yigit
2020-07-21  3:38   ` Fu, Patrick
2020-07-21  3:35 ` [dpdk-dev] [PATCH v2] vhost: fix missing virtqueue status check in async path patrick.fu
2020-07-21  8:36   ` Maxime Coquelin
2020-07-21 14:53     ` Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git