From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B067A051C for ; Tue, 11 Feb 2020 12:28:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 219172B9C; Tue, 11 Feb 2020 12:28:37 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id EE6132B9C for ; Tue, 11 Feb 2020 12:28:35 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id c9so11910381wrw.8 for ; Tue, 11 Feb 2020 03:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mYu+wi6g/6HTIcx01Od2GCziDF0QXqSVV8COXSaZWCw=; b=nfwsbkSCHP5ID5Rd8CUqfWgLmILuw0M6fArYYNX+SU23uxpL+kP1erQGdupWhT+HFD RGy5GAyUVp0pzBDVsTyR17iCWWhNiCRn2ZmgmTxjYHpDIGT3K8TM/9sNVBiY6jq3Rray McAgQIl4Sd6N8deQDOwa3+FywxbAYKumAOtYCPp7dLhThBXdCITBpk6uGa5L2rjg4uXW X1cc7UZes23PS8AoQoppzHVmXnCpI7cz7mKV0a/DFdFxUyxRi/DsnGTPTjKLx+LcYnS0 741YjRWWikx9FD2yQ5IGGT2VXsQQKV5EHkqJX2ZXzMBpIxAcTR8NqJ14MwBqO3L6wcAH 94lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mYu+wi6g/6HTIcx01Od2GCziDF0QXqSVV8COXSaZWCw=; b=cYaaKy/hflKYT12atgTk49sU8R2otPgUw9C01m0YXkKJGr5zPXsLHFX/GGYWyfrmKd UxRwhCGLvb7abLyqkVePnsXll9PdTB2Ukh1IVUnW1DBq6GhK/rllvd/SiVJcSLtsjL/M DHkDW0YiZFwVyW9BJJWPLsiYzyGEFtkeDG6a1COfrbU7Q47k2Tfp6s3rdI4oJQZoeB9M ty85xdIOk/lO4Z8hS5nJGZhBvBQFgRE7UkA+b1D+HddmSJbpvQpis23OZglV3DKZFpbK lJjvfpp27wVtoG5UaqtpR3IoqcCw66nIbQL4gklxg8WIcQnlc6cYID5mM45xE6W+kHVK +U6w== X-Gm-Message-State: APjAAAUFoLbHUgx+fcVJHAahXS6AvBkS25yPBxPWCTCDSGH/6fPhZQ7m SEiHdWWCxc9nKdJ1ZGI1X34= X-Google-Smtp-Source: APXvYqyb7FKV9/C7w1j2up53kQeVEgPaH6u5HBsAbNSBmL1mCeJ0MqCABJvkJusZ8G1BjLLAyBsNjA== X-Received: by 2002:adf:dd0b:: with SMTP id a11mr8545941wrm.150.1581420515645; Tue, 11 Feb 2020 03:28:35 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l131sm3454186wmf.31.2020.02.11.03.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:28:35 -0800 (PST) From: luca.boccassi@gmail.com To: Hongbo Zheng Cc: Wei Hu , dpdk stable Date: Tue, 11 Feb 2020 11:20:25 +0000 Message-Id: <20200211112216.3929-79-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix crash when closing port' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/13/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 1ccffa698f356733175208dc31e5b460a7d724af Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Thu, 9 Jan 2020 11:15:55 +0800 Subject: [PATCH] net/hns3: fix crash when closing port [ upstream commit a3bc973a04ed597b3a7af0ae53869f3490818153 ] 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") Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) --- 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 a85196cfb9..f41a2fefd8 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4073,6 +4073,7 @@ hns3_dev_start(struct rte_eth_dev *eth_dev) rte_spinlock_unlock(&hw->lock); hns3_set_rxtx_function(eth_dev); hns3_mp_req_start_rxtx(eth_dev); + rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); hns3_info(hw, "hns3 dev start successful!"); return 0; @@ -4121,6 +4122,7 @@ hns3_dev_stop(struct rte_eth_dev *eth_dev) hns3_dev_release_mbufs(hns); hw->adapter_state = HNS3_NIC_CONFIGURED; } + rte_eal_alarm_cancel(hns3_service_handler, eth_dev); rte_spinlock_unlock(&hw->lock); } @@ -4142,7 +4144,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); @@ -4603,7 +4604,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); @@ -4644,7 +4646,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; } @@ -4900,7 +4904,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 b1736e73ab..2c792b1761 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1352,6 +1352,7 @@ hns3vf_dev_start(struct rte_eth_dev *eth_dev) hns3_mp_req_start_rxtx(eth_dev); rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, eth_dev); + return 0; } @@ -1464,7 +1465,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); @@ -1502,8 +1504,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.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:41.720251714 +0000 +++ 0079-net-hns3-fix-crash-when-closing-port.patch 2020-02-11 11:17:38.516003516 +0000 @@ -1,8 +1,10 @@ -From a3bc973a04ed597b3a7af0ae53869f3490818153 Mon Sep 17 00:00:00 2001 +From 1ccffa698f356733175208dc31e5b460a7d724af Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Thu, 9 Jan 2020 11:15:55 +0800 Subject: [PATCH] net/hns3: fix crash when closing port +[ upstream commit a3bc973a04ed597b3a7af0ae53869f3490818153 ] + Currently there is a certain probability of segment error in concurrent reset when the port is closing. The calltrace info: @@ -39,7 +41,6 @@ null pointer and causes the segment error. Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) @@ -49,26 +50,26 @@ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index ca87180007..b05a557814 100644 +index a85196cfb9..f41a2fefd8 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); +@@ -4073,6 +4073,7 @@ hns3_dev_start(struct rte_eth_dev *eth_dev) + rte_spinlock_unlock(&hw->lock); + hns3_set_rxtx_function(eth_dev); + hns3_mp_req_start_rxtx(eth_dev); ++ rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); hns3_info(hw, "hns3 dev start successful!"); return 0; -@@ -4279,6 +4280,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) +@@ -4121,6 +4122,7 @@ hns3_dev_stop(struct rte_eth_dev *eth_dev) hns3_dev_release_mbufs(hns); hw->adapter_state = HNS3_NIC_CONFIGURED; } -+ rte_eal_alarm_cancel(hns3_service_handler, dev); ++ rte_eal_alarm_cancel(hns3_service_handler, eth_dev); rte_spinlock_unlock(&hw->lock); - hns3_unmap_rx_interrupt(dev); } -@@ -4301,7 +4303,6 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) + +@@ -4142,7 +4144,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; @@ -76,7 +77,7 @@ 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) +@@ -4603,7 +4604,8 @@ hns3_stop_service(struct hns3_adapter *hns) struct rte_eth_dev *eth_dev; eth_dev = &rte_eth_devices[hw->data->port_id]; @@ -86,7 +87,7 @@ hw->mac.link_status = ETH_LINK_DOWN; hns3_set_rxtx_function(eth_dev); -@@ -4801,7 +4803,9 @@ hns3_start_service(struct hns3_adapter *hns) +@@ -4644,7 +4646,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); @@ -97,7 +98,7 @@ return 0; } -@@ -5059,7 +5063,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) +@@ -4900,7 +4904,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) hns3_notify_reset_ready(hw, false); } @@ -106,18 +107,18 @@ return 0; diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index f151e89472..505525eba6 100644 +index b1736e73ab..2c792b1761 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); +@@ -1352,6 +1352,7 @@ hns3vf_dev_start(struct rte_eth_dev *eth_dev) + hns3_mp_req_start_rxtx(eth_dev); + rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, + eth_dev); + - return ret; + return 0; } -@@ -1671,7 +1672,8 @@ hns3vf_stop_service(struct hns3_adapter *hns) +@@ -1464,7 +1465,8 @@ hns3vf_stop_service(struct hns3_adapter *hns) struct rte_eth_dev *eth_dev; eth_dev = &rte_eth_devices[hw->data->port_id]; @@ -127,7 +128,7 @@ hw->mac.link_status = ETH_LINK_DOWN; hns3_set_rxtx_function(eth_dev); -@@ -1709,8 +1711,9 @@ hns3vf_start_service(struct hns3_adapter *hns) +@@ -1502,8 +1504,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);