DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
@ 2020-02-18 17:22 Maxime Coquelin
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 17:22 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand; +Cc: Maxime Coquelin

This series fixes regression introduced in v20.02-rc3.
First patch fixes the error path, and second one fix
Vhost device reconfigure issue reported by Yinan.

v2:
---
- Fix error path order (David)

Maxime Coquelin (2):
  net/vhost: fix Vhost setup error path
  net/vhost: prevent multiple setup on reconfig

 drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

-- 
2.24.1


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

* [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
@ 2020-02-18 17:22 ` Maxime Coquelin
  2020-02-19  3:05   ` Tiwei Bie
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 17:22 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand; +Cc: Maxime Coquelin

If for some reason vhost_driver_setup() fails, the list
element for the device may be freed without being removed
from the internal list of devices.

This patch fixes all the error paths, by unregistering the
device from Vhost library it has been registered, remove
the device from the list, reset device vring_state pointer
from the global table and only free vring state if it had
been allocated.

Fixes: 3d01b759d267 ("net/vhost: delay driver setup")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 90263ae77c..4a7b1b608c 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -878,12 +878,12 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
 
 	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
 	if (list == NULL)
-		goto error;
+		return -1;
 
 	vring_state = rte_zmalloc_socket(name, sizeof(*vring_state),
 					 0, numa_node);
 	if (vring_state == NULL)
-		goto error;
+		goto free_list;
 
 	list->eth_dev = eth_dev;
 	pthread_mutex_lock(&internal_list_lock);
@@ -894,30 +894,37 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
 	vring_states[eth_dev->data->port_id] = vring_state;
 
 	if (rte_vhost_driver_register(internal->iface_name, internal->flags))
-		goto error;
+		goto list_remove;
 
 	if (internal->disable_flags) {
 		if (rte_vhost_driver_disable_features(internal->iface_name,
 						      internal->disable_flags))
-			goto error;
+			goto drv_unreg;
 	}
 
 	if (rte_vhost_driver_callback_register(internal->iface_name,
 					       &vhost_ops) < 0) {
 		VHOST_LOG(ERR, "Can't register callbacks\n");
-		goto error;
+		goto drv_unreg;
 	}
 
 	if (rte_vhost_driver_start(internal->iface_name) < 0) {
 		VHOST_LOG(ERR, "Failed to start driver for %s\n",
 			  internal->iface_name);
-		goto error;
+		goto drv_unreg;
 	}
 
 	return 0;
 
-error:
+drv_unreg:
+	rte_vhost_driver_unregister(internal->iface_name);
+list_remove:
+	vring_states[eth_dev->data->port_id] = NULL;
+	pthread_mutex_lock(&internal_list_lock);
+	TAILQ_REMOVE(&internal_list, list, next);
+	pthread_mutex_unlock(&internal_list_lock);
 	rte_free(vring_state);
+free_list:
 	rte_free(list);
 
 	return -1;
-- 
2.24.1


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

* [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
@ 2020-02-18 17:22 ` Maxime Coquelin
  2020-02-19  3:44   ` Tiwei Bie
  2020-02-18 17:25 ` [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 17:22 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand; +Cc: Maxime Coquelin

Ethdev's .dev_configure callback can be called multiple
time during a device life-time, but Vhost makes the
wrong assumption that it is not the case and try to
setup again the device on reconfiguration.

This patch ensures the device hasn't been already setup
before proceeding.

Fixes: 3d01b759d267 ("net/vhost: delay driver setup")

Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 4a7b1b608c..458ed58f5f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
 	unsigned int numa_node = eth_dev->device->numa_node;
 	const char *name = eth_dev->device->name;
 
+	/* Don't try to setup again if it has already been done. */
+	list = find_internal_resource(internal->iface_name);
+	if (list)
+		return 0;
+
 	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
 	if (list == NULL)
 		return -1;
-- 
2.24.1


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
@ 2020-02-18 17:25 ` Maxime Coquelin
  2020-02-18 22:37 ` Itsuro ODA
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 17:25 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand

Sorry, just see I missed the v2 prefix.

On 2/18/20 6:22 PM, Maxime Coquelin wrote:
> This series fixes regression introduced in v20.02-rc3.
> First patch fixes the error path, and second one fix
> Vhost device reconfigure issue reported by Yinan.
> 
> v2:
> ---
> - Fix error path order (David)
> 
> Maxime Coquelin (2):
>   net/vhost: fix Vhost setup error path
>   net/vhost: prevent multiple setup on reconfig
> 
>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
                   ` (2 preceding siblings ...)
  2020-02-18 17:25 ` [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
@ 2020-02-18 22:37 ` Itsuro ODA
  2020-02-19 10:16   ` Maxime Coquelin
  2020-02-19 10:18 ` Maxime Coquelin
  2020-02-19 10:23 ` Maxime Coquelin
  5 siblings, 1 reply; 16+ messages in thread
From: Itsuro ODA @ 2020-02-18 22:37 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: dev, yinan.wang, tiwei.bie, amorenoz, david.marchand, stable

Hi Yinan, Maxime, David,

Thank you for quick test, fix and review.
It looks good to me.

The original fix has been queued to stable 19.11.1.
It should be rejected or applied this fix too.

Thanks.
Itsuto Oda

On Tue, 18 Feb 2020 18:22:38 +0100
Maxime Coquelin <maxime.coquelin@redhat.com> wrote:

> This series fixes regression introduced in v20.02-rc3.
> First patch fixes the error path, and second one fix
> Vhost device reconfigure issue reported by Yinan.
> 
> v2:
> ---
> - Fix error path order (David)
> 
> Maxime Coquelin (2):
>   net/vhost: fix Vhost setup error path
>   net/vhost: prevent multiple setup on reconfig
> 
>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> -- 
> 2.24.1

-- 
Itsuro ODA <oda@valinux.co.jp>


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

* Re: [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
@ 2020-02-19  3:05   ` Tiwei Bie
  0 siblings, 0 replies; 16+ messages in thread
From: Tiwei Bie @ 2020-02-19  3:05 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, oda, yinan.wang, amorenoz, david.marchand

On Tue, Feb 18, 2020 at 06:22:39PM +0100, Maxime Coquelin wrote:
> If for some reason vhost_driver_setup() fails, the list
> element for the device may be freed without being removed
> from the internal list of devices.
> 
> This patch fixes all the error paths, by unregistering the
> device from Vhost library it has been registered, remove
> the device from the list, reset device vring_state pointer
> from the global table and only free vring state if it had
> been allocated.
> 
> Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

Thanks,
Tiwei

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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig
  2020-02-18 17:22 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
@ 2020-02-19  3:44   ` Tiwei Bie
  2020-02-19  8:17     ` Maxime Coquelin
  0 siblings, 1 reply; 16+ messages in thread
From: Tiwei Bie @ 2020-02-19  3:44 UTC (permalink / raw)
  To: Maxime Coquelin, oda; +Cc: dev, yinan.wang, amorenoz, david.marchand

On Tue, Feb 18, 2020 at 06:22:40PM +0100, Maxime Coquelin wrote:
> Ethdev's .dev_configure callback can be called multiple
> time during a device life-time, but Vhost makes the
> wrong assumption that it is not the case and try to
> setup again the device on reconfiguration.
> 
> This patch ensures the device hasn't been already setup
> before proceeding.
> 
> Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Tested-by: Yinan Wang <yinan.wang@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/vhost/rte_eth_vhost.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 4a7b1b608c..458ed58f5f 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
>  	unsigned int numa_node = eth_dev->device->numa_node;
>  	const char *name = eth_dev->device->name;
>  
> +	/* Don't try to setup again if it has already been done. */
> +	list = find_internal_resource(internal->iface_name);
> +	if (list)
> +		return 0;
> +
>  	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
>  	if (list == NULL)
>  		return -1;
> -- 
> 2.24.1

Thanks Maxime for the fix!

Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>

Not related to this fix, it seems there is a potential leak after
delaying the driver setup to _configure, as the list won't be
registered until users configure the device. So internal->iface_name
allocated in _create will leak if the device is released without
doing _configure first.

https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1058
https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1075

It's not a common case and it's quite late in this release,
probably it's fine to fix it later.

Thanks,
Tiwei

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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig
  2020-02-19  3:44   ` Tiwei Bie
@ 2020-02-19  8:17     ` Maxime Coquelin
  2020-02-19 22:17       ` Itsuro ODA
  0 siblings, 1 reply; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-19  8:17 UTC (permalink / raw)
  To: Tiwei Bie, oda; +Cc: dev, yinan.wang, amorenoz, david.marchand

Hi Tiwei,

On 2/19/20 4:44 AM, Tiwei Bie wrote:
> On Tue, Feb 18, 2020 at 06:22:40PM +0100, Maxime Coquelin wrote:
>> Ethdev's .dev_configure callback can be called multiple
>> time during a device life-time, but Vhost makes the
>> wrong assumption that it is not the case and try to
>> setup again the device on reconfiguration.
>>
>> This patch ensures the device hasn't been already setup
>> before proceeding.
>>
>> Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
>>
>> Reported-by: Yinan Wang <yinan.wang@intel.com>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Tested-by: Yinan Wang <yinan.wang@intel.com>
>> Reviewed-by: David Marchand <david.marchand@redhat.com>
>> ---
>>  drivers/net/vhost/rte_eth_vhost.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
>> index 4a7b1b608c..458ed58f5f 100644
>> --- a/drivers/net/vhost/rte_eth_vhost.c
>> +++ b/drivers/net/vhost/rte_eth_vhost.c
>> @@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
>>  	unsigned int numa_node = eth_dev->device->numa_node;
>>  	const char *name = eth_dev->device->name;
>>  
>> +	/* Don't try to setup again if it has already been done. */
>> +	list = find_internal_resource(internal->iface_name);
>> +	if (list)
>> +		return 0;
>> +
>>  	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
>>  	if (list == NULL)
>>  		return -1;
>> -- 
>> 2.24.1
> 
> Thanks Maxime for the fix!
> 
> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> 
> Not related to this fix, it seems there is a potential leak after
> delaying the driver setup to _configure, as the list won't be
> registered until users configure the device. So internal->iface_name
> allocated in _create will leak if the device is released without
> doing _configure first.
> 
> https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1058
> https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1075
> 
> It's not a common case and it's quite late in this release,
> probably it's fine to fix it later.

That's a valid point, and I also agree there is no urgency for v20.02.
Itsuro, would you take care of fixing it for v20.05?

Thanks,
Maxime
> Thanks,
> Tiwei
> 


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 22:37 ` Itsuro ODA
@ 2020-02-19 10:16   ` Maxime Coquelin
  0 siblings, 0 replies; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-19 10:16 UTC (permalink / raw)
  To: Itsuro ODA; +Cc: dev, yinan.wang, tiwei.bie, amorenoz, david.marchand, stable



On 2/18/20 11:37 PM, Itsuro ODA wrote:
> Hi Yinan, Maxime, David,
> 
> Thank you for quick test, fix and review.
> It looks good to me.
> 
> The original fix has been queued to stable 19.11.1.
> It should be rejected or applied this fix too.

Thanks for the heads-up.
I added Cc: stable@dpdk.org in the commit messages.

Maxime

> Thanks.
> Itsuto Oda
> 
> On Tue, 18 Feb 2020 18:22:38 +0100
> Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
> 
>> This series fixes regression introduced in v20.02-rc3.
>> First patch fixes the error path, and second one fix
>> Vhost device reconfigure issue reported by Yinan.
>>
>> v2:
>> ---
>> - Fix error path order (David)
>>
>> Maxime Coquelin (2):
>>   net/vhost: fix Vhost setup error path
>>   net/vhost: prevent multiple setup on reconfig
>>
>>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>>  1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> -- 
>> 2.24.1
> 


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
                   ` (3 preceding siblings ...)
  2020-02-18 22:37 ` Itsuro ODA
@ 2020-02-19 10:18 ` Maxime Coquelin
  2020-02-19 11:17   ` Kevin Traynor
  2020-02-19 10:23 ` Maxime Coquelin
  5 siblings, 1 reply; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-19 10:18 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand; +Cc: stable

Cc'ing stable as the commit it fixes was backported to v19.11 stable
branch.

On 2/18/20 6:22 PM, Maxime Coquelin wrote:
> This series fixes regression introduced in v20.02-rc3.
> First patch fixes the error path, and second one fix
> Vhost device reconfigure issue reported by Yinan.
> 
> v2:
> ---
> - Fix error path order (David)
> 
> Maxime Coquelin (2):
>   net/vhost: fix Vhost setup error path
>   net/vhost: prevent multiple setup on reconfig
> 
>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
                   ` (4 preceding siblings ...)
  2020-02-19 10:18 ` Maxime Coquelin
@ 2020-02-19 10:23 ` Maxime Coquelin
  5 siblings, 0 replies; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-19 10:23 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz, david.marchand; +Cc: stable



On 2/18/20 6:22 PM, Maxime Coquelin wrote:
> This series fixes regression introduced in v20.02-rc3.
> First patch fixes the error path, and second one fix
> Vhost device reconfigure issue reported by Yinan.
> 
> v2:
> ---
> - Fix error path order (David)
> 
> Maxime Coquelin (2):
>   net/vhost: fix Vhost setup error path
>   net/vhost: prevent multiple setup on reconfig
> 
>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 

Applied to dpdk-next-virtio/master

Thanks,
Maxime


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-19 10:18 ` Maxime Coquelin
@ 2020-02-19 11:17   ` Kevin Traynor
  0 siblings, 0 replies; 16+ messages in thread
From: Kevin Traynor @ 2020-02-19 11:17 UTC (permalink / raw)
  To: Maxime Coquelin, dev, oda, yinan.wang, tiwei.bie, amorenoz,
	david.marchand
  Cc: stable

On 19/02/2020 10:18, Maxime Coquelin wrote:
> Cc'ing stable as the commit it fixes was backported to v19.11 stable
> branch.
> 

fyi - it is relevant to 18.11 also as 3d01b759d is fixing something
introduced in 18.11. I skipped 3d01b759d for now and will take the full
set together when available.

> On 2/18/20 6:22 PM, Maxime Coquelin wrote:
>> This series fixes regression introduced in v20.02-rc3.
>> First patch fixes the error path, and second one fix
>> Vhost device reconfigure issue reported by Yinan.
>>
>> v2:
>> ---
>> - Fix error path order (David)
>>
>> Maxime Coquelin (2):
>>   net/vhost: fix Vhost setup error path
>>   net/vhost: prevent multiple setup on reconfig
>>
>>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>>  1 file changed, 19 insertions(+), 7 deletions(-)
>>
> 


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

* Re: [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig
  2020-02-19  8:17     ` Maxime Coquelin
@ 2020-02-19 22:17       ` Itsuro ODA
  0 siblings, 0 replies; 16+ messages in thread
From: Itsuro ODA @ 2020-02-19 22:17 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: Tiwei Bie, dev, yinan.wang, amorenoz, david.marchand

Hi Maxime, Tiewi,

On Wed, 19 Feb 2020 09:17:41 +0100
Maxime Coquelin <maxime.coquelin@redhat.com> wrote:

> Hi Tiwei,
> 
> On 2/19/20 4:44 AM, Tiwei Bie wrote:
> > On Tue, Feb 18, 2020 at 06:22:40PM +0100, Maxime Coquelin wrote:
> >> Ethdev's .dev_configure callback can be called multiple
> >> time during a device life-time, but Vhost makes the
> >> wrong assumption that it is not the case and try to
> >> setup again the device on reconfiguration.
> >>
> >> This patch ensures the device hasn't been already setup
> >> before proceeding.
> >>
> >> Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
> >>
> >> Reported-by: Yinan Wang <yinan.wang@intel.com>
> >> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> >> Tested-by: Yinan Wang <yinan.wang@intel.com>
> >> Reviewed-by: David Marchand <david.marchand@redhat.com>
> >> ---
> >>  drivers/net/vhost/rte_eth_vhost.c | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> >> index 4a7b1b608c..458ed58f5f 100644
> >> --- a/drivers/net/vhost/rte_eth_vhost.c
> >> +++ b/drivers/net/vhost/rte_eth_vhost.c
> >> @@ -876,6 +876,11 @@ vhost_driver_setup(struct rte_eth_dev *eth_dev)
> >>  	unsigned int numa_node = eth_dev->device->numa_node;
> >>  	const char *name = eth_dev->device->name;
> >>  
> >> +	/* Don't try to setup again if it has already been done. */
> >> +	list = find_internal_resource(internal->iface_name);
> >> +	if (list)
> >> +		return 0;
> >> +
> >>  	list = rte_zmalloc_socket(name, sizeof(*list), 0, numa_node);
> >>  	if (list == NULL)
> >>  		return -1;
> >> -- 
> >> 2.24.1
> > 
> > Thanks Maxime for the fix!
> > 
> > Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
> > 
> > Not related to this fix, it seems there is a potential leak after
> > delaying the driver setup to _configure, as the list won't be
> > registered until users configure the device. So internal->iface_name
> > allocated in _create will leak if the device is released without
> > doing _configure first.
> > 
> > https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1058
> > https://github.com/DPDK/dpdk/blob/e6c78e736d77/drivers/net/vhost/rte_eth_vhost.c#L1075
> > 
> > It's not a common case and it's quite late in this release,
> > probably it's fine to fix it later.
> 
> That's a valid point, and I also agree there is no urgency for v20.02.
> Itsuro, would you take care of fixing it for v20.05?

Sure, I will do it.

Thanks.
Itsuro Oda

> Thanks,
> Maxime
> > Thanks,
> > Tiwei
> > 

-- 
Itsuro ODA <oda@valinux.co.jp>


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 15:24 ` Wang, Yinan
@ 2020-02-18 15:25   ` Maxime Coquelin
  0 siblings, 0 replies; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 15:25 UTC (permalink / raw)
  To: Wang, Yinan, dev, oda, Bie, Tiwei, amorenoz



On 2/18/20 4:24 PM, Wang, Yinan wrote:
> This patch set can fix Vhost device reconfigure issue, thanks!

Thanks for the quick test, I'll ask your Tested-by on patch 2.

Maxime

> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: 2020年2月18日 22:35
>> To: dev@dpdk.org; oda@valinux.co.jp; Wang, Yinan <yinan.wang@intel.com>;
>> Bie, Tiwei <tiwei.bie@intel.com>; amorenoz@redhat.com
>> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Subject: [PATCH 0/2] Fix Vhost PMD setup
>>
>> This series fixes regression introduced in v20.02-rc3.
>> First patch fixes the error path, and second one fix Vhost device reconfigure
>> issue reported by Yinan.
>>
>> Maxime Coquelin (2):
>>   net/vhost: fix Vhost setup error path
>>   net/vhost: prevent multiple setup on reconfig
>>
>>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>>  1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> --
>> 2.24.1
> 


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

* Re: [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
  2020-02-18 14:35 Maxime Coquelin
@ 2020-02-18 15:24 ` Wang, Yinan
  2020-02-18 15:25   ` Maxime Coquelin
  0 siblings, 1 reply; 16+ messages in thread
From: Wang, Yinan @ 2020-02-18 15:24 UTC (permalink / raw)
  To: Maxime Coquelin, dev, oda, Bie, Tiwei, amorenoz

This patch set can fix Vhost device reconfigure issue, thanks!


> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: 2020年2月18日 22:35
> To: dev@dpdk.org; oda@valinux.co.jp; Wang, Yinan <yinan.wang@intel.com>;
> Bie, Tiwei <tiwei.bie@intel.com>; amorenoz@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH 0/2] Fix Vhost PMD setup
> 
> This series fixes regression introduced in v20.02-rc3.
> First patch fixes the error path, and second one fix Vhost device reconfigure
> issue reported by Yinan.
> 
> Maxime Coquelin (2):
>   net/vhost: fix Vhost setup error path
>   net/vhost: prevent multiple setup on reconfig
> 
>  drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> --
> 2.24.1


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

* [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup
@ 2020-02-18 14:35 Maxime Coquelin
  2020-02-18 15:24 ` Wang, Yinan
  0 siblings, 1 reply; 16+ messages in thread
From: Maxime Coquelin @ 2020-02-18 14:35 UTC (permalink / raw)
  To: dev, oda, yinan.wang, tiwei.bie, amorenoz; +Cc: Maxime Coquelin

This series fixes regression introduced in v20.02-rc3.
First patch fixes the error path, and second one fix
Vhost device reconfigure issue reported by Yinan.

Maxime Coquelin (2):
  net/vhost: fix Vhost setup error path
  net/vhost: prevent multiple setup on reconfig

 drivers/net/vhost/rte_eth_vhost.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

-- 
2.24.1


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

end of thread, other threads:[~2020-02-19 22:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 17:22 [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
2020-02-18 17:22 ` [dpdk-dev] [PATCH 1/2] net/vhost: fix Vhost setup error path Maxime Coquelin
2020-02-19  3:05   ` Tiwei Bie
2020-02-18 17:22 ` [dpdk-dev] [PATCH 2/2] net/vhost: prevent multiple setup on reconfig Maxime Coquelin
2020-02-19  3:44   ` Tiwei Bie
2020-02-19  8:17     ` Maxime Coquelin
2020-02-19 22:17       ` Itsuro ODA
2020-02-18 17:25 ` [dpdk-dev] [PATCH 0/2] Fix Vhost PMD setup Maxime Coquelin
2020-02-18 22:37 ` Itsuro ODA
2020-02-19 10:16   ` Maxime Coquelin
2020-02-19 10:18 ` Maxime Coquelin
2020-02-19 11:17   ` Kevin Traynor
2020-02-19 10:23 ` Maxime Coquelin
  -- strict thread matches above, loose matches on Subject: below --
2020-02-18 14:35 Maxime Coquelin
2020-02-18 15:24 ` Wang, Yinan
2020-02-18 15:25   ` 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).