mbox series

[00/10] scsi: Replace tasklets as BH

Message ID 20220530231512.9729-1-dave@stgolabs.net
Headers show
Series scsi: Replace tasklets as BH | expand

Message

Davidlohr Bueso May 30, 2022, 11:15 p.m. UTC
In spirit of scsi drivers playing nicely with realtime, the following
removes most the use of tasklets throughout drivers/scsi/ replacing
them with either threaded irqs or workqueues such that they run in
regular task context instead of irq; and in addition cleans up a lot
of the async work deferral code. Only two users remain (those that
do the MSIX vector of tasklets): pm8001 and pmcraid, which I don't
have a suitable equivalent yet. One possibility would be to have a
single threaded wq per msix vector entry and thus run concurrently.

Yes, there's a bit more overhead with a task than for a softirq, but
the problem with softirqs and tasklets is that they can't be preempted,
and thus are more important than all tasks on the system. Furthermore
there are no guarantees it will run in irq context at all if ksoftirq
kicks in.

Because of a total lack of hardware, these patches have only been
compile-tested. Please consider for v5.21.

Thanks!

Davidlohr Bueso (10):
  scsi/mvsas: Kill CONFIG_SCSI_MVSAS_TASKLET
  scsi/megaraid: Replace adapter->dpc_h tasklet with threaded irq
  scsi/megaraid_sas: Replace instance->tasklet with threaded irq
  scsi/aic94xx: Replace the donelist tasklet with threaded irq
  scsi/isci: Replace completion_tasklet with threaded irq
  scsi/ibmvscsi_tgt: Replace work tasklet with threaded irq
  scsi/esas2r: Replace tasklet with workqueue
  scsi/ibmvfc: Replace tasklet with work
  scsi/ibmvscsi: Replace srp tasklet with work
  scsi/lpfc: Remove bogus references to discovery tasklet

 drivers/scsi/aic94xx/aic94xx_hwi.c          | 23 ++----
 drivers/scsi/aic94xx/aic94xx_hwi.h          |  5 +-
 drivers/scsi/aic94xx/aic94xx_init.c         |  5 +-
 drivers/scsi/aic94xx/aic94xx_scb.c          | 88 ++++++---------------
 drivers/scsi/aic94xx/aic94xx_task.c         | 16 ++--
 drivers/scsi/aic94xx/aic94xx_tmf.c          | 40 +++++-----
 drivers/scsi/esas2r/esas2r.h                | 19 ++---
 drivers/scsi/esas2r/esas2r_init.c           | 20 +++--
 drivers/scsi/esas2r/esas2r_int.c            | 20 ++---
 drivers/scsi/esas2r/esas2r_io.c             |  2 +-
 drivers/scsi/esas2r/esas2r_main.c           | 34 +++++---
 drivers/scsi/ibmvscsi/ibmvfc.c              | 21 ++---
 drivers/scsi/ibmvscsi/ibmvfc.h              |  3 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c            | 38 ++++++---
 drivers/scsi/ibmvscsi/ibmvscsi.h            |  3 +-
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c    | 17 ++--
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h    |  1 -
 drivers/scsi/isci/host.c                    | 12 +--
 drivers/scsi/isci/host.h                    |  3 +-
 drivers/scsi/isci/init.c                    | 17 ++--
 drivers/scsi/lpfc/lpfc.h                    |  2 -
 drivers/scsi/lpfc/lpfc_disc.h               |  2 +-
 drivers/scsi/megaraid/mega_common.h         |  2 -
 drivers/scsi/megaraid/megaraid_mbox.c       | 52 +++++-------
 drivers/scsi/megaraid/megaraid_sas.h        |  3 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 51 ++++++------
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 18 +++--
 drivers/scsi/mvsas/Kconfig                  |  7 --
 drivers/scsi/mvsas/mv_init.c                | 44 ++---------
 drivers/scsi/mvsas/mv_sas.h                 |  1 -
 30 files changed, 245 insertions(+), 324 deletions(-)

--
2.36.1

Comments

Sebastian Andrzej Siewior June 2, 2022, 7:57 a.m. UTC | #1
On 2022-05-30 16:15:02 [-0700], Davidlohr Bueso wrote:
> and thus are more important than all tasks on the system. Furthermore
> there are no guarantees it will run in irq context at all if ksoftirq
> kicks in.

They never run in IRQ context, they always run in softirq context. Even
if ksoftirqd kicks in, the callbacks (tasklets) are invoked in softirq
context.
That is sort of preemptible but in tasklet's case it will run/ complete
all callbacks before any kind of preemption can kick in.
So there is the lack of preemption for many/ long running callbacks and
the callbacks have no context/ owner which means there is no way of
preferring one over the other.

Sebastian
Davidlohr Bueso June 7, 2022, 3:59 p.m. UTC | #2
Thanks for the careful reviewing and feedback. I'll address
them in a v2 as soon as I get a chance.

Thanks,
Davidlohr
Sebastian Andrzej Siewior June 7, 2022, 4:20 p.m. UTC | #3
On 2022-06-07 08:59:18 [-0700], Davidlohr Bueso wrote:
> 
> Thanks for the careful reviewing and feedback. I'll address
> them in a v2 as soon as I get a chance.

I didn't get through the whole series as of now but I guess you can
apply what I said so far also to the remaining part ;)

The series actually reminding me that I have a be2iscsi patch hiding
somewhere asking to get reposted…

> Thanks,
> Davidlohr

Sebastian