WSL2-Linux-Kernel/Documentation
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
..
ABI scsi: ufs: docs: ABI: Add wb_on documentation for new entry wb_on 2021-01-20 22:12:21 -05:00
PCI
RCU
accounting
admin-guide A small set of late-arriving, small documentation fixes. 2020-12-24 14:20:33 -08:00
arm ARM updates for 5.11: 2020-12-22 13:34:27 -08:00
arm64
block
bpf
cdrom
core-api
cpu-freq
crypto
dev-tools Merge branch 'akpm' (patches from Andrew) 2020-12-22 13:38:17 -08:00
devicetree Devicetree fixes for v5.11, take 1: 2020-12-24 12:09:48 -08:00
doc-guide
driver-api
fault-injection
fb
features ARM updates for 5.11: 2020-12-22 13:34:27 -08:00
filesystems Various bug fixes and cleanups for ext4; no new features this cycle. 2020-12-24 14:16:02 -08:00
firmware-guide
firmware_class
fpga
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input
isdn
kbuild scsi: Drop gdth driver 2021-01-22 21:14:07 -05:00
kernel-hacking
leds
litmus-tests
livepatch
locking
m68k
maintainer
mhi
mips
misc-devices
netlabel
networking
nios2
nvdimm
openrisc
parisc
pcmcia
power
powerpc
process scsi: Drop gdth driver 2021-01-22 21:14:07 -05:00
riscv
s390
scheduler
scsi scsi: libsas: Introduce a _gfp() variant of event notifiers 2021-01-22 21:31:07 -05:00
security
sh
sound
sparc
sphinx Kbuild updates for v5.11 2020-12-22 14:02:39 -08:00
sphinx-static
spi
staging
target
timers
trace Kbuild updates for v5.11 2020-12-22 14:02:39 -08:00
translations
usb
userspace-api scsi: Drop gdth driver 2021-01-22 21:14:07 -05:00
virt
vm
w1
watchdog
x86
xtensa
.gitignore
COPYING-logo
Changes
CodingStyle
Kconfig
Makefile
SubmittingPatches
asm-annotations.rst
atomic_bitops.txt
atomic_t.txt
conf.py
docutils.conf
dontdiff
index.rst
logo.gif
memory-barriers.txt
watch_queue.rst