eal: fix race condition in IPC request
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: 783b6e5497
("eal: add synchronous multi-process communication")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
This commit is contained in:
parent
139653a09a
commit
da5957821b
@ -561,10 +561,10 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
|
|||||||
exist = find_sync_request(dst, req->name);
|
exist = find_sync_request(dst, req->name);
|
||||||
if (!exist)
|
if (!exist)
|
||||||
TAILQ_INSERT_TAIL(&sync_requests.requests, &sync_req, next);
|
TAILQ_INSERT_TAIL(&sync_requests.requests, &sync_req, next);
|
||||||
pthread_mutex_unlock(&sync_requests.lock);
|
|
||||||
if (exist) {
|
if (exist) {
|
||||||
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
|
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
|
||||||
rte_errno = EEXIST;
|
rte_errno = EEXIST;
|
||||||
|
pthread_mutex_unlock(&sync_requests.lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +578,6 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
|
|||||||
|
|
||||||
reply->nb_sent++;
|
reply->nb_sent++;
|
||||||
|
|
||||||
pthread_mutex_lock(&sync_requests.lock);
|
|
||||||
do {
|
do {
|
||||||
pthread_cond_timedwait(&sync_req.cond, &sync_requests.lock, ts);
|
pthread_cond_timedwait(&sync_req.cond, &sync_requests.lock, ts);
|
||||||
/* Check spurious wakeups */
|
/* Check spurious wakeups */
|
||||||
|
Loading…
Reference in New Issue
Block a user