linux/include
Ahmed S. Darwish c2d0f1a65a scsi: libsas: Introduce a _gfp() variant of event notifiers
sas_alloc_event() uses in_interrupt() to decide which allocation should be
used.

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

The in_interrupt() check is also only partially correct, because it fails
to choose the correct code path when just preemption or interrupts are
disabled. For example, as in the following call chain:

  mvsas/mv_sas.c: mvs_work_queue() [process context]
  spin_lock_irqsave(mvs_info::lock, )
    -> libsas/sas_event.c: sas_notify_phy_event()
      -> sas_alloc_event()
        -> in_interrupt() = false
          -> invalid GFP_KERNEL allocation
    -> libsas/sas_event.c: sas_notify_port_event()
      -> sas_alloc_event()
        -> in_interrupt() = false
          -> invalid GFP_KERNEL allocation

Introduce sas_alloc_event_gfp(), sas_notify_port_event_gfp(), and
sas_notify_phy_event_gfp(), which all behave like the non _gfp() variants
but use a caller-passed GFP mask for allocations.

For bisectability, all callers will be modified first to pass GFP context,
then the non _gfp() libsas API variants will be modified to take a gfp_t by
default.

Link: https://lore.kernel.org/r/20210118100955.1761652-4-a.darwish@linutronix.de
Fixes: 1c393b970e ("scsi: libsas: Use dynamic alloced work to avoid sas event lost")
Cc: Jason Yan <yanaijie@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2021-01-22 21:31:07 -05:00
..
acpi More power management updates for 5.11-rc1 2020-12-22 14:12:10 -08:00
asm-generic local64.h: make <asm/local64.h> mandatory 2020-12-29 15:36:49 -08:00
clocksource
crypto
drm drm-misc-next for 5.11: 2020-12-15 10:21:48 +01:00
dt-bindings The core framework got some nice improvements this time around. We gained the 2020-12-21 10:39:37 -08:00
keys
kunit
kvm
linux SCSI fixes on 20210101 2021-01-01 12:58:07 -08:00
math-emu
media
memory
misc
net 9p for 5.11-rc1 2020-12-21 10:28:02 -08:00
pcmcia
ras
rdma RDMA 5.11 pull request 2020-12-16 13:42:26 -08:00
scsi scsi: libsas: Introduce a _gfp() variant of event notifiers 2021-01-22 21:31:07 -05:00
soc ARM: SoC drivers for v5.11 2020-12-16 16:38:41 -08:00
sound ASoC: Updates for v5.11 2020-12-14 15:57:14 +01:00
target
trace scsi: ufs: Make UPIU trace easier differentiate among CDB, OSF, and TM 2021-01-07 22:29:10 -05:00
uapi virtio,vdpa: features, cleanups, fixes 2020-12-24 12:06:46 -08:00
vdso
video
xen xen/xenbus: Count pending messages for each watch 2020-12-14 10:07:13 +01:00