linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "yangx.jy@fujitsu.com" <yangx.jy@fujitsu.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: "rpearsonhpe@gmail.com" <rpearsonhpe@gmail.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-core RESEND] providers/rxe: Replace '%' with '&' in check_qp_queue_full()
Date: Wed, 12 Jan 2022 03:39:13 +0000	[thread overview]
Message-ID: <61DE4D5F.50303@fujitsu.com> (raw)
In-Reply-To: <Yd1gTDZ7bq/Ixg3y@unreal>

On 2022/1/11 18:47, Leon Romanovsky wrote:
> On Tue, Jan 11, 2022 at 09:19:46AM +0000, yangx.jy@fujitsu.com wrote:
>> On 2022/1/11 14:11, Leon Romanovsky wrote:
>>> On Tue, Jan 11, 2022 at 10:24:04AM +0800, Xiao Yang wrote:
>>>> The expression "cons == ((qp->cur_index + 1) % q->index_mask)" mistakenly
>>>> assumes the queue is full when the number of entires is equal to "maximum - 1"
>>>> (maximum is correct).
>>>>
>>>> For example:
>>>> If cons and qp->cur_index are 0 and q->index_mask is 1, check_qp_queue_full()
>>>> reports ENOSPC.
>>>>
>>>> Fixes: 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")
>>>> Signed-off-by: Xiao Yang<yangx.jy@fujitsu.com>
>>>> ---
>>>>    providers/rxe/rxe_queue.h | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/providers/rxe/rxe_queue.h b/providers/rxe/rxe_queue.h
>>>> index 6de8140c..708e76ac 100644
>>>> --- a/providers/rxe/rxe_queue.h
>>>> +++ b/providers/rxe/rxe_queue.h
>>>> @@ -205,7 +205,7 @@ static inline int check_qp_queue_full(struct rxe_qp *qp)
>>>>    	if (qp->err)
>>>>    		goto err;
>>>>
>>>> -	if (cons == ((qp->cur_index + 1) % q->index_mask))
>>>> +	if (cons == ((qp->cur_index + 1)&   q->index_mask))
>>> Please reuse queue_full().
>> Hi Leon,
>>
>> qp->cur_index and qp->err are introduced for new ibv_wr_* APIs and I am
>> not sure if check_qp_queue_full() can be replaced with queue_full().
>>
>> Bob, do you have any suggestion?
>
> diff --git a/providers/rxe/rxe_queue.h b/providers/rxe/rxe_queue.h
> index 6de8140c..83eb4a5f 100644
> --- a/providers/rxe/rxe_queue.h
> +++ b/providers/rxe/rxe_queue.h
> @@ -198,14 +198,11 @@ static inline void advance_qp_cur_index(struct rxe_qp *qp)
>   static inline int check_qp_queue_full(struct rxe_qp *qp)
>   {
>          struct rxe_queue_buf *q = qp->sq.queue;
> -       uint32_t cons;
> -
> -       cons = atomic_load_explicit(consumer(q), memory_order_acquire);
>
>          if (qp->err)
>                  goto err;
>
> -       if (cons == ((qp->cur_index + 1) % q->index_mask))
> +       if (queue_full(q))
>                  qp->err = ENOSPC;
>   err:
>          return qp->err;
> (END)
>
Hi Leon,

This change using q->producer_index makes qp->cur_index unused.
According to commit 1a894ca10105, qp->cur_index and related functions 
(advance_qp_cur_index() , check_qp_queue_full()) are introduced for 
ibv_wr_* APIs on purpose.
I am not sure if we can replace qp->cur_index with q->producer_index 
directly. I think we need Bob to confirm it.
By the way, could we just fix the issue here?

Best Regards,
Xiao Yang
>> Best Regards,
>> Xiao Yang
>>> Thanks
>>>
>>>>    		qp->err = ENOSPC;
>>>>    err:
>>>>    	return qp->err;
>>>> -- 
>>>> 2.25.1
>>>>
>>>>
>>>>

  reply	other threads:[~2022-01-12  3:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  2:24 [PATCH rdma-core RESEND] providers/rxe: Replace '%' with '&' in check_qp_queue_full() Xiao Yang
2022-01-11  4:12 ` Devesh Sharma
2022-01-11  9:10   ` yangx.jy
2022-01-11 10:21     ` Devesh Sharma
2022-01-11  6:11 ` Leon Romanovsky
2022-01-11  9:19   ` yangx.jy
2022-01-11 10:47     ` Leon Romanovsky
2022-01-12  3:39       ` yangx.jy [this message]
2022-01-18  8:37 ` yangx.jy

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=61DE4D5F.50303@fujitsu.com \
    --to=yangx.jy@fujitsu.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).