patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	qi.z.zhang@intel.com, stable@dpdk.org,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [dpdk-stable] [PATCH v2 5/8] eal: mp: end the multiprocess thread during cleanup
Date: Tue, 28 Apr 2020 16:14:12 -0700
Message-ID: <20200428231415.17985-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20200428231415.17985-1-stephen@networkplumber.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
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 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


  parent reply	other threads:[~2020-04-28 23:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200104013341.19809-1-stephen@networkplumber.org>
2020-01-04  1:33 ` [dpdk-stable] [PATCH 06/14] " Stephen Hemminger
2020-04-27 15:37   ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2020-01-04  1:33 ` [dpdk-stable] [PATCH 08/14] eal: vfio: cleanup the mp sync handle Stephen Hemminger
2020-04-27 12:12   ` Burakov, Anatoly
2020-01-04  1:33 ` [dpdk-stable] [PATCH 10/14] tap: close netlink socket on device close Stephen Hemminger
2020-04-25 15:52   ` [dpdk-stable] [dpdk-dev] " David Marchand
     [not found] ` <20200428231415.17985-1-stephen@networkplumber.org>
2020-04-28 23:14   ` Stephen Hemminger [this message]
2020-04-28 23:14   ` [dpdk-stable] [PATCH v2 6/8] eal: vfio: cleanup the mp sync handle Stephen Hemminger
     [not found] ` <20200428235827.15383-1-stephen@networkplumber.org>
2020-04-28 23:58   ` [dpdk-stable] [PATCH v3 5/8] eal: mp: end the multiprocess thread during cleanup Stephen Hemminger
2020-04-28 23:58   ` [dpdk-stable] [PATCH v3 6/8] eal: vfio: cleanup the mp sync handle Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428231415.17985-6-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git