All of lore.kernel.org
 help / color / mirror / Atom feed
* question about the completion tasklet in the rxe driver
@ 2023-03-15 21:56 Bob Pearson
  2023-03-16  9:40 ` Bernard Metzler
  2023-03-19  9:02 ` Zhu Yanjun
  0 siblings, 2 replies; 6+ messages in thread
From: Bob Pearson @ 2023-03-15 21:56 UTC (permalink / raw)
  To: Jason Gunthorpe, Zhu Yanjun, linux-rdma, Bernard Metzler

I have a goal of trying to get rid of all the tasklets in the rxe driver and with the replacement of the
three QP tasklets by workqueues the only remaining one is the tasklet that defers the CQ completion
handler. This has been in there since the driver went upstream so the history of why it is there is lost.

I notice that the mlx5 driver does have a deferral mechanism for the completion handler but the siw driver
does not. I really do not see what advantage, if any, this has for the rxe driver. Perhaps there is some
reason it shouldn't run in hard interrupt context but the CQ tasklet is a soft interrupt so the completion
handler can't sleep anyway.

As an experiment I removed the CQ tasklet in the rxe driver and it runs fine. In fact the performance is
slightly better with the completion handler called inline rather than deferred to another tasklet.
If we can eliminate this there won't be anymore tasklets in the rxe driver.

Does anyone know why the tasklet was put in in the first place?

Thanks,

Bob

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE:  question about the completion tasklet in the rxe driver
  2023-03-15 21:56 question about the completion tasklet in the rxe driver Bob Pearson
@ 2023-03-16  9:40 ` Bernard Metzler
  2023-03-16 17:14   ` Bob Pearson
  2023-03-19  9:02 ` Zhu Yanjun
  1 sibling, 1 reply; 6+ messages in thread
From: Bernard Metzler @ 2023-03-16  9:40 UTC (permalink / raw)
  To: Bob Pearson, Jason Gunthorpe, Zhu Yanjun, linux-rdma



> -----Original Message-----
> From: Bob Pearson <rpearsonhpe@gmail.com>
> Sent: Wednesday, 15 March 2023 22:56
> To: Jason Gunthorpe <jgg@nvidia.com>; Zhu Yanjun <zyjzyj2000@gmail.com>;
> linux-rdma@vger.kernel.org; Bernard Metzler <BMT@zurich.ibm.com>
> Subject: [EXTERNAL] question about the completion tasklet in the rxe driver
> 
> I have a goal of trying to get rid of all the tasklets in the rxe driver
> and with the replacement of the
> three QP tasklets by workqueues the only remaining one is the tasklet that
> defers the CQ completion
> handler. This has been in there since the driver went upstream so the
> history of why it is there is lost.
> 
> I notice that the mlx5 driver does have a deferral mechanism for the
> completion handler but the siw driver
> does not. I really do not see what advantage, if any, this has for the rxe
> driver. Perhaps there is some
> reason it shouldn't run in hard interrupt context but the CQ tasklet is a
> soft interrupt so the completion
> handler can't sleep anyway.
> 
> As an experiment I removed the CQ tasklet in the rxe driver and it runs
> fine. In fact the performance is
> slightly better with the completion handler called inline rather than
> deferred to another tasklet.

That is what I would suggest to do. Why would you leave receive
processing or failing send processing w/o creating the CQE and
kicking the CQ handler, if you are in a context with
all information available to build a CQE, signal its availability
to the consumer and kick a user handler if registered and armed?

Only exception I see: If you process the SQ in post_send() user context
and a failure results in immediate CQE creation, direct CQ handler calling
is not allowed - see Documentation/infiniband/core_locking.rst
Not sure though, if rxe allows for direct SQ processing out of user
context.

Cheers,
Bernard.

> If we can eliminate this there won't be anymore tasklets in the rxe driver.
> 
> Does anyone know why the tasklet was put in in the first place?
> 
> Thanks,
> 
> Bob

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about the completion tasklet in the rxe driver
  2023-03-16  9:40 ` Bernard Metzler
@ 2023-03-16 17:14   ` Bob Pearson
  2023-03-16 18:18     ` Bernard Metzler
  2023-03-21 12:54     ` Jason Gunthorpe
  0 siblings, 2 replies; 6+ messages in thread
From: Bob Pearson @ 2023-03-16 17:14 UTC (permalink / raw)
  To: Bernard Metzler, Jason Gunthorpe, Zhu Yanjun, linux-rdma

On 3/16/23 04:40, Bernard Metzler wrote:
> 
> 
>> -----Original Message-----
>> From: Bob Pearson <rpearsonhpe@gmail.com>
>> Sent: Wednesday, 15 March 2023 22:56
>> To: Jason Gunthorpe <jgg@nvidia.com>; Zhu Yanjun <zyjzyj2000@gmail.com>;
>> linux-rdma@vger.kernel.org; Bernard Metzler <BMT@zurich.ibm.com>
>> Subject: [EXTERNAL] question about the completion tasklet in the rxe driver
>>
>> I have a goal of trying to get rid of all the tasklets in the rxe driver
>> and with the replacement of the
>> three QP tasklets by workqueues the only remaining one is the tasklet that
>> defers the CQ completion
>> handler. This has been in there since the driver went upstream so the
>> history of why it is there is lost.
>>
>> I notice that the mlx5 driver does have a deferral mechanism for the
>> completion handler but the siw driver
>> does not. I really do not see what advantage, if any, this has for the rxe
>> driver. Perhaps there is some
>> reason it shouldn't run in hard interrupt context but the CQ tasklet is a
>> soft interrupt so the completion
>> handler can't sleep anyway.
>>
>> As an experiment I removed the CQ tasklet in the rxe driver and it runs
>> fine. In fact the performance is
>> slightly better with the completion handler called inline rather than
>> deferred to another tasklet.
> 
> That is what I would suggest to do. Why would you leave receive
> processing or failing send processing w/o creating the CQE and
> kicking the CQ handler, if you are in a context with
> all information available to build a CQE, signal its availability
> to the consumer and kick a user handler if registered and armed?
> 
> Only exception I see: If you process the SQ in post_send() user context
> and a failure results in immediate CQE creation, direct CQ handler calling
> is not allowed - see Documentation/infiniband/core_locking.rst
> Not sure though, if rxe allows for direct SQ processing out of user
> context.
> 
> Cheers,
> Bernard.

And you did. I am not sure why the mlx5 driver defers the completion handler call
to a tasklet. I could be that it gets called in a hard interrupt and completion
handling is deferred to a soft interrupt context. But for rxe the completion
is always already in a soft interrupt context or a process context.

Bob

> 
>> If we can eliminate this there won't be anymore tasklets in the rxe driver.
>>
>> Does anyone know why the tasklet was put in in the first place?
>>
>> Thanks,
>>
>> Bob


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: question about the completion tasklet in the rxe driver
  2023-03-16 17:14   ` Bob Pearson
@ 2023-03-16 18:18     ` Bernard Metzler
  2023-03-21 12:54     ` Jason Gunthorpe
  1 sibling, 0 replies; 6+ messages in thread
From: Bernard Metzler @ 2023-03-16 18:18 UTC (permalink / raw)
  To: Bob Pearson, Jason Gunthorpe, Zhu Yanjun, linux-rdma



> -----Original Message-----
> From: Bob Pearson <rpearsonhpe@gmail.com>
> Sent: Thursday, 16 March 2023 18:15
> To: Bernard Metzler <BMT@zurich.ibm.com>; Jason Gunthorpe <jgg@nvidia.com>;
> Zhu Yanjun <zyjzyj2000@gmail.com>; linux-rdma@vger.kernel.org
> Subject: [EXTERNAL] Re: question about the completion tasklet in the rxe
> driver
> 
> On 3/16/23 04:40, Bernard Metzler wrote:
> >
> >
> >> -----Original Message-----
> >> From: Bob Pearson <rpearsonhpe@gmail.com>
> >> Sent: Wednesday, 15 March 2023 22:56
> >> To: Jason Gunthorpe <jgg@nvidia.com>; Zhu Yanjun <zyjzyj2000@gmail.com>;
> >> linux-rdma@vger.kernel.org; Bernard Metzler <BMT@zurich.ibm.com>
> >> Subject: [EXTERNAL] question about the completion tasklet in the rxe
> driver
> >>
> >> I have a goal of trying to get rid of all the tasklets in the rxe driver
> >> and with the replacement of the
> >> three QP tasklets by workqueues the only remaining one is the tasklet
> that
> >> defers the CQ completion
> >> handler. This has been in there since the driver went upstream so the
> >> history of why it is there is lost.
> >>
> >> I notice that the mlx5 driver does have a deferral mechanism for the
> >> completion handler but the siw driver
> >> does not. I really do not see what advantage, if any, this has for the
> rxe
> >> driver. Perhaps there is some
> >> reason it shouldn't run in hard interrupt context but the CQ tasklet is
> a
> >> soft interrupt so the completion
> >> handler can't sleep anyway.
> >>
> >> As an experiment I removed the CQ tasklet in the rxe driver and it runs
> >> fine. In fact the performance is
> >> slightly better with the completion handler called inline rather than
> >> deferred to another tasklet.
> >
> > That is what I would suggest to do. Why would you leave receive
> > processing or failing send processing w/o creating the CQE and
> > kicking the CQ handler, if you are in a context with
> > all information available to build a CQE, signal its availability
> > to the consumer and kick a user handler if registered and armed?
> >
> > Only exception I see: If you process the SQ in post_send() user context
> > and a failure results in immediate CQE creation, direct CQ handler
> calling
> > is not allowed - see Documentation/infiniband/core_locking.rst
> > Not sure though, if rxe allows for direct SQ processing out of user
> > context.
> >
> > Cheers,
> > Bernard.
> 
> And you did. I am not sure why the mlx5 driver defers the completion
> handler call
> to a tasklet. I could be that it gets called in a hard interrupt and
> completion
> handling is deferred to a soft interrupt context. But for rxe the
> completion
> is always already in a soft interrupt context or a process context.
> 
right, go for it ;)


> Bob
> 
> >
> >> If we can eliminate this there won't be anymore tasklets in the rxe
> driver.
> >>
> >> Does anyone know why the tasklet was put in in the first place?
> >>
> >> Thanks,
> >>
> >> Bob


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about the completion tasklet in the rxe driver
  2023-03-15 21:56 question about the completion tasklet in the rxe driver Bob Pearson
  2023-03-16  9:40 ` Bernard Metzler
@ 2023-03-19  9:02 ` Zhu Yanjun
  1 sibling, 0 replies; 6+ messages in thread
From: Zhu Yanjun @ 2023-03-19  9:02 UTC (permalink / raw)
  To: Bob Pearson, Jason Gunthorpe, Zhu Yanjun, linux-rdma, Bernard Metzler

在 2023/3/16 5:56, Bob Pearson 写道:
> I have a goal of trying to get rid of all the tasklets in the rxe driver and with the replacement of the

If work queue is used, is it possible to distribute the work queue tasks 
to different cpus evenly in the same numa (if numa is consider)?  ^_^

Zhu Yanjun

> three QP tasklets by workqueues the only remaining one is the tasklet that defers the CQ completion
> handler. This has been in there since the driver went upstream so the history of why it is there is lost.
> 
> I notice that the mlx5 driver does have a deferral mechanism for the completion handler but the siw driver
> does not. I really do not see what advantage, if any, this has for the rxe driver. Perhaps there is some
> reason it shouldn't run in hard interrupt context but the CQ tasklet is a soft interrupt so the completion
> handler can't sleep anyway.
> 
> As an experiment I removed the CQ tasklet in the rxe driver and it runs fine. In fact the performance is
> slightly better with the completion handler called inline rather than deferred to another tasklet.
> If we can eliminate this there won't be anymore tasklets in the rxe driver.
> 
> Does anyone know why the tasklet was put in in the first place?
> 
> Thanks,
> 
> Bob


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question about the completion tasklet in the rxe driver
  2023-03-16 17:14   ` Bob Pearson
  2023-03-16 18:18     ` Bernard Metzler
@ 2023-03-21 12:54     ` Jason Gunthorpe
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2023-03-21 12:54 UTC (permalink / raw)
  To: Bob Pearson; +Cc: Bernard Metzler, Zhu Yanjun, linux-rdma

On Thu, Mar 16, 2023 at 12:14:30PM -0500, Bob Pearson wrote:

> And you did. I am not sure why the mlx5 driver defers the completion handler call
> to a tasklet. I could be that it gets called in a hard interrupt and completion
> handling is deferred to a soft interrupt context. But for rxe the completion
> is always already in a soft interrupt context or a process context.

mlx5_eq_comp_int() is a hard IRQ context

mlx5_cq_tasklet_cb() is in a tasklet context

It has some logic that it only does a certain amount of work per
tasklet call and then it reschedules itself to run again.

mlx5_ib_cq_comp() is in a tasklet context

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-21 12:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 21:56 question about the completion tasklet in the rxe driver Bob Pearson
2023-03-16  9:40 ` Bernard Metzler
2023-03-16 17:14   ` Bob Pearson
2023-03-16 18:18     ` Bernard Metzler
2023-03-21 12:54     ` Jason Gunthorpe
2023-03-19  9:02 ` Zhu Yanjun

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.