From: Bart Van Assche <bart.vanassche@wdc.com>
To: Jason Gunthorpe <jgg@mellanox.com>
Cc: Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org,
Bart Van Assche <bart.vanassche@wdc.com>,
Moni Shoua <monis@mellanox.com>,
stable@vger.kernel.org
Subject: [PATCH] RDMA/rxe: Fix a race condition related to the QP error state
Date: Tue, 9 Jan 2018 11:23:40 -0800 [thread overview]
Message-ID: <20180109192340.25702-1-bart.vanassche@wdc.com> (raw)
The following sequence:
* Change queue pair state into IB_QPS_ERR.
* Post a work request on the queue pair.
Triggers the following race condition in the rdma_rxe driver:
* rxe_qp_error() triggers an asynchronous call of rxe_completer(), the function
that examines the QP send queue.
* rxe_post_send() posts a work request on the QP send queue.
Avoid that this race causes a work request to be ignored by scheduling
an rxe_completer() call from rxe_post_send() for queues that are in the
error state.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Moni Shoua <monis@mellanox.com>
Cc: <stable@vger.kernel.org> # v4.8
---
drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index a6fbed48db8a..8f631d64c192 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -814,6 +814,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, struct ib_send_wr *wr,
(queue_count(qp->sq.queue) > 1);
rxe_run_task(&qp->req.task, must_sched);
+ if (unlikely(qp->req.state == QP_STATE_ERROR))
+ rxe_run_task(&qp->comp.task, 1);
return err;
}
--
2.15.1
next reply other threads:[~2018-01-09 19:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 19:23 Bart Van Assche [this message]
2018-01-10 21:40 ` [PATCH] RDMA/rxe: Fix a race condition related to the QP error state Doug Ledford
2018-01-10 22:01 ` Doug Ledford
2018-01-11 6:22 ` Leon Romanovsky
[not found] ` <20180111062252.GP7368-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-11 16:02 ` Bart Van Assche
[not found] ` <1515686552.2752.2.camel-Sjgp3cTcYWE@public.gmane.org>
2018-01-11 19:00 ` Leon Romanovsky
2018-01-11 19:07 ` Bart Van Assche
2018-01-12 6:23 ` Leon Romanovsky
[not found] ` <20180112062359.GG15760-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-12 6:32 ` Bart Van Assche
2018-01-12 6:38 ` Leon Romanovsky
2018-01-11 11:27 ` Moni Shoua
2018-01-11 16:16 ` Bart Van Assche
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=20180109192340.25702-1-bart.vanassche@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=dledford@redhat.com \
--cc=jgg@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=monis@mellanox.com \
--cc=stable@vger.kernel.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox