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 5406DA0032; Sat, 13 Nov 2021 01:28:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D251F41144; Sat, 13 Nov 2021 01:28:32 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 3DE7A410F6 for ; Sat, 13 Nov 2021 01:28:31 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id k4so9665606plx.8 for ; Fri, 12 Nov 2021 16:28:31 -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=fJuOsJODkP2ULOBKB9PHlzqTOCSIKkuSfhb6PW+dmO27SqXpW/6eWeOrdh8OvKEWAu vOV222GZQJAkczLaoC7jUvA8ixLchGzIVej8/rgLOxcFGtIDeecZzdE484UYGq/0uOUn 1wR49/wzhlZwVfQmzSoR+PixPLhHJL+LGnoKCjo24UyuueWahA00v7yqurqMfiiIzxfY pIo0j+HW97Czo2FY2CB+A3Fzj/MS75ywVIGikqjRKs4o+vtxm8zGpbQ5btGKajer/sSy 5Z+Vyd+hRyLAFDmJgOgSJGQFZKAeHC7I1Y0wVpsYvyY7Zy44wHgoRpK05lOT8vpB4CzJ R1UQ== 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=rtXaq+yk+4vtw8T5HNQrig4dv4/mF2Eatu86aITj4BReGV1+7rDzs1HmK9rRp9Oylj D+SvIQxMgtNpuGNVKo8M+e5id5Aqcx4O6N3X3nbTN3DUHIbqPjb142nqjT2ooj4jfyKE 2hrFi4s7IRjVzLLXHCZFo6FdZoz5gNuw8Gp+Zd3Orn+adHC056XYLUjuh4SrDKJURat8 HGmvX1NBTXC4S/twe8Wb6TPdKOyxcq3Uj79+T2usrtzKbje1WoCwJbsV9ZbYEa+qXdvw ct47QP3A6qhJpWXBJDbWxfN2GmAyQiM3WqxrS8pKMWYZbR5cyv66OzvGU65aPu+1i/c6 8bUQ== X-Gm-Message-State: AOAM531zWb4U3+t4FaLYXlAgDOmra4US7nB3PETNth8594X/PlS7ZKTf BNqiP7LtuJDcxkCIJHoBi2hUoQnXQDo4ng== X-Google-Smtp-Source: ABdhPJzPRxGi4BcuQ8Ka50zNexGDXDJayvz/VlskruI05R5D52MqMf87AdSp6OGRcd7o79p/zg9X6Q== X-Received: by 2002:a17:902:c412:b0:141:f716:e192 with SMTP id k18-20020a170902c41200b00141f716e192mr12833773plk.88.1636763310167; Fri, 12 Nov 2021 16:28:30 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id z10sm7687748pfh.106.2021.11.12.16.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 16:28:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , qi.z.zhang@intel.com, Anatoly Burakov Subject: [PATCH v4 2/5] eal: mp: end the multiprocess thread during cleanup Date: Fri, 12 Nov 2021 16:28:21 -0800 Message-Id: <20211113002824.338343-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211113002824.338343-1-stephen@networkplumber.org> References: <20200428235827.15383-1-stephen@networkplumber.org> <20211113002824.338343-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