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 7DC79A00BE; Wed, 29 Apr 2020 01:59:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E3AA61D689; Wed, 29 Apr 2020 01:58:50 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id E0E4F1D676 for ; Wed, 29 Apr 2020 01:58:44 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id f15so136324plr.3 for ; Tue, 28 Apr 2020 16:58:44 -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=vCz+H+/pzetFwU6oBbX+lI3Y1AzKfkVoZ+KPf5moY+GQJlZqdRUOpvc95DYl3m9r2R hocWn108Zrbn9WdXBtVfLAp6Qk77tJUo7/MS+iXxkGT3e7MEvuFwIrL6Bautsh8Vp3Eg abOz/Y4vWWNQV08PVHAZQr/fwETfp5RmF3cNAkPx+QbgopY0V/Lb4e1gBJjUSsLe6LwK quJq0xy4FM9M4aCbdydmGIrnVkaNjGQNAxYlEOzuUQkh5Z9cPo7DWL6sYqdHaj8LjyVc H+/HTq4ETWU6T7QReHTyXfI00oymbTjl081e8So6Uil7sv6ARLaCpxDKjusYZK1JgvdV aL2Q== 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=EzDve7Qf59g6hXNhJGjIh4h+eJjrNhlhKI3vk0D77IADPU3o2zrAitHmaY6F11m99L +8DAAY0iBT/MqBTqDi4mPdzEk5XvujnI2vkA7eE99ew24D+GPxYyJOz8Q7xGdjW2Zt/J bOomTV11g7e52htZdILXzjupq+6UH4iPOdcj9tGFaGqL2XVlma21H8ibFB5YTPvxURzj KcuE25P+HiAMQPtjuw+Ggh6Fhj/u/8Wh58cF+fIvSPWUDVScbJz75a93GXSEmkrK5x3s UL9XWJKuttAGSJdPpVMp6hFsbXQz0HE9MOIlY9u/UD/7b/xCvFG890iWLmLGI8XFPZtX fRdA== X-Gm-Message-State: AGi0PuY1IHoijk7HiHIOBFCyKGJn++3GSRQSsyFN9aQNN8YOu+iUgQzt h77QWLUdP12iMtUmQdQdcZpVPGrU4Nn0Pg== X-Google-Smtp-Source: APiQypJIAJ4ZVOaani2ze2F9beBtYGEKb7Cffu0hYh+u5cN5b29FnBcYfYxD6NqXQChbq9nl1o2P2w== X-Received: by 2002:a17:90a:224a:: with SMTP id c68mr31650pje.160.1588118323502; Tue, 28 Apr 2020 16:58:43 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id h193sm16209471pfe.30.2020.04.28.16.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:58:42 -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:58:24 -0700 Message-Id: <20200428235827.15383-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428235827.15383-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> <20200428235827.15383-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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