[dpdk-dev,v2] ixgbe: fix segmentation fault when start secondary process
Commit Message
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(-)
Comments
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");
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
@@ -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;