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 91E55A04DD for ; Sat, 4 Jan 2020 02:34:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 67D911D53E; Sat, 4 Jan 2020 02:34:03 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id A7F8A1D52D for ; Sat, 4 Jan 2020 02:33:57 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id b137so24142479pga.6 for ; Fri, 03 Jan 2020 17:33:57 -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=hqnxInQLgmju7q4RyaQixigmz2EoKYscGlmBXGJYReBCuQ2PvWwVaWwe3PBmZpmLMt Ru974F1DL77SVeOXUrZvlho0YzhFcE5LITOLWDHN4tfQiz1BDrg3Bz4PfPfSaqyYMV3K BocWWWVsEthleDZOvf6uE7RYdMa9LYaPFcgdOboLzyedhUXypHCMQbkAtUPhDKN4pCfG ltxwiqEaH0Gpoj8EvNx3W2eDBy0g05beLsIfhLmZ9GapNhQbzPvODUQRrYETZS+lE4E1 PoVJCdHQddCYwICA1mJJZMTaFZVRfROVsH2umzNMeJrAGy1OsjZYxJ7dKNUcdIn/EXmp K65A== X-Gm-Message-State: APjAAAVyNXlcC0y+ev+wu4gTpm7FgJKuFj30n/gJC7Lg+UOHToq6wVwV Bqvki4vIpIhOwsSy0tPikMh2cv+JNaQ= 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-stable] [PATCH 06/14] eal: mp: end the multiprocess thread during cleanup 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" 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