[dpdk-stable] patch 'eal: fix race condition in IPC request' has been queued to stable release 18.02.2

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Apr 30 16:02:49 CEST 2018


Hi,

FYI, your patch has been queued to stable release 18.02.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/02/18. So please
shout if anyone has objections.

Thanks.

Luca Boccassi

---
>From a5e34315c77ba67440c715f5f8340750d8b9e36c Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Fri, 2 Mar 2018 08:41:37 +0000
Subject: [PATCH] eal: fix race condition in IPC request

[ upstream commit da5957821bdd684a50dcb639fb7798936fb2d981 ]

Unlocking the action list before sending message and locking it
again afterwards introduces a window where a response might
arrive before we have a chance to start waiting on a condition,
resulting in timeouts on valid messages.

Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan at intel.com>
---
 lib/librte_eal/common/eal_common_proc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c
index 3a1088e2f..da7930f56 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -561,10 +561,10 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
 	exist = find_sync_request(dst, req->name);
 	if (!exist)
 		TAILQ_INSERT_TAIL(&sync_requests.requests, &sync_req, next);
-	pthread_mutex_unlock(&sync_requests.lock);
 	if (exist) {
 		RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
 		rte_errno = EEXIST;
+		pthread_mutex_unlock(&sync_requests.lock);
 		return -1;
 	}
 
@@ -578,7 +578,6 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
 
 	reply->nb_sent++;
 
-	pthread_mutex_lock(&sync_requests.lock);
 	do {
 		pthread_cond_timedwait(&sync_req.cond, &sync_requests.lock, ts);
 		/* Check spurious wakeups */
-- 
2.14.2



More information about the stable mailing list