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 07BC1A00BE; Wed, 29 Apr 2020 01:15:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46BCF1D656; Wed, 29 Apr 2020 01:14:42 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id D697E1D649 for ; Wed, 29 Apr 2020 01:14:33 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id s10so101397plr.1 for ; Tue, 28 Apr 2020 16:14:33 -0700 (PDT) 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=Yql0Efy+OmCLtVPaFMHWydRJ5AExA7LMI4P8O2x2IOs=; b=J5AJSzCXLIW89peeqjeHdS54l4B0YrYLw8y3kwTW2/S1nhkIiUyFuJBHD0u34ikjOt H274C2lpzRXGQtyCgwPDvhH6AIJC7+vojkQXXJ7aZwQTuCsnHfE06nhDL2EeIawxYIn+ try5y8ce/PslpAug2J3SN7QaXOESSOvY/qXxM6qVqfFZLaC6L54StKDwpK+MVXsDjGW5 77CmMFGDXt5tsQ1PmSrKAOmL3W8IiVcJ957mDkzFW9qDCq8CEx0jdLRR5KwpNwKPXuPk CY8rukp0KS3tHOo8LGy+FYa26V2qCkna8FmMCDrGs0ivW9mhhn9WyO90May7xykYlMem TzrQ== 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=Yql0Efy+OmCLtVPaFMHWydRJ5AExA7LMI4P8O2x2IOs=; b=F6RnCE4ByCpps+VyhQexlbOW8AZmHFZDwyu87NowZAPGiZqj0sHQHfwv9plMe43ShF LIIRXFqZA8ItTu1cyXRpmalJhSKs9OXi2dwnUwztKMW9hPGxOH4e5l6HJogCbKLgWHgf i5HED7Tkj+/04DSUF7ZWRGymOED6f7NgU8yAt2hklklts5VqqWFkoFPYIt5NZOR7ZofG bFl4coqlagz7xSh3F9rNPZtjnelFiYsQNb14DZY+aNrpcfMKXpcJQOSGFG2DNE/giPvN SZAgu+CpiSkdCY6rW3WrxkvQv5cxaNaE4OiGtDr9U0wCfPzIi7G/jhe9XKaddo6N0fFP T7rg== X-Gm-Message-State: AGi0PuZ9UjjHkYbiPI/RA/RyeOclVYaTwyOC7l9e6eLosi8TKzea8bQ7 7UXcV0WHvjk35C9tYkMX00mN1yrFgjeY8g== X-Google-Smtp-Source: APiQypIiQIf9tPvi/CeC+pqbEq0m3850qKvE9tahCmhW5HKuhoQLOdQm9/yK4vpFA+HWDc9bGicnHg== X-Received: by 2002:a17:902:8e87:: with SMTP id bg7mr22707762plb.91.1588115672555; Tue, 28 Apr 2020 16:14:32 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l64sm3230454pjb.44.2020.04.28.16.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:14:31 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, stable@dpdk.org, Anatoly Burakov Date: Tue, 28 Apr 2020 16:14:12 -0700 Message-Id: <20200428231415.17985-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428231415.17985-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> <20200428231415.17985-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 5/8] 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 Acked-by: Anatoly Burakov --- 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