From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id E7DB22C5 for ; Mon, 30 Jul 2018 18:16:50 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fkAp4-00009D-Ng; Mon, 30 Jul 2018 16:15:02 +0000 From: Christian Ehrhardt To: Anatoly Burakov Cc: Qi Zhang , dpdk stable Date: Mon, 30 Jul 2018 18:11:20 +0200 Message-Id: <20180730161342.16566-35-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730161342.16566-1-christian.ehrhardt@canonical.com> References: <20180730161342.16566-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'ipc: fix locking while sending messages' has been queued to stable release 18.05.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2018 16:16:51 -0000 Hi, FYI, your patch has been queued to stable release 18.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/01/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 27fdec7f7575c83d08c7765916f449676a66f0b3 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Wed, 27 Jun 2018 10:44:25 +0100 Subject: [PATCH] ipc: fix locking while sending messages [ upstream commit 53fd532e3961092b51c536fc6760ad91c6e4bb93 ] Previously, we were putting an exclusive lock to prevent secondary processes spinning up while we are sending our messages. However, using exclusive locks had an effect of disallowing multiple simultaenous unrelated messages/requests being sent, which was not the intention behind locking. Fix it to put a shared lock on the directory. That way, we still prevent secondary process initializations while sending data over IPC, but allow multiple unrelated transmissions to proceed. Fixes: 89f1fe7e6d95 ("eal: lock IPC directory on init and send") Signed-off-by: Anatoly Burakov Tested-by: Qi Zhang --- lib/librte_eal/common/eal_common_proc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 707d8ab30..f010ef59e 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -786,7 +786,7 @@ mp_send(struct rte_mp_msg *msg, const char *peer, int type) dir_fd = dirfd(mp_dir); /* lock the directory to prevent processes spinning up while we send */ - if (flock(dir_fd, LOCK_EX)) { + if (flock(dir_fd, LOCK_SH)) { RTE_LOG(ERR, EAL, "Unable to lock directory %s\n", mp_dir_path); rte_errno = errno; @@ -1020,7 +1020,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, dir_fd = dirfd(mp_dir); /* lock the directory to prevent processes spinning up while we send */ - if (flock(dir_fd, LOCK_EX)) { + if (flock(dir_fd, LOCK_SH)) { RTE_LOG(ERR, EAL, "Unable to lock directory %s\n", mp_dir_path); closedir(mp_dir); @@ -1146,7 +1146,7 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, dir_fd = dirfd(mp_dir); /* lock the directory to prevent processes spinning up while we send */ - if (flock(dir_fd, LOCK_EX)) { + if (flock(dir_fd, LOCK_SH)) { RTE_LOG(ERR, EAL, "Unable to lock directory %s\n", mp_dir_path); rte_errno = errno; -- 2.17.1