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 B598CA0032; Sat, 13 Nov 2021 18:23:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1352741142; Sat, 13 Nov 2021 18:23:07 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 3F2F64113E for ; Sat, 13 Nov 2021 18:23:03 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso9670464pji.0 for ; Sat, 13 Nov 2021 09:23:03 -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=e8+nPjP7smHDAYprT7XQl6F2FYo/5X4X5wSW+yCSU8erpwBpaireoPsY5qfLW5fAQz jxE1zjR0xd+vn3vYHK1MkS+Jnw7scj1F3rWzrGJ0SNkUdsqujylb1nuXE8VFjMhg8s/w SmyuketZlypqZM0xu663rVu1PLTwPFrulEjLNh0c7IS/K8orDcTs4R1K9ySRceX2rZni xXK1WGpPJRzLKKGgnN91UYu/K7+wKbnIz1XdaqX5Oad4zUy1dBtyBc2cdUgJCRxHgbLl Cr8/Erqlo2/raNOz/hZMvQinDuKZPBJ87PjY0+Dlm6Q4tbE82snS1GVHz/beXVbiLaIZ caXg== 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=vQBf0q/cR+O6DfSv5W39oXsEZ2f3uMIKNFcyyPo48S1gswEoGG8DZ+sIu+ca0gMyDe gsTBglgJMp5hXz2KDlEWBJWlOfQwWhrpuelVTuDEeHD/ZOiRgr7isZ3BNhlUjEam9Tev H/9yi+IGS0c1ZrmdPqh+jtBHB1hJEUlvdaUdXNVXEzlJZc5OxDKQAOmZE9xGFFrO/vWv 1pUNfD8Lnjmr/t1gHsspO4R8BpaPncsnMQoVSOzNwqIX2nWn1gqfg3Al43tnwVpG1D1o Cu4Zmnt+0sgWIth4BH2FKfWG3CrS36bAvIfOdAM87DgzYraFRQ0+2X3ukOvCjWUmpYDF hQ+Q== X-Gm-Message-State: AOAM531wbCPW/ntxE9Id7TBWwhx3DcH5HqfKfVrVxE6W6AyehQjSMURX sk4wgXUXa3Eb1RA0I2ApDquuAZnP54Rm1g== X-Google-Smtp-Source: ABdhPJz8o7EJTSWD5+trMRd5uzOjlVtQNcmGo+A7foA6lOdA/rD8XQUPlmf86fNDoajtF1pj/FHQAw== X-Received: by 2002:a17:902:8302:b0:143:6e5f:a4a0 with SMTP id bd2-20020a170902830200b001436e5fa4a0mr18945647plb.20.1636824182127; Sat, 13 Nov 2021 09:23:02 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id u19sm9658370pfl.185.2021.11.13.09.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Nov 2021 09:23:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, Anatoly Burakov Subject: [PATCH v6 2/5] eal: mp: end the multiprocess thread during cleanup Date: Sat, 13 Nov 2021 09:22:54 -0800 Message-Id: <20211113172257.6543-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211113172257.6543-1-stephen@networkplumber.org> References: <20200428235827.15383-1-stephen@networkplumber.org> <20211113172257.6543-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