Re: [PATCH for-next 1/3] RDMA/hns: Enable all CMDQ context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > > 
> > > 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@xxxxxxxxxx>
> > > Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
> > > ---
> > >   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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux