Skip to contentSkip to conversation

net/hinic: fix coredump when secondary process using the hinic port.

PATCH Superseded liqingqing 2 participants 6 messages Aug 8, 2020 – Oct 13, 2020 2 messages not in the archive Network drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

liqingqing

author
#0 lore raw

PATCH 1/1 net/hinic: fix coredump when secondary process using the hinic port.

From 2eb6ad4d30af54f309f35f16a39a119aa26e7911 Mon Sep 17 00:00:00 2001
From: liqingqing <[email protected]>
Date: Sat, 8 Aug 2020 00:03:25 -0400
Subject: [PATCH] fix coredump when secondary process using the hinic port. the
reason is that during the stage of secondary process port initialization, it lack the initialization of "eth_dev->dev_ops".

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +12 -9
index 67e6afcf7..26c6098d3 100644
@@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	int rc;
 
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
-	/* EAL is SECONDARY and eth_dev is already created */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-			    eth_dev->data->name);
-
-		return 0;
-	}
-
 	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 	memset(nic_dev, 0, sizeof(*nic_dev));
 
@@ -3206,6 +3197,18 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = hinic_recv_pkts;
 	eth_dev->tx_pkt_burst = hinic_xmit_pkts;
 
+	/* EAL is SECONDARY and eth_dev is already created */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		PMD_DRV_LOG(INFO, "Initialize %s in secondary process", eth_dev->data->name);
+
+		struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+		if (HINIC_IS_VF(nic_dev->hwdev))
+			eth_dev->dev_ops = &hinic_pmd_vf_ops;
+		else
+			eth_dev->dev_ops = &hinic_pmd_ops;
+		return 0;
+	}
+
 	return hinic_func_init(eth_dev);
 }
 
Signature · 1 line
2.19.1
author
#1 lore raw

PATCH v2 1/1 net/hinic: fix secondary process's using coredump.

fix coredump when secondary process using the hinic port. the reason is that during the stage of
secondary process port initialization,
it lack the initialization of "eth_dev->dev_ops".

---
v2: solve the coding style issue.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +12 -9
index 67e6afcf7..26c6098d3 100644
@@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	int rc;
 
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
-	/* EAL is SECONDARY and eth_dev is already created */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-			    eth_dev->data->name);
-
-		return 0;
-	}
-
 	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 	memset(nic_dev, 0, sizeof(*nic_dev));
 
@@ -3206,6 +3197,18 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = hinic_recv_pkts;
 	eth_dev->tx_pkt_burst = hinic_xmit_pkts;
 
+	/* EAL is SECONDARY and eth_dev is already created */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		PMD_DRV_LOG(INFO, "Initialize %s in secondary process", eth_dev->data->name);
+
+		struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+		if (HINIC_IS_VF(nic_dev->hwdev))
+			eth_dev->dev_ops = &hinic_pmd_vf_ops;
+		else
+			eth_dev->dev_ops = &hinic_pmd_ops;
+		return 0;
+	}
+
 	return hinic_func_init(eth_dev);
 }
 
Signature · 1 line
2.19.1
#2 lore raw

Re: [dpdk-dev] [PATCH v2] net/hinic: fix secondary process's using coredump.

Quoted 6 lines · liqingqing

fix coredump when secondary process using the hinic port. the reason is that during the stage of
secondary process port initialization,
it lack the initialization of "eth_dev->dev_ops".

Hi,

Overall patch looks good but can you please add your name and surname to the sign off, to make it following syntax:

Also what do you think about following patch title:
"net/hinic: fix crash in secondary process"

Quoted 45 lines

---
v2: solve the coding style issue.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +12 -9
index 67e6afcf7..26c6098d3 100644
@@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	int rc;
 
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
-	/* EAL is SECONDARY and eth_dev is already created */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-			    eth_dev->data->name);
-
-		return 0;
-	}
-
 	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 	memset(nic_dev, 0, sizeof(*nic_dev));
 
@@ -3206,6 +3197,18 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = hinic_recv_pkts;
 	eth_dev->tx_pkt_burst = hinic_xmit_pkts;
 
+	/* EAL is SECONDARY and eth_dev is already created */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		PMD_DRV_LOG(INFO, "Initialize %s in secondary process", eth_dev->data->name);
+
+		struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+		if (HINIC_IS_VF(nic_dev->hwdev))
+			eth_dev->dev_ops = &hinic_pmd_vf_ops;
+		else
+			eth_dev->dev_ops = &hinic_pmd_ops;
+		return 0;
+	}
+
 	return hinic_func_init(eth_dev);
 }
 
#3 lore raw

Re: [dpdk-dev] [PATCH v2] net/hinic: fix secondary process's using coredump.

Quoted 8 lines · Ferruh Yigit
Quoted 6 lines · liqingqing

fix coredump when secondary process using the hinic port. the reason is that during the stage of
secondary process port initialization,
it lack the initialization of "eth_dev->dev_ops".

Quoted 9 lines

Hi,

Overall patch looks good but can you please add your name and surname to the sign off, to make it following syntax:

Also what do you think about following patch title:
"net/hinic: fix crash in secondary process"

Hi Ziyang, Xiaoyun, Guoyang,

Can you please review the patch, also can you please help on getting the correct sign off?

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#6 lore raw

PATCH v3 1/1 net/hinic: fix secondary process's using coredump.

fix coredump when secondary process using the hinic port. the reason is that during the stage of
secondary process port initialization,
it lack the initialization of "eth_dev->dev_ops".

---
v3: update the signed-off information.
---
v2: solve the coding style issue.

---
 drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +12 -9
index 67e6afcf7..26c6098d3 100644
@@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
 	int rc;
 
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
-	/* EAL is SECONDARY and eth_dev is already created */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-			    eth_dev->data->name);
-
-		return 0;
-	}
-
 	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
 	memset(nic_dev, 0, sizeof(*nic_dev));
 
@@ -3206,6 +3197,18 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = hinic_recv_pkts;
 	eth_dev->tx_pkt_burst = hinic_xmit_pkts;
 
+	/* EAL is SECONDARY and eth_dev is already created */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		PMD_DRV_LOG(INFO, "Initialize %s in secondary process", eth_dev->data->name);
+
+		struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+		if (HINIC_IS_VF(nic_dev->hwdev))
+			eth_dev->dev_ops = &hinic_pmd_vf_ops;
+		else
+			eth_dev->dev_ops = &hinic_pmd_ops;
+		return 0;
+	}
+
 	return hinic_func_init(eth_dev);
 }
 
Signature · 1 line
2.19.1
#7 lore raw

Re: [dpdk-dev] [PATCH v3] net/hinic: fix secondary process's using coredump.

Quoted 44 lines · On 10/9/2020 8:47 AM, l00283554 wrote:

fix coredump when secondary process using the hinic port. the reason is that during the stage of
secondary process port initialization,
it lack the initialization of "eth_dev->dev_ops".

---
v3: update the signed-off information.
---
v2:  solve the coding style issue.

---
  drivers/net/hinic/hinic_pmd_ethdev.c | 21 ++++++++++++---------
  1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +4 -9
index 67e6afcf7..26c6098d3 100644
@@ -3060,15 +3060,6 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
      int rc;
 
      pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-
-    /* EAL is SECONDARY and eth_dev is already created */
-    if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-        PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
-                eth_dev->data->name);
-
-        return 0;
-    }
-
      nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
      memset(nic_dev, 0, sizeof(*nic_dev));
 
@@ -3206,6 +3197,18 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
      eth_dev->rx_pkt_burst = hinic_recv_pkts;
      eth_dev->tx_pkt_burst = hinic_xmit_pkts;
 
+    /* EAL is SECONDARY and eth_dev is already created */
+    if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+        PMD_DRV_LOG(INFO, "Initialize %s in secondary process", 
 eth_dev->data->name);
+

drivers/net/hinic/hinic_pmd_ethdev.c static int hinic_dev_init(struct rte_eth_dev *eth_dev) · line 3214

Quoted 10 lines
drivers/net/hinic/hinic_pmd_ethdev.c +8 -0
+        struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);
+        if (HINIC_IS_VF(nic_dev->hwdev))
+            eth_dev->dev_ops = &hinic_pmd_vf_ops;
+        else
+            eth_dev->dev_ops = &hinic_pmd_ops;
+        return 0;
+    }
+
      return hinic_func_init(eth_dev);
  }

Overall looks good to me, waiting ack from driver maintainers.

Meanwhile the patch doesn't apply cleanly, it seems same problem in the CI, can you please rebase on top of latest head and send the patch again?