public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Lang Cheng <chenglang@huawei.com>
Cc: Weihang Li <liweihang@huawei.com>,
	dledford@redhat.com, jgg@nvidia.com, linux-rdma@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH for-next 1/3] RDMA/hns: Enable all CMDQ context
Date: Sun, 4 Apr 2021 13:14:15 +0300	[thread overview]
Message-ID: <YGmRd+ZzaKGrYcQo@unreal> (raw)
In-Reply-To: <3782ed3b-f630-8174-5d65-6a458fcdcd8f@huawei.com>

On Fri, Apr 02, 2021 at 09:26:38AM +0800, Lang Cheng wrote:
> 
> 
> On 2021/4/1 21:08, Leon Romanovsky wrote:
> > On Thu, Apr 01, 2021 at 03:32:19PM +0800, Weihang Li wrote:
> > > From: Lang Cheng <chenglang@huawei.com>
> > > 
> > > Fix error of cmd's context number calculation algorithm to enable all of
> > > 32 cmd entries and support 32 concurrent accesses.
> > > 
> > > Signed-off-by: Lang Cheng <chenglang@huawei.com>
> > > Signed-off-by: Weihang Li <liweihang@huawei.com>
> > > ---
> > >   drivers/infiniband/hw/hns/hns_roce_cmd.c    | 62 ++++++++++++-----------------
> > >   drivers/infiniband/hw/hns/hns_roce_device.h |  6 +--
> > >   2 files changed, 27 insertions(+), 41 deletions(-)
> > 
> > <...>
> > 
> > > -	WARN_ON(cmd->free_head < 0);
> > > -	context = &cmd->context[cmd->free_head];
> > > -	context->token += cmd->token_mask + 1;
> > > -	cmd->free_head = context->next;
> > > +
> > > +	do {
> > > +		context = &cmd->context[cmd->free_head];
> > > +		cmd->free_head = context->next;
> > > +	} while (context->busy);
> > > +
> > > +	context->busy = 1;
> > 
> > This "busy" flag after do-while together with release in __hns_roce_cmd_mbox_wait()
> > is interesting thing. Are you sure that it won't loop forever here?
> > 
> 
> When initializing resources in hns_roce_cmd_use_events(), ensure that the
> number of semaphores is consistent with the depth of context[].
> 
> int hns_roce_cmd_use_events( )
> {
> 	hr_cmd->context = kcalloc(hr_cmd->max_cmds, ...);
> 	sema_init(&hr_cmd->event_sem, hr_cmd->max_cmds);
> }
> 
> Then, when someone gets the event_sem in hns_roce_cmd_mbox_wait(), it means
> that there must be a not busy context.

OK, thanks

> 
> Thanks.
> 
> > Thanks
> > .
> > 

> null

  reply	other threads:[~2021-04-04 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  7:32 [PATCH for-next 0/3] RDMA/hns: Updates of CMDQ Weihang Li
2021-04-01  7:32 ` [PATCH for-next 1/3] RDMA/hns: Enable all CMDQ context Weihang Li
2021-04-01 13:08   ` Leon Romanovsky
2021-04-02  1:26     ` Lang Cheng
2021-04-04 10:14       ` Leon Romanovsky [this message]
2021-04-01  7:32 ` [PATCH for-next 2/3] RDMA/hns: Support more return types of command queue Weihang Li
2021-04-01  7:32 ` [PATCH for-next 3/3] RDMA/hns: Modify prints for mailbox and " Weihang Li
2021-04-08 19:11 ` [PATCH for-next 0/3] RDMA/hns: Updates of CMDQ Jason Gunthorpe

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=YGmRd+ZzaKGrYcQo@unreal \
    --to=leon@kernel.org \
    --cc=chenglang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liweihang@huawei.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