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 D29961B429 for ; Fri, 23 Nov 2018 11:30:47 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 435FCC0587DF; Fri, 23 Nov 2018 10:30:47 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1B652A2E4; Fri, 23 Nov 2018 10:30:45 +0000 (UTC) From: Kevin Traynor To: Anatoly Burakov Cc: Stephen Hemminger , dpdk stable Date: Fri, 23 Nov 2018 10:27:06 +0000 Message-Id: <20181123102713.17309-62-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 23 Nov 2018 10:30:47 +0000 (UTC) Subject: [dpdk-stable] patch 'ipc: remove panic in async request' has been queued to stable release 18.08.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: Fri, 23 Nov 2018 10:30:48 -0000 Hi, FYI, your patch has been queued to stable release 18.08.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 11/29/18. 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. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 13f9973d55a67efb40fd67d2ea3d976d0058db0d Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 13 Nov 2018 18:03:52 +0000 Subject: [PATCH] ipc: remove panic in async request [ upstream commit 45e5f49e87fba07c1e63f1630a3c76fc89a198a4 ] EAL should not crash when setting alarm fails. Also, remove the profanity in error message. Fixes: daf9bfca717e ("ipc: remove thread for async requests") Signed-off-by: Stephen Hemminger Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_proc.c | 31 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 97663d3ba..f65ef56c0 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -801,5 +801,5 @@ mp_request_async(const char *dst, struct rte_mp_msg *req, struct rte_mp_msg *reply_msg; struct pending_request *pending_req, *exist; - int ret; + int ret = -1; pending_req = calloc(1, sizeof(*pending_req)); @@ -828,4 +828,26 @@ mp_request_async(const char *dst, struct rte_mp_msg *req, } + /* + * set the alarm before sending message. there are two possible error + * scenarios to consider here: + * + * - if the alarm set fails, we free the memory right there + * - if the alarm set succeeds but sending message fails, then the alarm + * will trigger and clean up the memory + * + * Even if the alarm triggers too early (i.e. immediately), we're still + * holding the lock to pending requests queue, so the interrupt thread + * will just spin until we release the lock, and either release the + * memory, or doesn't find any pending requests in the queue because we + * never added any due to send message failure. + */ + if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000, + async_reply_handle, pending_req) < 0) { + RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n", + dst, req->name); + ret = -1; + goto fail; + } + ret = send_msg(dst, req, MP_REQ); if (ret < 0) { @@ -842,11 +864,4 @@ mp_request_async(const char *dst, struct rte_mp_msg *req, param->user_reply.nb_sent++; - if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000, - async_reply_handle, pending_req) < 0) { - RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n", - dst, req->name); - rte_panic("Fix the above shit to properly free all memory\n"); - } - return 0; fail: -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-23 10:22:55.850275211 +0000 +++ 0062-ipc-remove-panic-in-async-request.patch 2018-11-23 10:22:54.000000000 +0000 @@ -1,13 +1,14 @@ -From 45e5f49e87fba07c1e63f1630a3c76fc89a198a4 Mon Sep 17 00:00:00 2001 +From 13f9973d55a67efb40fd67d2ea3d976d0058db0d Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 13 Nov 2018 18:03:52 +0000 Subject: [PATCH] ipc: remove panic in async request +[ upstream commit 45e5f49e87fba07c1e63f1630a3c76fc89a198a4 ] + EAL should not crash when setting alarm fails. Also, remove the profanity in error message. Fixes: daf9bfca717e ("ipc: remove thread for async requests") -Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Signed-off-by: Anatoly Burakov