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 1C232A04DD; Sat, 4 Jan 2020 02:34:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98CE21D544; Sat, 4 Jan 2020 02:34:03 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 40F461D527 for ; Sat, 4 Jan 2020 02:33:58 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id p14so24242956pfn.4 for ; Fri, 03 Jan 2020 17:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PsbFGiuqVzUnCaOerMQu4RnG5MXl0k+UnOHZoH5rQdc=; b=pbTl2Jr2GGVwBUC37wEggvcyMm7BS6bS4nVku+RJvj/i+v4TPMi2zl00tPT+O/4CE0 Oix8oQsWl+jGFq4IkxdcBGYXyUPe6mu4KZoE4H2lpgb7GMfOh7+WVT6RPGWI8gl+2Jfl KTPuvBm8ryW/m0uRBHBtYYwfaAN9BIH66pyLoxEygmFTY82bxujH5jDrSvys3R1ets4S vn764lAmZ/N0yBOp6gbYwyje5ZQeUf2Lg5HY0oIcQSYvqAnePFbTRw+OwfHx8G/Wqux7 zzlMMEZG0Vf61VAXgdeyb5Epjhm0R0V8CjUlvFef9fzXRXt/LzDI2KzqFQxO4dlzK6UU jBaw== 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=PsbFGiuqVzUnCaOerMQu4RnG5MXl0k+UnOHZoH5rQdc=; b=kPlAmNQSOZpe49WtYJKVjisDVZXpv+5LbUL9qlltstHhNUJpKAw9HzXzgMglI0zmPt YO6KGWkQ++aQaIQR/CaWpg+6+TjXlLwWp5HJASkYi7CoweBz8WdALg/Shk0u9ZpqfAv/ ITcszVl4ovLLB8kFOudnANxB1iddZPt+5hH/RBcxgxl6s0xg1/h8E35+3ua0R4wGdl9z zoqeDKe5eBOiIZ8qHxHKjE4pU7qTV3379Qctrs/CnipkizKlhKtlsT4V5+yndC3ppNDi odxolBwkSebXy6MI4pwFQbPTKTbbS13hiK/t8u6MS5cPpFNoVxsC/8ii3QwsK+l1oIgc xOnA== X-Gm-Message-State: APjAAAWHobFMWTQspWXHxhvjswisOmKpvPg6uUYSPP0oOw3fZxTpVFE0 bezmDqvtBFoLrzbk8RyHjxv4mfBIu6I= X-Google-Smtp-Source: APXvYqzdWTH3WXCDnSteZkKMfL046ixZryY8gj0Z/wmSC2d8Ym9bEh27Sylb5S6nLMzOGs+Zwpj43Q== X-Received: by 2002:a63:1908:: with SMTP id z8mr99875054pgl.350.1578101636864; Fri, 03 Jan 2020 17:33:56 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:33:56 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, stable@dpdk.org Date: Fri, 3 Jan 2020 17:33:33 -0800 Message-Id: <20200104013341.19809-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 06/14] eal: mp: end the multiprocess thread during cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called, all control threads should exit. For the mp thread, this best handled by closing the mp_socket and letting the thread see that. This also fixes potential problems where the mp_socket gets another hard error, and the thread runs away repeating itself by reading the same error. Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup") Cc: qi.z.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_proc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 935e8fefeba8..f369d8bf6dd8 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -276,8 +276,17 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) msgh.msg_control = control; msgh.msg_controllen = sizeof(control); +retry: msglen = recvmsg(mp_fd, &msgh, 0); + + /* zero length message means socket was closed */ + if (msglen == 0) + return 0; + if (msglen < 0) { + if (errno == EINTR) + goto retry; + RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno)); return -1; } @@ -305,7 +314,7 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s) RTE_LOG(ERR, EAL, "invalid received data length\n"); return -1; } - return 0; + return msglen; } static void @@ -376,10 +385,8 @@ mp_handle(void *arg __rte_unused) struct mp_msg_internal msg; struct sockaddr_un sa; - while (1) { - if (read_msg(&msg, &sa) == 0) - process_msg(&msg, &sa); - } + while (read_msg(&msg, &sa) > 0) + process_msg(&msg, &sa); return NULL; } -- 2.20.1