From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2DA83A0C4B; Sat, 13 Nov 2021 04:32:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97D6D41142; Sat, 13 Nov 2021 04:32:19 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 3C924410F5 for ; Sat, 13 Nov 2021 04:32:16 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id np3so8269424pjb.4 for ; Fri, 12 Nov 2021 19:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VYpX6bLx1EhWZsQ9qfNftUoy9mDG929BoSttXJ4o5Mg=; b=u38MsoIhD+w6HFPATJqyDfuhT/yAFd1VBoNSy3SJvdjlqWzzSxkuEp73RftUDydz6S vvlha5FUshDbMu4PvtXx5Z+vjtMjhesSlY+4MTufNBRrlH3Ocu7xTZq/Q4SU9DvdK8GR ZpYBXfDSouTC1jKjIyP+aXk2H0qTrZwn4gaVrL1UfvhPL6TrY/OvsCLkM5L4fzSDv01k +AoFviCZMQBUoBq/20GM4m+iEPCYMtAaPFt/W5JJ1X1RYWsM7N+8ffYFFwHj4DnJUp1i bxMxZH/jqhSm3mZ3EakW9/mDMpSWm7DyQ9hAWP1//VUkP8OSsO2/L+QW2hIDDkimrCez vDag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VYpX6bLx1EhWZsQ9qfNftUoy9mDG929BoSttXJ4o5Mg=; b=xpRpZ3ULpa+JRVw8rb1Um4xIHn42cwcLMml4yY9sKw3Pg3RDZeOpX7UDD+Ti3Bo6+x auKbOom+CkHbPXk189SAQSGNbeZnWGqa8fESIIcYPIbzpyQYr1D5eH6QqDoGTYp9Osfo +vN0ohtNg8l04+JVvTRN24mlWmpj9aZJsYFcNjJ8k+Srtb3+I1nYOwXJlhTB6ShB/mPI GSn2JBUa1xqVkvVXbJq/Dz8ENQTJFaD3l2PiyMtU/8qk77l7uCkYutmrluy1O0XWMASi xA5gG/8zFPjebxtrEoQ2xVpQbIq4cL5SQ3HFzuocnlqQjnEAv32GAfCfbmBMkJHDkSsg oo0A== X-Gm-Message-State: AOAM533UcQQ6hdYy3mCsuk5JXKfyPbPCAD8hd5FkgtTqNVqxxHs7nvH2 snj4+NGkm5HXitgBk8lsf6puRoeQQmk7Ig== X-Google-Smtp-Source: ABdhPJxCze3E37svt+OUbFlhHHDcOZA+wo2LrUYIIQzomwxcQWpTAPoIAPioE432zNw14f0fnbJXmw== X-Received: by 2002:a17:90a:a88e:: with SMTP id h14mr41365218pjq.41.1636774335049; Fri, 12 Nov 2021 19:32:15 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id b9sm5999596pgf.15.2021.11.12.19.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 19:32:14 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, Anatoly Burakov Subject: [PATCH v5 2/5] eal: mp: end the multiprocess thread during cleanup Date: Fri, 12 Nov 2021 19:32:06 -0800 Message-Id: <20211113033209.341027-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211113033209.341027-1-stephen@networkplumber.org> References: <20200428235827.15383-1-stephen@networkplumber.org> <20211113033209.341027-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/eal/common/eal_common_proc.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c index ebd0f6673b8b..b33d58ea0a0f 100644 --- a/lib/eal/common/eal_common_proc.c +++ b/lib/eal/common/eal_common_proc.c @@ -282,8 +282,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; } @@ -311,7 +320,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 @@ -385,8 +394,13 @@ mp_handle(void *arg __rte_unused) struct sockaddr_un sa; while (mp_fd >= 0) { - if (read_msg(&msg, &sa) == 0) - process_msg(&msg, &sa); + int ret; + + ret = read_msg(&msg, &sa); + if (ret <= 0) + break; + + process_msg(&msg, &sa); } return NULL; -- 2.30.2