From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id A2F941B52A for ; Thu, 7 Feb 2019 14:27:43 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 989758764B; Thu, 7 Feb 2019 13:27:42 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.33.36.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4866819CB6; Thu, 7 Feb 2019 13:27:41 +0000 (UTC) From: Kevin Traynor To: Ferruh Yigit Cc: Phil Yang , dpdk stable Date: Thu, 7 Feb 2019 13:25:28 +0000 Message-Id: <20190207132614.20538-22-ktraynor@redhat.com> In-Reply-To: <20190207132614.20538-1-ktraynor@redhat.com> References: <20190207132614.20538-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Feb 2019 13:27:42 +0000 (UTC) Subject: [dpdk-stable] patch 'examples/kni: fix crash while handling userspace request' has been queued to LTS release 18.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: , X-List-Received-Date: Thu, 07 Feb 2019 13:27:44 -0000 Hi, FYI, your patch has been queued to LTS release 18.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/14/19. 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. Kevin Traynor --- >>From 2bcf25c9a9b8a2ccfcf6dd66491eb1df9623b675 Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Tue, 15 Jan 2019 17:28:02 +0000 Subject: [PATCH] examples/kni: fix crash while handling userspace request [ upstream commit 2e06c565651eaca8034c5e3e83f25f24d6b91503 ] When KNI interface receives RTE_KNI_REQ_CFG_NETWORK_IF request, it stap/start the physical device which as a result of stop() can free all the mbufs in its queue. Meanwhile sample application continues to read from KNI interface queues and push into device queues. This simultaneous access may cause a crash, crash log can be found at defect description. As a solution KNI sample application can do the proper synchronization, and stop transfer between KNI interface and physical interface while physical device stop/started. Bugzilla ID: 116 Fixes: 3fc5ca2f6352 ("kni: initial import") Signed-off-by: Ferruh Yigit Acked-by: Phil Yang --- examples/kni/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/kni/main.c b/examples/kni/main.c index e37b1ad36..a58774a33 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -133,4 +133,5 @@ static int kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]); static rte_atomic32_t kni_stop = RTE_ATOMIC32_INIT(0); +static rte_atomic32_t kni_pause = RTE_ATOMIC32_INIT(0); /* Print out statistics on packets handled */ @@ -277,4 +278,5 @@ main_loop(__rte_unused void *arg) uint16_t i; int32_t f_stop; + int32_t f_pause; const unsigned lcore_id = rte_lcore_id(); enum lcore_rxtx { @@ -305,6 +307,9 @@ main_loop(__rte_unused void *arg) while (1) { f_stop = rte_atomic32_read(&kni_stop); + f_pause = rte_atomic32_read(&kni_pause); if (f_stop) break; + if (f_pause) + continue; kni_ingress(kni_port_params_array[i]); } @@ -315,6 +320,9 @@ main_loop(__rte_unused void *arg) while (1) { f_stop = rte_atomic32_read(&kni_stop); + f_pause = rte_atomic32_read(&kni_pause); if (f_stop) break; + if (f_pause) + continue; kni_egress(kni_port_params_array[i]); } @@ -808,4 +816,6 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) port_id, if_up ? "up" : "down"); + rte_atomic32_inc(&kni_pause); + if (if_up != 0) { /* Configure network interface up */ rte_eth_dev_stop(port_id); @@ -814,4 +824,6 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) rte_eth_dev_stop(port_id); + rte_atomic32_dec(&kni_pause); + if (ret < 0) RTE_LOG(ERR, APP, "Failed to start port %d\n", port_id); -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-02-07 13:19:56.037990014 +0000 +++ 0022-examples-kni-fix-crash-while-handling-userspace-requ.patch 2019-02-07 13:19:55.000000000 +0000 @@ -1,8 +1,10 @@ -From 2e06c565651eaca8034c5e3e83f25f24d6b91503 Mon Sep 17 00:00:00 2001 +From 2bcf25c9a9b8a2ccfcf6dd66491eb1df9623b675 Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Tue, 15 Jan 2019 17:28:02 +0000 Subject: [PATCH] examples/kni: fix crash while handling userspace request +[ upstream commit 2e06c565651eaca8034c5e3e83f25f24d6b91503 ] + When KNI interface receives RTE_KNI_REQ_CFG_NETWORK_IF request, it stap/start the physical device which as a result of stop() can free all the mbufs in its queue. @@ -16,7 +18,6 @@ Bugzilla ID: 116 Fixes: 3fc5ca2f6352 ("kni: initial import") -Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Acked-by: Phil Yang