android_kernel_samsung_a7y1.../drivers
Benjamin Block e1305c06fb scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
[ Upstream commit 1749ef00f7312679f76d5e9104c5d1e22a829038 ]

We had a test-report where, under memory pressure, adding LUNs to the
systems would fail (the tests add LUNs strictly in sequence):

[ 5525.853432] scsi 0:0:1:1088045124: Direct-Access     IBM      2107900          .148 PQ: 0 ANSI: 5
[ 5525.853826] scsi 0:0:1:1088045124: alua: supports implicit TPGS
[ 5525.853830] scsi 0:0:1:1088045124: alua: device naa.6005076303ffd32700000000000044da port group 0 rel port 43
[ 5525.853931] sd 0:0:1:1088045124: Attached scsi generic sg10 type 0
[ 5525.854075] sd 0:0:1:1088045124: [sdk] Disabling DIF Type 1 protection
[ 5525.855495] sd 0:0:1:1088045124: [sdk] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB)
[ 5525.855606] sd 0:0:1:1088045124: [sdk] Write Protect is off
[ 5525.855609] sd 0:0:1:1088045124: [sdk] Mode Sense: ed 00 00 08
[ 5525.855795] sd 0:0:1:1088045124: [sdk] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 5525.857838]  sdk: sdk1
[ 5525.859468] sd 0:0:1:1088045124: [sdk] Attached SCSI disk
[ 5525.865073] sd 0:0:1:1088045124: alua: transition timeout set to 60 seconds
[ 5525.865078] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA
[ 5526.015070] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA
[ 5526.015213] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA
[ 5526.587439] scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
[ 5526.588562] scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured

Looking at the code of scsi_alloc_sdev(), and all the calling contexts,
there seems to be no reason to use GFP_ATMOIC here. All the different
call-contexts use a mutex at some point, and nothing in between that
requires no sleeping, as far as I could see. Additionally, the code that
later allocates the block queue for the device (scsi_mq_alloc_queue())
already uses GFP_KERNEL.

There are similar allocations in two other functions:
scsi_probe_and_add_lun(), and scsi_add_lun(),; that can also be done with
GFP_KERNEL.

Here is the contexts for the three functions so far:

    scsi_alloc_sdev()
        scsi_probe_and_add_lun()
            scsi_sequential_lun_scan()
                __scsi_scan_target()
                    scsi_scan_target()
                        mutex_lock()
                    scsi_scan_channel()
                        scsi_scan_host_selected()
                            mutex_lock()
            scsi_report_lun_scan()
                __scsi_scan_target()
    	            ...
            __scsi_add_device()
                mutex_lock()
            __scsi_scan_target()
                ...
        scsi_report_lun_scan()
            ...
        scsi_get_host_dev()
            mutex_lock()

    scsi_probe_and_add_lun()
        ...

    scsi_add_lun()
        scsi_probe_and_add_lun()
            ...

So replace all these, and give them a bit of a better chance to succeed,
with more chances of reclaim.

Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-06 14:50:30 +02:00
..
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
battery
battery_v2
bcma
block
bluetooth
bts
bus
ccic
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon extcon: usb-gpio: Don't miss event during suspend/resume 2020-04-06 11:16:41 +02:00
fingerprint
firewire
firmware
five
fmc
fpga
gator
gpio gpio: gpio-omap: fix level interrupt idling 2020-04-06 14:22:12 +02:00
gps
gpu drm/vmwgfx: Don't double-free the mode stored in par->set_mode 2020-04-06 10:58:11 +02:00
gud
hid
hsi
hv
hwmon
hwspinlock
hwtracing stm class: Hide STM-specific options if STM is disabled 2020-04-06 13:03:45 +02:00
i2c i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA 2020-04-06 14:02:20 +02:00
ide
idle
iio
infiniband
input
iommu
ipack
irqchip
isdn mISDN: hfcpci: Test both vendor & device ID for Digium HFC4S 2020-04-06 12:57:02 +02:00
leds
lguest
lightnvm
macintosh
mailbox
mcb
md dm thin: add sanity checks to thin-pool and external snapshot creation 2020-04-06 14:50:15 +02:00
media media: v4l2-ctrls.c/uvc: zero v4l2_event 2020-04-06 10:58:18 +02:00
memory
memstick
message
mfd
misc
mmc mmc: mmc: fix switch timeout issue caused by jiffies precision 2020-04-06 12:56:54 +02:00
motor
mtd
muic
net enic: fix build warning without CONFIG_CPUMASK_OFFSTACK 2020-04-06 14:22:36 +02:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc rtc: Fix overflow when converting time64_t to rtc_time 2020-04-06 11:45:55 +02:00
s390 scsi: zfcp: fix scsi_eh host reset with port_forced ERP for non-NPIV FCP devices 2020-04-06 13:01:06 +02:00
sbus
scsi scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c 2020-04-06 14:50:30 +02:00
security/samsung/icdrv
sensorhub
sensors
sfi
sh
sn
soc
spi
spmi
ssb
staging staging: vt6655: Fix interrupt race condition on device start up. 2020-04-06 13:01:12 +02:00
switch
target
tc
tee
thermal
thunderbolt
trace
tty tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped 2020-04-06 14:20:26 +02:00
uh
uio
usb usb: chipidea: Grab the (legacy) USB PHY by phandle first 2020-04-06 14:50:27 +02:00
uwb
vfio
vhost
video
virt
virtio
vision
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile