DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/vhost: fix redundant queue state event
@ 2019-06-19  6:16 Noa Ezra
  2019-06-20  6:33 ` [dpdk-dev] [PATCH v2] " Noa Ezra
  2019-06-25  7:04 ` [dpdk-dev] [Suspected-Phishing][PATCH] " Noa Ezra
  0 siblings, 2 replies; 10+ messages in thread
From: Noa Ezra @ 2019-06-19  6:16 UTC (permalink / raw)
  To: maxime.coquelin; +Cc: matan, dev, noae, stable

In some situations, when a virtual machine is starting,
vring_state_changed can be called while there was no change in the
queue state. This fix makes sure that there was really a change in the
queue state before calling the callback for EVENT_QUEUE_STATE.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org
Reviewed-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index cad1e5c..fbe7a37 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
 	/* won't be NULL */
 	state = vring_states[eth_dev->data->port_id];
 	rte_spinlock_lock(&state->lock);
+	if (state->cur[vring] == enable) {
+		rte_spinlock_unlock(&state->lock);
+		return 0;
+	}
 
 	state->cur[vring] = enable;
 	state->max_vring = RTE_MAX(vring, state->max_vring);
-- 
1.8.3.1


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

* [dpdk-dev] [PATCH v2] net/vhost: fix redundant queue state event
  2019-06-19  6:16 [dpdk-dev] [PATCH] net/vhost: fix redundant queue state event Noa Ezra
@ 2019-06-20  6:33 ` Noa Ezra
  2019-09-27  8:49   ` Maxime Coquelin
  2019-06-25  7:04 ` [dpdk-dev] [Suspected-Phishing][PATCH] " Noa Ezra
  1 sibling, 1 reply; 10+ messages in thread
From: Noa Ezra @ 2019-06-20  6:33 UTC (permalink / raw)
  To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: matan, dev, noae, stable

In some situations, when a virtual machine is starting,
vring_state_changed can be called while there was no change in the
queue state. This fix makes sure that there was really a change in the
queue state before calling the callback for EVENT_QUEUE_STATE.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org

Signed-off-by: Noa Ezra <noae@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
---
v2 remove checkpatch warnings
---
 drivers/net/vhost/rte_eth_vhost.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index cad1e5c..fbe7a37 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
 	/* won't be NULL */
 	state = vring_states[eth_dev->data->port_id];
 	rte_spinlock_lock(&state->lock);
+	if (state->cur[vring] == enable) {
+		rte_spinlock_unlock(&state->lock);
+		return 0;
+	}
 
 	state->cur[vring] = enable;
 	state->max_vring = RTE_MAX(vring, state->max_vring);
-- 
1.8.3.1


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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-19  6:16 [dpdk-dev] [PATCH] net/vhost: fix redundant queue state event Noa Ezra
  2019-06-20  6:33 ` [dpdk-dev] [PATCH v2] " Noa Ezra
@ 2019-06-25  7:04 ` Noa Ezra
  2019-06-25  8:23   ` Maxime Coquelin
  1 sibling, 1 reply; 10+ messages in thread
From: Noa Ezra @ 2019-06-25  7:04 UTC (permalink / raw)
  To: Noa Ezra, maxime.coquelin; +Cc: Matan Azrad, dev, stable

Hi,
What do you think about this patch?

Thanks,
Noa.

> -----Original Message-----
> From: Noa Ezra [mailto:noae@mellanox.com]
> Sent: Wednesday, June 19, 2019 9:16 AM
> To: maxime.coquelin@redhat.com
> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
> <noae@mellanox.com>; stable@dpdk.org
> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state
> event
> 
> In some situations, when a virtual machine is starting, vring_state_changed
> can be called while there was no change in the queue state. This fix makes
> sure that there was really a change in the queue state before calling the
> callback for EVENT_QUEUE_STATE.
> 
> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> Cc: stable@dpdk.org
> Reviewed-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> b/drivers/net/vhost/rte_eth_vhost.c
> index cad1e5c..fbe7a37 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>  	/* won't be NULL */
>  	state = vring_states[eth_dev->data->port_id];
>  	rte_spinlock_lock(&state->lock);
> +	if (state->cur[vring] == enable) {
> +		rte_spinlock_unlock(&state->lock);
> +		return 0;
> +	}
> 
>  	state->cur[vring] = enable;
>  	state->max_vring = RTE_MAX(vring, state->max_vring);
> --
> 1.8.3.1


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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-25  7:04 ` [dpdk-dev] [Suspected-Phishing][PATCH] " Noa Ezra
@ 2019-06-25  8:23   ` Maxime Coquelin
  2019-06-26  6:37     ` Noa Ezra
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Coquelin @ 2019-06-25  8:23 UTC (permalink / raw)
  To: Noa Ezra; +Cc: Matan Azrad, dev, stable



On 6/25/19 9:04 AM, Noa Ezra wrote:
> Hi,
> What do you think about this patch?
> 
> Thanks,
> Noa.
> 
>> -----Original Message-----
>> From: Noa Ezra [mailto:noae@mellanox.com]
>> Sent: Wednesday, June 19, 2019 9:16 AM
>> To: maxime.coquelin@redhat.com
>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
>> <noae@mellanox.com>; stable@dpdk.org
>> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state
>> event
>>
>> In some situations, when a virtual machine is starting, vring_state_changed
>> can be called while there was no change in the queue state. This fix makes
>> sure that there was really a change in the queue state before calling the
>> callback for EVENT_QUEUE_STATE.
>>
>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>> Cc: stable@dpdk.org
>> Reviewed-by: Matan Azrad <matan@mellanox.com>
>> ---
>>   drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/vhost/rte_eth_vhost.c
>> b/drivers/net/vhost/rte_eth_vhost.c
>> index cad1e5c..fbe7a37 100644
>> --- a/drivers/net/vhost/rte_eth_vhost.c
>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>>   	/* won't be NULL */
>>   	state = vring_states[eth_dev->data->port_id];
>>   	rte_spinlock_lock(&state->lock);
>> +	if (state->cur[vring] == enable) {
>> +		rte_spinlock_unlock(&state->lock);
>> +		return 0;
>> +	}
>>
>>   	state->cur[vring] = enable;
>>   	state->max_vring = RTE_MAX(vring, state->max_vring);

Maybe the application would want to be notified a new queue is
available, even if it is disabled?

>> --
>> 1.8.3.1
> 

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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-25  8:23   ` Maxime Coquelin
@ 2019-06-26  6:37     ` Noa Ezra
  2019-06-26  7:01       ` Maxime Coquelin
  0 siblings, 1 reply; 10+ messages in thread
From: Noa Ezra @ 2019-06-26  6:37 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: Matan Azrad, dev, stable

Hi,

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Tuesday, June 25, 2019 11:24 AM
> To: Noa Ezra <noae@mellanox.com>
> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
> state event
> 
> 
> 
> On 6/25/19 9:04 AM, Noa Ezra wrote:
> > Hi,
> > What do you think about this patch?
> >
> > Thanks,
> > Noa.
> >
> >> -----Original Message-----
> >> From: Noa Ezra [mailto:noae@mellanox.com]
> >> Sent: Wednesday, June 19, 2019 9:16 AM
> >> To: maxime.coquelin@redhat.com
> >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
> >> <noae@mellanox.com>; stable@dpdk.org
> >> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
> >> state event
> >>
> >> In some situations, when a virtual machine is starting,
> >> vring_state_changed can be called while there was no change in the
> >> queue state. This fix makes sure that there was really a change in
> >> the queue state before calling the callback for EVENT_QUEUE_STATE.
> >>
> >> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> >> Cc: stable@dpdk.org
> >> Reviewed-by: Matan Azrad <matan@mellanox.com>
> >> ---
> >>   drivers/net/vhost/rte_eth_vhost.c | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> >> b/drivers/net/vhost/rte_eth_vhost.c
> >> index cad1e5c..fbe7a37 100644
> >> --- a/drivers/net/vhost/rte_eth_vhost.c
> >> +++ b/drivers/net/vhost/rte_eth_vhost.c
> >> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
> >>   	/* won't be NULL */
> >>   	state = vring_states[eth_dev->data->port_id];
> >>   	rte_spinlock_lock(&state->lock);
> >> +	if (state->cur[vring] == enable) {
> >> +		rte_spinlock_unlock(&state->lock);
> >> +		return 0;
> >> +	}
> >>
> >>   	state->cur[vring] = enable;
> >>   	state->max_vring = RTE_MAX(vring, state->max_vring);
> 
> Maybe the application would want to be notified a new queue is available,
> even if it is disabled?

Can you please look again? As I understand it, "enable" is the "new state" parameter (can be enable/disable).
In this fix I make sure that there was really a change in the state before calling EVENT_QUEUE_STATE (with no change in the state).

> 
> >> --
> >> 1.8.3.1
> >

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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-26  6:37     ` Noa Ezra
@ 2019-06-26  7:01       ` Maxime Coquelin
  2019-06-26  8:03         ` Noa Ezra
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Coquelin @ 2019-06-26  7:01 UTC (permalink / raw)
  To: Noa Ezra; +Cc: Matan Azrad, dev, stable



On 6/26/19 8:37 AM, Noa Ezra wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Tuesday, June 25, 2019 11:24 AM
>> To: Noa Ezra <noae@mellanox.com>
>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; stable@dpdk.org
>> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
>> state event
>>
>>
>>
>> On 6/25/19 9:04 AM, Noa Ezra wrote:
>>> Hi,
>>> What do you think about this patch?
>>>
>>> Thanks,
>>> Noa.
>>>
>>>> -----Original Message-----
>>>> From: Noa Ezra [mailto:noae@mellanox.com]
>>>> Sent: Wednesday, June 19, 2019 9:16 AM
>>>> To: maxime.coquelin@redhat.com
>>>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
>>>> <noae@mellanox.com>; stable@dpdk.org
>>>> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
>>>> state event
>>>>
>>>> In some situations, when a virtual machine is starting,
>>>> vring_state_changed can be called while there was no change in the
>>>> queue state. This fix makes sure that there was really a change in
>>>> the queue state before calling the callback for EVENT_QUEUE_STATE.
>>>>
>>>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>>>> Cc: stable@dpdk.org
>>>> Reviewed-by: Matan Azrad <matan@mellanox.com>
>>>> ---
>>>>    drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c
>>>> b/drivers/net/vhost/rte_eth_vhost.c
>>>> index cad1e5c..fbe7a37 100644
>>>> --- a/drivers/net/vhost/rte_eth_vhost.c
>>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>>>> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>>>>    	/* won't be NULL */
>>>>    	state = vring_states[eth_dev->data->port_id];
>>>>    	rte_spinlock_lock(&state->lock);
>>>> +	if (state->cur[vring] == enable) {
>>>> +		rte_spinlock_unlock(&state->lock);
>>>> +		return 0;
>>>> +	}
>>>>
>>>>    	state->cur[vring] = enable;
>>>>    	state->max_vring = RTE_MAX(vring, state->max_vring);
>>
>> Maybe the application would want to be notified a new queue is available,
>> even if it is disabled?
> 
> Can you please look again? As I understand it, "enable" is the "new state" parameter (can be enable/disable).
> In this fix I make sure that there was really a change in the state before calling EVENT_QUEUE_STATE (with no change in the state).

Ok, I get it.

Maybe we would want to update state->max_vring even if we don't sent the
event?

Thanks,
Maxime
>>
>>>> --
>>>> 1.8.3.1
>>>

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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-26  7:01       ` Maxime Coquelin
@ 2019-06-26  8:03         ` Noa Ezra
  2019-06-26  8:54           ` Maxime Coquelin
  0 siblings, 1 reply; 10+ messages in thread
From: Noa Ezra @ 2019-06-26  8:03 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: Matan Azrad, dev, stable



> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Wednesday, June 26, 2019 10:01 AM
> To: Noa Ezra <noae@mellanox.com>
> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
> state event
> 
> 
> 
> On 6/26/19 8:37 AM, Noa Ezra wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> >> Sent: Tuesday, June 25, 2019 11:24 AM
> >> To: Noa Ezra <noae@mellanox.com>
> >> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org;
> stable@dpdk.org
> >> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant
> >> queue state event
> >>
> >>
> >>
> >> On 6/25/19 9:04 AM, Noa Ezra wrote:
> >>> Hi,
> >>> What do you think about this patch?
> >>>
> >>> Thanks,
> >>> Noa.
> >>>
> >>>> -----Original Message-----
> >>>> From: Noa Ezra [mailto:noae@mellanox.com]
> >>>> Sent: Wednesday, June 19, 2019 9:16 AM
> >>>> To: maxime.coquelin@redhat.com
> >>>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
> >>>> <noae@mellanox.com>; stable@dpdk.org
> >>>> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
> >>>> state event
> >>>>
> >>>> In some situations, when a virtual machine is starting,
> >>>> vring_state_changed can be called while there was no change in the
> >>>> queue state. This fix makes sure that there was really a change in
> >>>> the queue state before calling the callback for EVENT_QUEUE_STATE.
> >>>>
> >>>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> >>>> Cc: stable@dpdk.org
> >>>> Reviewed-by: Matan Azrad <matan@mellanox.com>
> >>>> ---
> >>>>    drivers/net/vhost/rte_eth_vhost.c | 4 ++++
> >>>>    1 file changed, 4 insertions(+)
> >>>>
> >>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c
> >>>> b/drivers/net/vhost/rte_eth_vhost.c
> >>>> index cad1e5c..fbe7a37 100644
> >>>> --- a/drivers/net/vhost/rte_eth_vhost.c
> >>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
> >>>> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
> >>>>    	/* won't be NULL */
> >>>>    	state = vring_states[eth_dev->data->port_id];
> >>>>    	rte_spinlock_lock(&state->lock);
> >>>> +	if (state->cur[vring] == enable) {
> >>>> +		rte_spinlock_unlock(&state->lock);
> >>>> +		return 0;
> >>>> +	}
> >>>>
> >>>>    	state->cur[vring] = enable;
> >>>>    	state->max_vring = RTE_MAX(vring, state->max_vring);
> >>
> >> Maybe the application would want to be notified a new queue is
> >> available, even if it is disabled?
> >
> > Can you please look again? As I understand it, "enable" is the "new state"
> parameter (can be enable/disable).
> > In this fix I make sure that there was really a change in the state before
> calling EVENT_QUEUE_STATE (with no change in the state).
> 
> Ok, I get it.
> 
> Maybe we would want to update state->max_vring even if we don't sent the
> event?

Ok, so do you think we should move the check (if there was a change) to after we update the max_vring?

> Thanks,
> Maxime
> >>
> >>>> --
> >>>> 1.8.3.1
> >>>

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

* Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/vhost: fix redundant queue state event
  2019-06-26  8:03         ` Noa Ezra
@ 2019-06-26  8:54           ` Maxime Coquelin
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2019-06-26  8:54 UTC (permalink / raw)
  To: Noa Ezra; +Cc: Matan Azrad, dev, stable



On 6/26/19 10:03 AM, Noa Ezra wrote:
> 
> 
>> -----Original Message-----
>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>> Sent: Wednesday, June 26, 2019 10:01 AM
>> To: Noa Ezra <noae@mellanox.com>
>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; stable@dpdk.org
>> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
>> state event
>>
>>
>>
>> On 6/26/19 8:37 AM, Noa Ezra wrote:
>>> Hi,
>>>
>>>> -----Original Message-----
>>>> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>>>> Sent: Tuesday, June 25, 2019 11:24 AM
>>>> To: Noa Ezra <noae@mellanox.com>
>>>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org;
>> stable@dpdk.org
>>>> Subject: Re: [Suspected-Phishing][PATCH] net/vhost: fix redundant
>>>> queue state event
>>>>
>>>>
>>>>
>>>> On 6/25/19 9:04 AM, Noa Ezra wrote:
>>>>> Hi,
>>>>> What do you think about this patch?
>>>>>
>>>>> Thanks,
>>>>> Noa.
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Noa Ezra [mailto:noae@mellanox.com]
>>>>>> Sent: Wednesday, June 19, 2019 9:16 AM
>>>>>> To: maxime.coquelin@redhat.com
>>>>>> Cc: Matan Azrad <matan@mellanox.com>; dev@dpdk.org; Noa Ezra
>>>>>> <noae@mellanox.com>; stable@dpdk.org
>>>>>> Subject: [Suspected-Phishing][PATCH] net/vhost: fix redundant queue
>>>>>> state event
>>>>>>
>>>>>> In some situations, when a virtual machine is starting,
>>>>>> vring_state_changed can be called while there was no change in the
>>>>>> queue state. This fix makes sure that there was really a change in
>>>>>> the queue state before calling the callback for EVENT_QUEUE_STATE.
>>>>>>
>>>>>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>>>>>> Cc: stable@dpdk.org
>>>>>> Reviewed-by: Matan Azrad <matan@mellanox.com>
>>>>>> ---
>>>>>>     drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>>>>>>     1 file changed, 4 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/net/vhost/rte_eth_vhost.c
>>>>>> b/drivers/net/vhost/rte_eth_vhost.c
>>>>>> index cad1e5c..fbe7a37 100644
>>>>>> --- a/drivers/net/vhost/rte_eth_vhost.c
>>>>>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>>>>>> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>>>>>>     	/* won't be NULL */
>>>>>>     	state = vring_states[eth_dev->data->port_id];
>>>>>>     	rte_spinlock_lock(&state->lock);
>>>>>> +	if (state->cur[vring] == enable) {
>>>>>> +		rte_spinlock_unlock(&state->lock);
>>>>>> +		return 0;
>>>>>> +	}
>>>>>>
>>>>>>     	state->cur[vring] = enable;
>>>>>>     	state->max_vring = RTE_MAX(vring, state->max_vring);
>>>>
>>>> Maybe the application would want to be notified a new queue is
>>>> available, even if it is disabled?
>>>
>>> Can you please look again? As I understand it, "enable" is the "new state"
>> parameter (can be enable/disable).
>>> In this fix I make sure that there was really a change in the state before
>> calling EVENT_QUEUE_STATE (with no change in the state).
>>
>> Ok, I get it.
>>
>> Maybe we would want to update state->max_vring even if we don't sent the
>> event?
> 
> Ok, so do you think we should move the check (if there was a change) to after we update the max_vring?

Yes, that's what I meant.
Looking at the code, it seems it does not change much the behavior,
but I think it is cleaner.

What we want with the patch is only to not send the event.

Thanks,
Maxime

>> Thanks,
>> Maxime
>>>>
>>>>>> --
>>>>>> 1.8.3.1
>>>>>

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

* Re: [dpdk-dev] [PATCH v2] net/vhost: fix redundant queue state event
  2019-06-20  6:33 ` [dpdk-dev] [PATCH v2] " Noa Ezra
@ 2019-09-27  8:49   ` Maxime Coquelin
  2019-09-27  9:49     ` Maxime Coquelin
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Coquelin @ 2019-09-27  8:49 UTC (permalink / raw)
  To: Noa Ezra, tiwei.bie, zhihong.wang; +Cc: matan, dev, stable



On 6/20/19 8:33 AM, Noa Ezra wrote:
> In some situations, when a virtual machine is starting,
> vring_state_changed can be called while there was no change in the
> queue state. This fix makes sure that there was really a change in the
> queue state before calling the callback for EVENT_QUEUE_STATE.
> 
> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Noa Ezra <noae@mellanox.com>
> Reviewed-by: Matan Azrad <matan@mellanox.com>
> ---
> v2 remove checkpatch warnings
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index cad1e5c..fbe7a37 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>  	/* won't be NULL */
>  	state = vring_states[eth_dev->data->port_id];
>  	rte_spinlock_lock(&state->lock);
> +	if (state->cur[vring] == enable) {
> +		rte_spinlock_unlock(&state->lock);
> +		return 0;
> +	}
>  
>  	state->cur[vring] = enable;
>  	state->max_vring = RTE_MAX(vring, state->max_vring);
> 

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

Thanks,
Maxime

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

* Re: [dpdk-dev] [PATCH v2] net/vhost: fix redundant queue state event
  2019-09-27  8:49   ` Maxime Coquelin
@ 2019-09-27  9:49     ` Maxime Coquelin
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Coquelin @ 2019-09-27  9:49 UTC (permalink / raw)
  To: Noa Ezra, tiwei.bie, zhihong.wang; +Cc: matan, dev, stable



On 9/27/19 10:49 AM, Maxime Coquelin wrote:
> 
> 
> On 6/20/19 8:33 AM, Noa Ezra wrote:
>> In some situations, when a virtual machine is starting,
>> vring_state_changed can be called while there was no change in the
>> queue state. This fix makes sure that there was really a change in the
>> queue state before calling the callback for EVENT_QUEUE_STATE.
>>
>> Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Noa Ezra <noae@mellanox.com>
>> Reviewed-by: Matan Azrad <matan@mellanox.com>
>> ---
>> v2 remove checkpatch warnings
>> ---
>>  drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
>> index cad1e5c..fbe7a37 100644
>> --- a/drivers/net/vhost/rte_eth_vhost.c
>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>> @@ -855,6 +855,10 @@ struct vhost_xstats_name_off {
>>  	/* won't be NULL */
>>  	state = vring_states[eth_dev->data->port_id];
>>  	rte_spinlock_lock(&state->lock);
>> +	if (state->cur[vring] == enable) {
>> +		rte_spinlock_unlock(&state->lock);
>> +		return 0;
>> +	}
>>  
>>  	state->cur[vring] = enable;
>>  	state->max_vring = RTE_MAX(vring, state->max_vring);
>>
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime

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

end of thread, other threads:[~2019-09-27  9:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-19  6:16 [dpdk-dev] [PATCH] net/vhost: fix redundant queue state event Noa Ezra
2019-06-20  6:33 ` [dpdk-dev] [PATCH v2] " Noa Ezra
2019-09-27  8:49   ` Maxime Coquelin
2019-09-27  9:49     ` Maxime Coquelin
2019-06-25  7:04 ` [dpdk-dev] [Suspected-Phishing][PATCH] " Noa Ezra
2019-06-25  8:23   ` Maxime Coquelin
2019-06-26  6:37     ` Noa Ezra
2019-06-26  7:01       ` Maxime Coquelin
2019-06-26  8:03         ` Noa Ezra
2019-06-26  8:54           ` 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).