DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 07/11] net/hns3: fix segment error when closing the port
Date: Thu, 9 Jan 2020 11:15:55 +0800	[thread overview]
Message-ID: <20200109031559.63194-8-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200109031559.63194-1-huwei013@chinasoftinc.com>

From: Hongbo Zheng <zhenghongbo3@huawei.com>

Currently there is a certain probability of segment error in concurrent
reset when the port is closing.
The calltrace info:

This GDB was configured as "aarch64-redhat-linux-gnu".
Reading symbols from /usr/app/testpmd...(no debugging symbols found)...
 done.
[New LWP 98204]
[New LWP 98203]
[New LWP 98206]
[New LWP 98205]
[New LWP 98207]
[New LWP 98208]
Missing separate debuginfo for /root/lib/libnuma.so.1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/app/testpmd --log-level=6 --socket-mem 16'.
Program terminated with signal 11, Segmentation fault.
Missing separate debuginfos, use:
 debuginfo-install glibc-2.17-260.el7.aarch64
(gdb) bt
in hns3vf_service_handler ()
1  0x00000000006988b8 in eal_alarm_callback ()
2  0x00000000006969b4 in eal_intr_thread_main ()
3  0x0000ffffb08d6c48 in start_thread () from /lib64/libpthread.so.0
4  0x0000ffffb0828600 in thread_start () from /lib64/libc.so.6
(gdb)

Reset process may turn on the cancelled link state timer whether the
current port status is on or off, in order to solve this problem, this
patch add judge the current network port state before starting the timer,
only the port in the running state can start the link state timer, so as
to solve the problem that the link state timer accesses the null pointer
and causes the segment error.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 11 +++++++----
 drivers/net/hns3/hns3_ethdev_vf.c |  7 +++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index ca8718000..b05a55781 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4197,6 +4197,7 @@ hns3_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	hns3_set_rxtx_function(dev);
 	hns3_mp_req_start_rxtx(dev);
+	rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, dev);
 
 	hns3_info(hw, "hns3 dev start successful!");
 	return 0;
@@ -4279,6 +4280,7 @@ hns3_dev_stop(struct rte_eth_dev *dev)
 		hns3_dev_release_mbufs(hns);
 		hw->adapter_state = HNS3_NIC_CONFIGURED;
 	}
+	rte_eal_alarm_cancel(hns3_service_handler, dev);
 	rte_spinlock_unlock(&hw->lock);
 	hns3_unmap_rx_interrupt(dev);
 }
@@ -4301,7 +4303,6 @@ hns3_dev_close(struct rte_eth_dev *eth_dev)
 	hw->adapter_state = HNS3_NIC_CLOSING;
 	hns3_reset_abort(hns);
 	hw->adapter_state = HNS3_NIC_CLOSED;
-	rte_eal_alarm_cancel(hns3_service_handler, eth_dev);
 
 	hns3_configure_all_mc_mac_addr(hns, true);
 	hns3_remove_all_vlan_table(hns);
@@ -4760,7 +4761,8 @@ hns3_stop_service(struct hns3_adapter *hns)
 	struct rte_eth_dev *eth_dev;
 
 	eth_dev = &rte_eth_devices[hw->data->port_id];
-	rte_eal_alarm_cancel(hns3_service_handler, eth_dev);
+	if (hw->adapter_state == HNS3_NIC_STARTED)
+		rte_eal_alarm_cancel(hns3_service_handler, eth_dev);
 	hw->mac.link_status = ETH_LINK_DOWN;
 
 	hns3_set_rxtx_function(eth_dev);
@@ -4801,7 +4803,9 @@ hns3_start_service(struct hns3_adapter *hns)
 	eth_dev = &rte_eth_devices[hw->data->port_id];
 	hns3_set_rxtx_function(eth_dev);
 	hns3_mp_req_start_rxtx(eth_dev);
-	hns3_service_handler(eth_dev);
+	if (hw->adapter_state == HNS3_NIC_STARTED)
+		hns3_service_handler(eth_dev);
+
 	return 0;
 }
 
@@ -5059,7 +5063,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
 		hns3_notify_reset_ready(hw, false);
 	}
 
-	rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev);
 	hns3_info(hw, "hns3 dev initialization successful!");
 	return 0;
 
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 92cf7ee99..35243b2be 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1559,6 +1559,7 @@ hns3vf_dev_start(struct rte_eth_dev *dev)
 	hns3_set_rxtx_function(dev);
 	hns3_mp_req_start_rxtx(dev);
 	rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, dev);
+
 	return ret;
 }
 
@@ -1671,7 +1672,8 @@ hns3vf_stop_service(struct hns3_adapter *hns)
 	struct rte_eth_dev *eth_dev;
 
 	eth_dev = &rte_eth_devices[hw->data->port_id];
-	rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev);
+	if (hw->adapter_state == HNS3_NIC_STARTED)
+		rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev);
 	hw->mac.link_status = ETH_LINK_DOWN;
 
 	hns3_set_rxtx_function(eth_dev);
@@ -1709,8 +1711,9 @@ hns3vf_start_service(struct hns3_adapter *hns)
 	eth_dev = &rte_eth_devices[hw->data->port_id];
 	hns3_set_rxtx_function(eth_dev);
 	hns3_mp_req_start_rxtx(eth_dev);
+	if (hw->adapter_state == HNS3_NIC_STARTED)
+		hns3vf_service_handler(eth_dev);
 
-	hns3vf_service_handler(eth_dev);
 	return 0;
 }
 
-- 
2.23.0


  parent reply	other threads:[~2020-01-09  3:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  3:15 [dpdk-dev] [PATCH 00/11] misc updates and fixes for hns3 PMD driver Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 01/11] net/hns3: support different numbered Rx and Tx queues Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 02/11] net/hns3: support setting VF MAC address by PF driver Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 03/11] net/hns3: reduce the judgements of free Tx ring space Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 04/11] net/hns3: remove io rmb call in Rx operation Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 05/11] net/hns3: add free thresh " Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 06/11] net/hns3: fix Rx queue search miss RAS err when recv BC pkt Wei Hu (Xavier)
2020-01-09  3:15 ` Wei Hu (Xavier) [this message]
2020-01-09  3:15 ` [dpdk-dev] [PATCH 08/11] net/hns3: fix ring vector related mailbox command format Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 09/11] net/hns3: fix dumping VF register information Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 10/11] net/hns3: fix link status when failure in issuing command Wei Hu (Xavier)
2020-01-09  3:15 ` [dpdk-dev] [PATCH 11/11] net/hns3: fix triggering reset proceduce in slave process Wei Hu (Xavier)
2020-01-14 14:33 ` [dpdk-dev] [PATCH 00/11] misc updates and fixes for hns3 PMD driver Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109031559.63194-8-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).