kernel_optimize_test/Documentation/scsi
Ahmed S. Darwish 58bdc321be scsi: libsas: Introduce a _gfp() variant of event notifiers
[ Upstream commit c2d0f1a65ab9fbabebb463bf36f50ea8f4633386 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-25 09:04:11 +01:00
..
scsi_transport_srp
53c700.rst
aacraid.rst
advansys.rst
aha152x.rst
aic7xxx.rst
aic79xx.rst
arcmsr_spec.rst
bfa.rst
bnx2fc.rst
BusLogic.rst
ChangeLog.arcmsr
ChangeLog.ips
ChangeLog.lpfc
ChangeLog.megaraid
ChangeLog.megaraid_sas
ChangeLog.ncr53c8xx
ChangeLog.sym53c8xx
ChangeLog.sym53c8xx_2
cxgb3i.rst
dc395x.rst
dpti.rst
FlashPoint.rst
g_NCR5380.rst
hpsa.rst
hptiop.rst
index.rst
libsas.rst scsi: libsas: Introduce a _gfp() variant of event notifiers 2021-03-25 09:04:11 +01:00
LICENSE.FlashPoint
link_power_management_policy.rst
lpfc.rst
megaraid.rst
ncr53c8xx.rst
NinjaSCSI.rst
ppa.rst
qlogicfas.rst
scsi_eh.rst
scsi_fc_transport.rst
scsi_mid_low_api.rst scsi: docs: Remove obsolete scsi typedef text from scsi_mid_low_api 2020-09-08 22:02:10 -04:00
scsi-changer.rst
scsi-generic.rst
scsi-parameters.rst
scsi.rst
sd-parameters.rst
smartpqi.rst scsi: smartpqi: Update documentation 2020-09-02 22:49:06 -04:00
st.rst
sym53c8xx_2.rst
sym53c500_cs.rst
tcm_qla2xxx.rst
ufs.rst
wd719x.rst