diff mbox

[rdma-core,1/1] mlx5: Fix bug in disabling lock on extended CQ

Message ID 1525956521-11960-1-git-send-email-rzambre@uci.edu (mailing list archive)
State Accepted
Headers show

Commit Message

Rohit Zambre May 10, 2018, 12:48 p.m. UTC
Currently, the lock on an extended CQ is still taken even if the user sets
the IBV_CREATE_CQ_ATTR_SINGLE_THREADED flag. This is because the
MLX5_CQ_FLAGS_SINGLE_THREADED flag is not set before mlx5_cq_fill_pfns.

This patch sets the MLX5_CQ_FLAGS_SINGLE_THREADED flag after allocating
the extended CQ and before calling mlx5_cq_fill_pfns, allowing correct
control on the lock in mlx5_start_poll and mlx5_end_poll.

Thanks,
Signed-off-by: Rohit Zambre <rzambre@uci.edu>
---
 providers/mlx5/verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Jason Gunthorpe May 14, 2018, 4:26 p.m. UTC | #1
On Thu, May 10, 2018 at 12:48:41PM +0000, Rohit Zambre wrote:
> Currently, the lock on an extended CQ is still taken even if the user sets
> the IBV_CREATE_CQ_ATTR_SINGLE_THREADED flag. This is because the
> MLX5_CQ_FLAGS_SINGLE_THREADED flag is not set before mlx5_cq_fill_pfns.
> 
> This patch sets the MLX5_CQ_FLAGS_SINGLE_THREADED flag after allocating
> the extended CQ and before calling mlx5_cq_fill_pfns, allowing correct
> control on the lock in mlx5_start_poll and mlx5_end_poll.
> 
> Thanks,
> Signed-off-by: Rohit Zambre <rzambre@uci.edu>
> ---
>  providers/mlx5/verbs.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Sure looks right to me, Yishai?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yishai Hadas May 17, 2018, 1:30 p.m. UTC | #2
On 5/14/2018 7:26 PM, Jason Gunthorpe wrote:
> On Thu, May 10, 2018 at 12:48:41PM +0000, Rohit Zambre wrote:
>> Currently, the lock on an extended CQ is still taken even if the user sets
>> the IBV_CREATE_CQ_ATTR_SINGLE_THREADED flag. This is because the
>> MLX5_CQ_FLAGS_SINGLE_THREADED flag is not set before mlx5_cq_fill_pfns.
>>
>> This patch sets the MLX5_CQ_FLAGS_SINGLE_THREADED flag after allocating
>> the extended CQ and before calling mlx5_cq_fill_pfns, allowing correct
>> control on the lock in mlx5_start_poll and mlx5_end_poll.
>>
>> Thanks,
>> Signed-off-by: Rohit Zambre <rzambre@uci.edu>
>> ---
>>   providers/mlx5/verbs.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> Sure looks right to me, Yishai?
> 

Yes, it's correct, thanks.
I have opened a PR for that [1] with the matching "Fixes:" line, merged.

[1]
https://github.com/linux-rdma/rdma-core/pull/334


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rohit Zambre May 17, 2018, 3:42 p.m. UTC | #3
Thank you,
Rohit Zambre

On Thu, May 17, 2018 at 8:30 AM, Yishai Hadas
<yishaih@dev.mellanox.co.il> wrote:
> On 5/14/2018 7:26 PM, Jason Gunthorpe wrote:
>>
>> On Thu, May 10, 2018 at 12:48:41PM +0000, Rohit Zambre wrote:
>>>
>>> Currently, the lock on an extended CQ is still taken even if the user
>>> sets
>>> the IBV_CREATE_CQ_ATTR_SINGLE_THREADED flag. This is because the
>>> MLX5_CQ_FLAGS_SINGLE_THREADED flag is not set before mlx5_cq_fill_pfns.
>>>
>>> This patch sets the MLX5_CQ_FLAGS_SINGLE_THREADED flag after allocating
>>> the extended CQ and before calling mlx5_cq_fill_pfns, allowing correct
>>> control on the lock in mlx5_start_poll and mlx5_end_poll.
>>>
>>> Thanks,
>>> Signed-off-by: Rohit Zambre <rzambre@uci.edu>
>>> ---
>>>   providers/mlx5/verbs.c | 7 ++++---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>>
>> Sure looks right to me, Yishai?
>>
>
> Yes, it's correct, thanks.
> I have opened a PR for that [1] with the matching "Fixes:" line, merged.
>
> [1]
> https://github.com/linux-rdma/rdma-core/pull/334
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index 4dd40b2..c3dcee8 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -653,6 +653,10 @@  static struct ibv_cq_ex *create_cq(struct ibv_context *context,
 		return NULL;
 	}
 
+	if (cq_attr->comp_mask & IBV_CQ_INIT_ATTR_MASK_FLAGS &&
+	    cq_attr->flags & IBV_CREATE_CQ_ATTR_SINGLE_THREADED)
+		cq->flags |= MLX5_CQ_FLAGS_SINGLE_THREADED;
+
 	if (cq_alloc_flags & MLX5_CQ_FLAGS_EXTENDED) {
 		rc = mlx5_cq_fill_pfns(cq, cq_attr, mctx);
 		if (rc) {
@@ -698,9 +702,6 @@  static struct ibv_cq_ex *create_cq(struct ibv_context *context,
 	cq->cqe_sz			= cqe_sz;
 	cq->flags			= cq_alloc_flags;
 
-	if (cq_attr->comp_mask & IBV_CQ_INIT_ATTR_MASK_FLAGS &&
-	    cq_attr->flags & IBV_CREATE_CQ_ATTR_SINGLE_THREADED)
-		cq->flags |= MLX5_CQ_FLAGS_SINGLE_THREADED;
 	cmd.buf_addr = (uintptr_t) cq->buf_a.buf;
 	cmd.db_addr  = (uintptr_t) cq->dbrec;
 	cmd.cqe_size = cqe_sz;