DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device
@ 2018-10-31 13:59 Radu Nicolau
  2018-10-31 15:06 ` Thomas Monjalon
  2018-10-31 15:50 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
  0 siblings, 2 replies; 9+ messages in thread
From: Radu Nicolau @ 2018-10-31 13:59 UTC (permalink / raw)
  To: dev; +Cc: thomas, declan.doherty, chas3, Radu Nicolau

After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
from probe() segfaults; there is no need to call the function, just set
the mode directly.

Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 156f31c..6421b96 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3230,10 +3230,9 @@ bond_probe(struct rte_vdev_device *dev)
 		}
 
 		if (internals->mode == BONDING_MODE_8023AD)
-			rte_eth_bond_8023ad_agg_selection_set(port_id,
-					agg_mode);
+			internals->mode4.agg_selection = agg_mode;
 	} else {
-		rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
+		internals->mode4.agg_selection = AGG_STABLE;
 	}
 
 	RTE_BOND_LOG(INFO, "Create bonded device %s on port %d in mode %u on "
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device
  2018-10-31 13:59 [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device Radu Nicolau
@ 2018-10-31 15:06 ` Thomas Monjalon
  2018-10-31 15:34   ` Radu Nicolau
  2018-10-31 15:37   ` Chas Williams
  2018-10-31 15:50 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
  1 sibling, 2 replies; 9+ messages in thread
From: Thomas Monjalon @ 2018-10-31 15:06 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: dev, declan.doherty, chas3, ferruh.yigit, arybchenko

31/10/2018 14:59, Radu Nicolau:
> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> from probe() segfaults; there is no need to call the function, just set
> the mode directly.
> 
> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")

It would not segfault if you call rte_eth_dev_probing_finish() at the
real end of the probing function. Then the port will be considered not
valid in rte_eth_bond_8023ad_agg_selection_set().
It does not solve your problem but it is more correct.
So I suggest to revert this patch (which was a wrong fix):
	http://git.dpdk.org/dpdk/commit/?id=1620175

Then the issue is to allow configuring a port before the end of probing.
This patch is workarounding the public API which checks port validity.
I think it is a good approach.

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

* Re: [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device
  2018-10-31 15:06 ` Thomas Monjalon
@ 2018-10-31 15:34   ` Radu Nicolau
  2018-10-31 15:37   ` Chas Williams
  1 sibling, 0 replies; 9+ messages in thread
From: Radu Nicolau @ 2018-10-31 15:34 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, declan.doherty, chas3, ferruh.yigit, arybchenko



On 10/31/2018 3:06 PM, Thomas Monjalon wrote:
> 31/10/2018 14:59, Radu Nicolau:
>> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
>> from probe() segfaults; there is no need to call the function, just set
>> the mode directly.
>>
>> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> It would not segfault if you call rte_eth_dev_probing_finish() at the
> real end of the probing function. Then the port will be considered not
> valid in rte_eth_bond_8023ad_agg_selection_set().
But we need to set the mode, the call to 
rte_eth_bond_8023ad_agg_selection_set() assumed before that it will 
actually succeed, which is not the case anymore.
I will look at reverting that patch/fix, it is likely not needed anymore 
anyway if this patch is applied.
> It does not solve your problem but it is more correct.
> So I suggest to revert this patch (which was a wrong fix):
> 	http://git.dpdk.org/dpdk/commit/?id=1620175
>
> Then the issue is to allow configuring a port before the end of probing.
> This patch is workarounding the public API which checks port validity.
> I think it is a good approach.
>
In probe() we need to set the mode, and we know that the port is a valid 
bonding port, so there is no need to check. Any other call bar the ones 
in probe remain the same.

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

* Re: [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device
  2018-10-31 15:06 ` Thomas Monjalon
  2018-10-31 15:34   ` Radu Nicolau
@ 2018-10-31 15:37   ` Chas Williams
  2018-10-31 15:44     ` Thomas Monjalon
  1 sibling, 1 reply; 9+ messages in thread
From: Chas Williams @ 2018-10-31 15:37 UTC (permalink / raw)
  To: Thomas Monjalon, Radu Nicolau
  Cc: dev, declan.doherty, chas3, ferruh.yigit, arybchenko



On 10/31/2018 11:06 AM, Thomas Monjalon wrote:
> 31/10/2018 14:59, Radu Nicolau:
>> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
>> from probe() segfaults; there is no need to call the function, just set
>> the mode directly.
>>
>> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> 
> It would not segfault if you call rte_eth_dev_probing_finish() at the
> real end of the probing function. Then the port will be considered not
> valid in rte_eth_bond_8023ad_agg_selection_set().
> It does not solve your problem but it is more correct.
> So I suggest to revert this patch (which was a wrong fix):
> 	http://git.dpdk.org/dpdk/commit/?id=1620175

Or just make the change proposed in this commit and also move this
section before the probing finish.  This is performing initial setup of
the interface and it doesn't need to use the public API to do this.
And this should be done before the public API can access the device.

> Then the issue is to allow configuring a port before the end of probing.

That shouldn't be allowed of course.

> This patch is workarounding the public API which checks port validity.
> I think it is a good approach.

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

* Re: [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device
  2018-10-31 15:37   ` Chas Williams
@ 2018-10-31 15:44     ` Thomas Monjalon
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2018-10-31 15:44 UTC (permalink / raw)
  To: Chas Williams
  Cc: Radu Nicolau, dev, declan.doherty, chas3, ferruh.yigit, arybchenko

31/10/2018 16:37, Chas Williams:
> 
> On 10/31/2018 11:06 AM, Thomas Monjalon wrote:
> > 31/10/2018 14:59, Radu Nicolau:
> >> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> >> from probe() segfaults; there is no need to call the function, just set
> >> the mode directly.
> >>
> >> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> > 
> > It would not segfault if you call rte_eth_dev_probing_finish() at the
> > real end of the probing function. Then the port will be considered not
> > valid in rte_eth_bond_8023ad_agg_selection_set().
> > It does not solve your problem but it is more correct.
> > So I suggest to revert this patch (which was a wrong fix):
> > 	http://git.dpdk.org/dpdk/commit/?id=1620175
> 
> Or just make the change proposed in this commit and also move this
> section before the probing finish.  This is performing initial setup of
> the interface and it doesn't need to use the public API to do this.
> And this should be done before the public API can access the device.

Yes, this is what I proposed, but said differently :)

Please add Fixes: 1620175b400e ("net/bonding: fix invalid port id")

> > Then the issue is to allow configuring a port before the end of probing.
> 
> That shouldn't be allowed of course.
> 
> > This patch is workarounding the public API which checks port validity.
> > I think it is a good approach.

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

* [dpdk-dev] [PATCH v2] net/bonding: fix segfault when creating bonded device
  2018-10-31 13:59 [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device Radu Nicolau
  2018-10-31 15:06 ` Thomas Monjalon
@ 2018-10-31 15:50 ` Radu Nicolau
  2018-10-31 16:11   ` Thomas Monjalon
  2018-10-31 16:14   ` Chas Williams
  1 sibling, 2 replies; 9+ messages in thread
From: Radu Nicolau @ 2018-10-31 15:50 UTC (permalink / raw)
  To: dev; +Cc: thomas, declan.doherty, chas3, ferruh.yigit, arybchenko, Radu Nicolau

After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
from probe() segfaults; there is no need to call the function, just set
the mode directly.
Also, reverted 1620175b400e.

Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
Fixes: 1620175b400e ("net/bonding: fix invalid port id")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: reverted earlier patch

 drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 156f31c..1a6d8e4 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3216,8 +3216,6 @@ bond_probe(struct rte_vdev_device *dev)
 	internals = rte_eth_devices[port_id].data->dev_private;
 	internals->kvlist = kvlist;
 
-	rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
-
 	if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) {
 		if (rte_kvargs_process(kvlist,
 				PMD_BOND_AGG_MODE_KVARG,
@@ -3230,12 +3228,12 @@ bond_probe(struct rte_vdev_device *dev)
 		}
 
 		if (internals->mode == BONDING_MODE_8023AD)
-			rte_eth_bond_8023ad_agg_selection_set(port_id,
-					agg_mode);
+			internals->mode4.agg_selection = agg_mode;
 	} else {
-		rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
+		internals->mode4.agg_selection = AGG_STABLE;
 	}
 
+	rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
 	RTE_BOND_LOG(INFO, "Create bonded device %s on port %d in mode %u on "
 			"socket %u.",	name, port_id, bonding_mode, socket_id);
 	return 0;
-- 
2.7.5

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

* Re: [dpdk-dev] [PATCH v2] net/bonding: fix segfault when creating bonded device
  2018-10-31 15:50 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
@ 2018-10-31 16:11   ` Thomas Monjalon
  2018-10-31 16:14   ` Chas Williams
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2018-10-31 16:11 UTC (permalink / raw)
  To: Radu Nicolau; +Cc: dev, declan.doherty, chas3, ferruh.yigit, arybchenko

31/10/2018 16:50, Radu Nicolau:
> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> from probe() segfaults; there is no need to call the function, just set
> the mode directly.
> Also, reverted 1620175b400e.
> 
> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>

I cannot ack because I do not master this PMD,
but it looks good to me.

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

* Re: [dpdk-dev] [PATCH v2] net/bonding: fix segfault when creating bonded device
  2018-10-31 15:50 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
  2018-10-31 16:11   ` Thomas Monjalon
@ 2018-10-31 16:14   ` Chas Williams
  2018-11-02 20:36     ` Ferruh Yigit
  1 sibling, 1 reply; 9+ messages in thread
From: Chas Williams @ 2018-10-31 16:14 UTC (permalink / raw)
  To: Radu Nicolau, dev; +Cc: thomas, declan.doherty, chas3, ferruh.yigit, arybchenko



On 10/31/2018 11:50 AM, Radu Nicolau wrote:
> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> from probe() segfaults; there is no need to call the function, just set
> the mode directly.
> Also, reverted 1620175b400e.
> 
> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>

Acked-by: Chas Williams <chas3@att.com>

> ---
> v2: reverted earlier patch
> 
>   drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 156f31c..1a6d8e4 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -3216,8 +3216,6 @@ bond_probe(struct rte_vdev_device *dev)
>   	internals = rte_eth_devices[port_id].data->dev_private;
>   	internals->kvlist = kvlist;
>   
> -	rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
> -
>   	if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) {
>   		if (rte_kvargs_process(kvlist,
>   				PMD_BOND_AGG_MODE_KVARG,
> @@ -3230,12 +3228,12 @@ bond_probe(struct rte_vdev_device *dev)
>   		}
>   
>   		if (internals->mode == BONDING_MODE_8023AD)
> -			rte_eth_bond_8023ad_agg_selection_set(port_id,
> -					agg_mode);
> +			internals->mode4.agg_selection = agg_mode;
>   	} else {
> -		rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
> +		internals->mode4.agg_selection = AGG_STABLE;
>   	}
>   
> +	rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
>   	RTE_BOND_LOG(INFO, "Create bonded device %s on port %d in mode %u on "
>   			"socket %u.",	name, port_id, bonding_mode, socket_id);
>   	return 0;
> 

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

* Re: [dpdk-dev] [PATCH v2] net/bonding: fix segfault when creating bonded device
  2018-10-31 16:14   ` Chas Williams
@ 2018-11-02 20:36     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-11-02 20:36 UTC (permalink / raw)
  To: Chas Williams, Radu Nicolau, dev
  Cc: thomas, declan.doherty, chas3, arybchenko

On 10/31/2018 4:14 PM, Chas Williams wrote:
> 
> 
> On 10/31/2018 11:50 AM, Radu Nicolau wrote:
>> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
>> from probe() segfaults; there is no need to call the function, just set
>> the mode directly.
>> Also, reverted 1620175b400e.
>>
>> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
>> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
>>
>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> 
> Acked-by: Chas Williams <chas3@att.com>

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

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

end of thread, other threads:[~2018-11-02 20:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 13:59 [dpdk-dev] [PATCH] net/bonding: fix segfault when creating bonded device Radu Nicolau
2018-10-31 15:06 ` Thomas Monjalon
2018-10-31 15:34   ` Radu Nicolau
2018-10-31 15:37   ` Chas Williams
2018-10-31 15:44     ` Thomas Monjalon
2018-10-31 15:50 ` [dpdk-dev] [PATCH v2] " Radu Nicolau
2018-10-31 16:11   ` Thomas Monjalon
2018-10-31 16:14   ` Chas Williams
2018-11-02 20:36     ` Ferruh Yigit

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).