Skip to contentSkip to conversation

ixgbe: fix segmentation fault when start secondary process

PATCH Superseded Michael Qiu 4 participants 8 messages Dec 18, 2014 – Dec 19, 2014 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +13 -3
index 9401916..87ed6ee 100644
@@ -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;
Signature · 1 line
1.9.3
#1 lore raw
Quoted 32 lines · Michael
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.

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -1
index 9401916..87ed6ee 100644
@@ -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 */

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 759

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +8 -2
-		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

Quoted 8 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +5 -0
+			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;

A message that is not in the archive (sent off-list or not yet received): 533710CFB86FA344BFBF2D6802E60286CA0D64-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org

#3 lore raw
Quoted 45 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Qiu, Michael
Sent: Thursday, December 18, 2014 10:22 AM
To: [email protected]
Subject: Re: [dpdk-dev] [PATCH] ixgbe: fix segmentation fault when start secondary process

Quoted 17 lines · Michael
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.

Review

Quoted 7 lines
---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused))

Quoted 4 lines

index 9401916..87ed6ee 100644

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
@@ -749,9 +749,19 @@ eth_ixgbe_dev_init(__attribute__((unused))

struct eth_driver *eth_drv,

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -1
 	 */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY){
 		struct igb_tx_queue *txq;
-		/* TX queue function in primary, set by last queue initialized

*/

Quoted 16 lines

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 759

Quoted 12 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +8 -2
-		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.

Quoted 12 lines

Thanks
Michael

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) · line 762

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -0
+			PMD_INIT_LOG(INFO, "Last tx queue initialized fail in

"

lib/librte_pmd_ixgbe/ixgbe_ethdev.c

Quoted 7 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -0
+				     "secondary process, please verify if tx "
+				     "queues were initialized in primary "
+				     "process!\n");
+		}
 
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
 		if (eth_dev->data->scattered_rx)
 			eth_dev->rx_pkt_burst =

ixgbe_recv_scattered_pkts;

#4 lore raw
In reply to a message not in the archive
Quoted 47 lines · Michael
Quoted 32 lines · Michael
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.

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -1
index 9401916..87ed6ee 100644
@@ -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 */

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 759

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +8 -2
-		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.

Quoted 2 lines

Thanks
Michael

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

Quoted 5 lines

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 764

Quoted 5 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +5 -0
+			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."

Quoted 5 lines
Quoted 3 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
 		if (eth_dev->data->scattered_rx)
 			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;

A message that is not in the archive (sent off-list or not yet received): 1418897809-14674-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#6 lore raw
Quoted 22 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michael Qiu
Sent: Thursday, December 18, 2014 10:17 AM
To: [email protected]
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.

Quoted 6 lines

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.

#7 lore raw

PATCH v2 1/1 ixgbe: fix segmentation fault when start secondary process

In reply to a message not in the archive
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.

---
v2 --> v1:
Log clean up

 lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +11 -3
index 9401916..d585aa4 100644
@@ -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;
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1418972358-17130-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#9 lore raw

2014-12-19 14:59, Michael Qiu:

Quoted 17 lines
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.

Quoted 5 lines

---
v2 --> v1:
Log clean up

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

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -0
+			PMD_INIT_LOG(INFO, "No TX queues configured yet. "
+					   "Using default TX function\n");
Signature · 1 line
Thomas
#10 lore raw

2014-12-19 09:28, Thomas Monjalon:

Quoted 24 lines

2014-12-19 14:59, Michael Qiu:

Quoted 17 lines
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.

Quoted 5 lines

---
v2 --> v1:
Log clean up

Quoted 4 lines

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

lib/librte_pmd_ixgbe/ixgbe_ethdev.c eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, · line 761

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -0
+			PMD_INIT_LOG(INFO, "No TX queues configured yet. "
+					   "Using default TX function\n");

Applied with above change.

Thanks

Signature · 1 line
Thomas