DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process
@ 2014-12-18 10:16 Michael Qiu
  2014-12-18 10:22 ` Qiu, Michael
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Michael Qiu @ 2014-12-18 10:16 UTC (permalink / raw)
  To: dev

EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
EAL:   PCI memory mapped at 0x7f18c2a00000
EAL:   PCI memory mapped at 0x7f18c2a80000
Segmentation fault (core dumped)

This is introduced by commit: 46bc9d75
	ixgbe: fix multi-process support
When start primary process with command line:
./app/test/test -n 1 -c ffff -m 64
then start the second one:
./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
This segment-fault will occur.

Root cause is test app on primary process only starts device, but
the queue need initialized by manually command line.
So the tx queue is still NULL when secondary process startup.

Reported-by: Yong Liu <yong.liu@intel.com>
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9401916..87ed6ee 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -749,9 +749,19 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
 		struct igb_tx_queue *txq;
-		/* TX queue function in primary, set by last queue initialized */
-		txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
-		set_tx_function(eth_dev, txq);
+		/* TX queue function in primary, set by last queue initialized
+		 * Tx queue may not initialized by primary process
+		 * */
+		if (eth_dev->data->tx_queues) {
+			txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
+			set_tx_function(eth_dev, txq);
+		} else {
+			/* Shall we exit this process if we get here? */
+			PMD_INIT_LOG(INFO, "Last tx queue initialized fail in "
+				     "secondary process, please verify if tx "
+				     "queues were initialized in primary "
+				     "process!\n");
+		}
 
 		if (eth_dev->data->scattered_rx)
 			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process
  2014-12-18 10:16 [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process Michael Qiu
@ 2014-12-18 10:22 ` Qiu, Michael
  2014-12-18 10:27   ` De Lara Guarch, Pablo
  2014-12-18 10:28   ` Bruce Richardson
  2014-12-18 10:38 ` De Lara Guarch, Pablo
  2014-12-19  6:59 ` [dpdk-dev] [PATCH v2] " Michael Qiu
  2 siblings, 2 replies; 8+ messages in thread
From: Qiu, Michael @ 2014-12-18 10:22 UTC (permalink / raw)
  To: dev

On 12/18/2014 6:17 PM, Qiu, Michael wrote:
> EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> EAL:   PCI memory mapped at 0x7f18c2a00000
> EAL:   PCI memory mapped at 0x7f18c2a80000
> Segmentation fault (core dumped)
>
> This is introduced by commit: 46bc9d75
> 	ixgbe: fix multi-process support
> When start primary process with command line:
> ./app/test/test -n 1 -c ffff -m 64
> then start the second one:
> ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> This segment-fault will occur.
>
> Root cause is test app on primary process only starts device, but
> the queue need initialized by manually command line.
> So the tx queue is still NULL when secondary process startup.
>
> Reported-by: Yong Liu <yong.liu@intel.com>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> index 9401916..87ed6ee 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> @@ -749,9 +749,19 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
>  	 */
>  	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
>  		struct igb_tx_queue *txq;
> -		/* TX queue function in primary, set by last queue initialized */
> -		txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
> -		set_tx_function(eth_dev, txq);
> +		/* TX queue function in primary, set by last queue initialized
> +		 * Tx queue may not initialized by primary process
> +		 * */
> +		if (eth_dev->data->tx_queues) {
> +			txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
> +			set_tx_function(eth_dev, txq);
> +		} else {
> +			/* Shall we exit this process if we get here? */

I'm just not sure if it is better to terminated when Tx queues are NULL
in secondary process.

Thanks
Michael
> +			PMD_INIT_LOG(INFO, "Last tx queue initialized fail in "
> +				     "secondary process, please verify if tx "
> +				     "queues were initialized in primary "
> +				     "process!\n");
> +		}
>  
>  		if (eth_dev->data->scattered_rx)
>  			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;


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

* Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process
  2014-12-18 10:22 ` Qiu, Michael
@ 2014-12-18 10:27   ` De Lara Guarch, Pablo
  2014-12-18 10:28   ` Bruce Richardson
  1 sibling, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2014-12-18 10:27 UTC (permalink / raw)
  To: Qiu, Michael, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiu, Michael
> Sent: Thursday, December 18, 2014 10:22 AM
> To: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start
> secondary process
> 
> On 12/18/2014 6:17 PM, Qiu, Michael wrote:
> > EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> > EAL:   PCI memory mapped at 0x7f18c2a00000
> > EAL:   PCI memory mapped at 0x7f18c2a80000
> > Segmentation fault (core dumped)
> >
> > This is introduced by commit: 46bc9d75
> > 	ixgbe: fix multi-process support
> > When start primary process with command line:
> > ./app/test/test -n 1 -c ffff -m 64
> > then start the second one:
> > ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> > This segment-fault will occur.
> >
> > Root cause is test app on primary process only starts device, but
> > the queue need initialized by manually command line.
> > So the tx queue is still NULL when secondary process startup.
> >
> > Reported-by: Yong Liu <yong.liu@intel.com>
> > Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> > ---
> >  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > index 9401916..87ed6ee 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > @@ -749,9 +749,19 @@ eth_ixgbe_dev_init(__attribute__((unused))
> struct eth_driver *eth_drv,
> >  	 */
> >  	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
> >  		struct igb_tx_queue *txq;
> > -		/* TX queue function in primary, set by last queue initialized
> */
> > -		txq = eth_dev->data->tx_queues[eth_dev->data-
> >nb_tx_queues-1];
> > -		set_tx_function(eth_dev, txq);
> > +		/* TX queue function in primary, set by last queue initialized
> > +		 * Tx queue may not initialized by primary process
> > +		 * */
> > +		if (eth_dev->data->tx_queues) {
> > +			txq = eth_dev->data->tx_queues[eth_dev->data-
> >nb_tx_queues-1];
> > +			set_tx_function(eth_dev, txq);
> > +		} else {
> > +			/* Shall we exit this process if we get here? */
> 
> I'm just not sure if it is better to terminated when Tx queues are NULL
> in secondary process.
> 
Well, in case of test app, it does not need any ports, so it should work anyway.
Probably it does not make much sense to run two test processes in general,
although it is used in multiprocess unit test.

So, I would say that app should not terminate.
> Thanks
> Michael
> > +			PMD_INIT_LOG(INFO, "Last tx queue initialized fail in
> "
> > +				     "secondary process, please verify if tx "
> > +				     "queues were initialized in primary "
> > +				     "process!\n");
> > +		}
> >
> >  		if (eth_dev->data->scattered_rx)
> >  			eth_dev->rx_pkt_burst =
> ixgbe_recv_scattered_pkts;

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

* Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process
  2014-12-18 10:22 ` Qiu, Michael
  2014-12-18 10:27   ` De Lara Guarch, Pablo
@ 2014-12-18 10:28   ` Bruce Richardson
  1 sibling, 0 replies; 8+ messages in thread
From: Bruce Richardson @ 2014-12-18 10:28 UTC (permalink / raw)
  To: Qiu, Michael; +Cc: dev

On Thu, Dec 18, 2014 at 10:22:28AM +0000, Qiu, Michael wrote:
> On 12/18/2014 6:17 PM, Qiu, Michael wrote:
> > EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> > EAL:   PCI memory mapped at 0x7f18c2a00000
> > EAL:   PCI memory mapped at 0x7f18c2a80000
> > Segmentation fault (core dumped)
> >
> > This is introduced by commit: 46bc9d75
> > 	ixgbe: fix multi-process support
> > When start primary process with command line:
> > ./app/test/test -n 1 -c ffff -m 64
> > then start the second one:
> > ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> > This segment-fault will occur.
> >
> > Root cause is test app on primary process only starts device, but
> > the queue need initialized by manually command line.
> > So the tx queue is still NULL when secondary process startup.
> >
> > Reported-by: Yong Liu <yong.liu@intel.com>
> > Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> > ---
> >  lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > index 9401916..87ed6ee 100644
> > --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> > @@ -749,9 +749,19 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
> >  	 */
> >  	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
> >  		struct igb_tx_queue *txq;
> > -		/* TX queue function in primary, set by last queue initialized */
> > -		txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
> > -		set_tx_function(eth_dev, txq);
> > +		/* TX queue function in primary, set by last queue initialized
> > +		 * Tx queue may not initialized by primary process
> > +		 * */
> > +		if (eth_dev->data->tx_queues) {
> > +			txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
> > +			set_tx_function(eth_dev, txq);
> > +		} else {
> > +			/* Shall we exit this process if we get here? */
> 
> I'm just not sure if it is better to terminated when Tx queues are NULL
> in secondary process.
> 
> Thanks
> Michael

No, don't terminate. Printing a message is enough.


> > +			PMD_INIT_LOG(INFO, "Last tx queue initialized fail in "
> > +				     "secondary process, please verify if tx "
> > +				     "queues were initialized in primary "
> > +				     "process!\n");
> > +		}

Maybe shorten message to: "No TX queues configured yet. Using default TX function."

> >  
> >  		if (eth_dev->data->scattered_rx)
> >  			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
> 
> 

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

* Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process
  2014-12-18 10:16 [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process Michael Qiu
  2014-12-18 10:22 ` Qiu, Michael
@ 2014-12-18 10:38 ` De Lara Guarch, Pablo
  2014-12-19  6:59 ` [dpdk-dev] [PATCH v2] " Michael Qiu
  2 siblings, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2014-12-18 10:38 UTC (permalink / raw)
  To: Qiu, Michael, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Qiu
> Sent: Thursday, December 18, 2014 10:17 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start
> secondary process
> 
> EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> EAL:   PCI memory mapped at 0x7f18c2a00000
> EAL:   PCI memory mapped at 0x7f18c2a80000
> Segmentation fault (core dumped)
> 
> This is introduced by commit: 46bc9d75
> 	ixgbe: fix multi-process support
> When start primary process with command line:
> ./app/test/test -n 1 -c ffff -m 64
> then start the second one:
> ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> This segment-fault will occur.
> 
> Root cause is test app on primary process only starts device, but
> the queue need initialized by manually command line.
> So the tx queue is still NULL when secondary process startup.
> 
> Reported-by: Yong Liu <yong.liu@intel.com>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* [dpdk-dev] [PATCH v2] ixgbe: fix segmentation fault when start secondary process
  2014-12-18 10:16 [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process Michael Qiu
  2014-12-18 10:22 ` Qiu, Michael
  2014-12-18 10:38 ` De Lara Guarch, Pablo
@ 2014-12-19  6:59 ` Michael Qiu
  2014-12-19  8:28   ` Thomas Monjalon
  2 siblings, 1 reply; 8+ messages in thread
From: Michael Qiu @ 2014-12-19  6:59 UTC (permalink / raw)
  To: dev

EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
EAL:   PCI memory mapped at 0x7f18c2a00000
EAL:   PCI memory mapped at 0x7f18c2a80000
Segmentation fault (core dumped)

This is introduced by commit: 46bc9d75
	ixgbe: fix multi-process support
When start primary process with command line:
./app/test/test -n 1 -c ffff -m 64
then start the second one:
./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
This segment-fault will occur.

Root cause is test app on primary process only starts device, but
the queue need initialized by manually command line.
So the tx queue is still NULL when secondary process startup.

Reported-by: Yong Liu <yong.liu@intel.com>
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
v2 --> v1:
	Log clean up

 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9401916..d585aa4 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -749,9 +749,17 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
 		struct igb_tx_queue *txq;
-		/* TX queue function in primary, set by last queue initialized */
-		txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
-		set_tx_function(eth_dev, txq);
+		/* TX queue function in primary, set by last queue initialized
+		 * Tx queue may not initialized by primary process
+		 * */
+		if (eth_dev->data->tx_queues) {
+			txq = eth_dev->data->tx_queues[eth_dev->data->nb_tx_queues-1];
+			set_tx_function(eth_dev, txq);
+		} else {
+			/* Use default TX function if we get here */
+			PMD_INIT_LOG(INFO, "No TX queues configured yet. "
+					   "Using default TX function\n");
+		}
 
 		if (eth_dev->data->scattered_rx)
 			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH v2] ixgbe: fix segmentation fault when start secondary process
  2014-12-19  6:59 ` [dpdk-dev] [PATCH v2] " Michael Qiu
@ 2014-12-19  8:28   ` Thomas Monjalon
  2014-12-19 22:40     ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2014-12-19  8:28 UTC (permalink / raw)
  To: Michael Qiu; +Cc: dev

2014-12-19 14:59, Michael Qiu:
> EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> EAL:   PCI memory mapped at 0x7f18c2a00000
> EAL:   PCI memory mapped at 0x7f18c2a80000
> Segmentation fault (core dumped)
> 
> This is introduced by commit: 46bc9d75
> 	ixgbe: fix multi-process support
> When start primary process with command line:
> ./app/test/test -n 1 -c ffff -m 64
> then start the second one:
> ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> This segment-fault will occur.
> 
> Root cause is test app on primary process only starts device, but
> the queue need initialized by manually command line.
> So the tx queue is still NULL when secondary process startup.
> 
> Reported-by: Yong Liu <yong.liu@intel.com>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
> v2 --> v1:
> 	Log clean up

Clean-up failed: no need of \n in PMD_INIT_LOG ;)

> +			PMD_INIT_LOG(INFO, "No TX queues configured yet. "
> +					   "Using default TX function\n");

-- 
Thomas

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

* Re: [dpdk-dev] [PATCH v2] ixgbe: fix segmentation fault when start secondary process
  2014-12-19  8:28   ` Thomas Monjalon
@ 2014-12-19 22:40     ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2014-12-19 22:40 UTC (permalink / raw)
  To: Michael Qiu; +Cc: dev

2014-12-19 09:28, Thomas Monjalon:
> 2014-12-19 14:59, Michael Qiu:
> > EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
> > EAL:   PCI memory mapped at 0x7f18c2a00000
> > EAL:   PCI memory mapped at 0x7f18c2a80000
> > Segmentation fault (core dumped)
> > 
> > This is introduced by commit: 46bc9d75
> > 	ixgbe: fix multi-process support
> > When start primary process with command line:
> > ./app/test/test -n 1 -c ffff -m 64
> > then start the second one:
> > ./app/test/test -n 1 --proc-type=secondary --file-prefix=rte
> > This segment-fault will occur.
> > 
> > Root cause is test app on primary process only starts device, but
> > the queue need initialized by manually command line.
> > So the tx queue is still NULL when secondary process startup.
> > 
> > Reported-by: Yong Liu <yong.liu@intel.com>
> > Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> > ---
> > v2 --> v1:
> > 	Log clean up
> 
> Clean-up failed: no need of \n in PMD_INIT_LOG ;)
> 
> > +			PMD_INIT_LOG(INFO, "No TX queues configured yet. "
> > +					   "Using default TX function\n");

Applied with above change. 

Thanks
-- 
Thomas

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

end of thread, other threads:[~2014-12-19 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18 10:16 [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process Michael Qiu
2014-12-18 10:22 ` Qiu, Michael
2014-12-18 10:27   ` De Lara Guarch, Pablo
2014-12-18 10:28   ` Bruce Richardson
2014-12-18 10:38 ` De Lara Guarch, Pablo
2014-12-19  6:59 ` [dpdk-dev] [PATCH v2] " Michael Qiu
2014-12-19  8:28   ` Thomas Monjalon
2014-12-19 22:40     ` Thomas Monjalon

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