All of lore.kernel.org
 help / color / mirror / Atom feed
From: Devesh Sharma <devesh.s.sharma@oracle.com>
To: "yangx.jy@fujitsu.com" <yangx.jy@fujitsu.com>
Cc: "rpearsonhpe@gmail.com" <rpearsonhpe@gmail.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"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: Tue, 11 Jan 2022 10:21:29 +0000	[thread overview]
Message-ID: <CO6PR10MB5635A2B575EB279CB07330F2DD519@CO6PR10MB5635.namprd10.prod.outlook.com> (raw)
In-Reply-To: <61DD4990.7060908@fujitsu.com>



> -----Original Message-----
> From: yangx.jy@fujitsu.com <yangx.jy@fujitsu.com>
> Sent: Tuesday, January 11, 2022 2:41 PM
> To: Devesh Sharma <devesh.s.sharma@oracle.com>
> Cc: rpearsonhpe@gmail.com; leon@kernel.org; linux-rdma@vger.kernel.org
> Subject: [External] : Re: [PATCH rdma-core RESEND] providers/rxe: Replace
> '%' with '&' in check_qp_queue_full()
> 
> On 2022/1/11 12:12, Devesh Sharma wrote:
> >
> >> -----Original Message-----
> >> From: Xiao Yang<yangx.jy@fujitsu.com>
> >> Sent: Tuesday, January 11, 2022 7:54 AM
> >> To: rpearsonhpe@gmail.com; leon@kernel.org
> >> Cc: linux-rdma@vger.kernel.org; Xiao Yang<yangx.jy@fujitsu.com>
> >> Subject: [PATCH rdma-core RESEND] providers/rxe: Replace '%' with '&'
> >> in
> >> check_qp_queue_full()
> >>
> >> 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))
> > Are you sure that index_mask would always be aligned with 2^X?
> Hi Deves,
> 
> I think it is.  index_mask is alwasy set to 2^X -1 in kernel:

Cool looks good, other than comments from Leon.
Reviewed-By: Devesh Sharma <devesh.s.sharma@oracle.com>

> ----------------------------------------------------------------
> struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe, int *num_elem,
>                          unsigned int elem_size, enum queue_type type) {
>      ...
>      num_slots = *num_elem + 1;
>      num_slots = roundup_pow_of_two(num_slots);
>      q->index_mask = num_slots - 1;
>      ...
> }
> ----------------------------------------------------------------
> 
> Best Regards,
> Xiao Yang
> >>   		qp->err = ENOSPC;
> >>   err:
> >>   	return qp->err;
> >> --
> >> 2.25.1
> >>
> >>

  reply	other threads:[~2022-01-11 10:21 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 [this message]
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
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=CO6PR10MB5635A2B575EB279CB07330F2DD519@CO6PR10MB5635.namprd10.prod.outlook.com \
    --to=devesh.s.sharma@oracle.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=yangx.jy@fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.