1
0
Fork 0
alistair23-linux/drivers
Tong Zhang 7ad92f656b nvme-pci: cancel nvme device request before disabling
This patch addresses an irq free warning and null pointer dereference
error problem when nvme devices got timeout error during initialization.
This problem happens when nvme_timeout() function is called while
nvme_reset_work() is still in execution. This patch fixed the problem by
setting flag of the problematic request to NVME_REQ_CANCELLED before
calling nvme_dev_disable() to make sure __nvme_submit_sync_cmd() returns
an error code and let nvme_submit_sync_cmd() fail gracefully.
The following is console output.

[   62.472097] nvme nvme0: I/O 13 QID 0 timeout, disable controller
[   62.488796] nvme nvme0: could not set timestamp (881)
[   62.494888] ------------[ cut here ]------------
[   62.495142] Trying to free already-free IRQ 11
[   62.495366] WARNING: CPU: 0 PID: 7 at kernel/irq/manage.c:1751 free_irq+0x1f7/0x370
[   62.495742] Modules linked in:
[   62.495902] CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.8.0+ #8
[   62.496206] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-48-gd9c812dda519-p4
[   62.496772] Workqueue: nvme-reset-wq nvme_reset_work
[   62.497019] RIP: 0010:free_irq+0x1f7/0x370
[   62.497223] Code: e8 ce 49 11 00 48 83 c4 08 4c 89 e0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 44 89 f6 48 c70
[   62.498133] RSP: 0000:ffffa96800043d40 EFLAGS: 00010086
[   62.498391] RAX: 0000000000000000 RBX: ffff9b87fc458400 RCX: 0000000000000000
[   62.498741] RDX: 0000000000000001 RSI: 0000000000000096 RDI: ffffffff9693d72c
[   62.499091] RBP: ffff9b87fd4c8f60 R08: ffffa96800043bfd R09: 0000000000000163
[   62.499440] R10: ffffa96800043bf8 R11: ffffa96800043bfd R12: ffff9b87fd4c8e00
[   62.499790] R13: ffff9b87fd4c8ea4 R14: 000000000000000b R15: ffff9b87fd76b000
[   62.500140] FS:  0000000000000000(0000) GS:ffff9b87fdc00000(0000) knlGS:0000000000000000
[   62.500534] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   62.500816] CR2: 0000000000000000 CR3: 000000003aa0a000 CR4: 00000000000006f0
[   62.501165] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   62.501515] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   62.501864] Call Trace:
[   62.501993]  pci_free_irq+0x13/0x20
[   62.502167]  nvme_reset_work+0x5d0/0x12a0
[   62.502369]  ? update_load_avg+0x59/0x580
[   62.502569]  ? ttwu_queue_wakelist+0xa8/0xc0
[   62.502780]  ? try_to_wake_up+0x1a2/0x450
[   62.502979]  process_one_work+0x1d2/0x390
[   62.503179]  worker_thread+0x45/0x3b0
[   62.503361]  ? process_one_work+0x390/0x390
[   62.503568]  kthread+0xf9/0x130
[   62.503726]  ? kthread_park+0x80/0x80
[   62.503911]  ret_from_fork+0x22/0x30
[   62.504090] ---[ end trace de9ed4a70f8d71e2 ]---
[  123.912275] nvme nvme0: I/O 12 QID 0 timeout, disable controller
[  123.914670] nvme nvme0: 1/0/0 default/read/poll queues
[  123.916310] BUG: kernel NULL pointer dereference, address: 0000000000000000
[  123.917469] #PF: supervisor write access in kernel mode
[  123.917725] #PF: error_code(0x0002) - not-present page
[  123.917976] PGD 0 P4D 0
[  123.918109] Oops: 0002 [#1] SMP PTI
[  123.918283] CPU: 0 PID: 7 Comm: kworker/u4:0 Tainted: G        W         5.8.0+ #8
[  123.918650] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-48-gd9c812dda519-p4
[  123.919219] Workqueue: nvme-reset-wq nvme_reset_work
[  123.919469] RIP: 0010:__blk_mq_alloc_map_and_request+0x21/0x80
[  123.919757] Code: 66 0f 1f 84 00 00 00 00 00 41 55 41 54 55 48 63 ee 53 48 8b 47 68 89 ee 48 89 fb 8b4
[  123.920657] RSP: 0000:ffffa96800043d40 EFLAGS: 00010286
[  123.920912] RAX: ffff9b87fc4fee40 RBX: ffff9b87fc8cb008 RCX: 0000000000000000
[  123.921258] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9b87fc618000
[  123.921602] RBP: 0000000000000000 R08: ffff9b87fdc2c4a0 R09: ffff9b87fc616000
[  123.921949] R10: 0000000000000000 R11: ffff9b87fffd1500 R12: 0000000000000000
[  123.922295] R13: 0000000000000000 R14: ffff9b87fc8cb200 R15: ffff9b87fc8cb000
[  123.922641] FS:  0000000000000000(0000) GS:ffff9b87fdc00000(0000) knlGS:0000000000000000
[  123.923032] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  123.923312] CR2: 0000000000000000 CR3: 000000003aa0a000 CR4: 00000000000006f0
[  123.923660] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  123.924007] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  123.924353] Call Trace:
[  123.924479]  blk_mq_alloc_tag_set+0x137/0x2a0
[  123.924694]  nvme_reset_work+0xed6/0x12a0
[  123.924898]  process_one_work+0x1d2/0x390
[  123.925099]  worker_thread+0x45/0x3b0
[  123.925280]  ? process_one_work+0x390/0x390
[  123.925486]  kthread+0xf9/0x130
[  123.925642]  ? kthread_park+0x80/0x80
[  123.925825]  ret_from_fork+0x22/0x30
[  123.926004] Modules linked in:
[  123.926158] CR2: 0000000000000000
[  123.926322] ---[ end trace de9ed4a70f8d71e3 ]---
[  123.926549] RIP: 0010:__blk_mq_alloc_map_and_request+0x21/0x80
[  123.926832] Code: 66 0f 1f 84 00 00 00 00 00 41 55 41 54 55 48 63 ee 53 48 8b 47 68 89 ee 48 89 fb 8b4
[  123.927734] RSP: 0000:ffffa96800043d40 EFLAGS: 00010286
[  123.927989] RAX: ffff9b87fc4fee40 RBX: ffff9b87fc8cb008 RCX: 0000000000000000
[  123.928336] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9b87fc618000
[  123.928679] RBP: 0000000000000000 R08: ffff9b87fdc2c4a0 R09: ffff9b87fc616000
[  123.929025] R10: 0000000000000000 R11: ffff9b87fffd1500 R12: 0000000000000000
[  123.929370] R13: 0000000000000000 R14: ffff9b87fc8cb200 R15: ffff9b87fc8cb000
[  123.929715] FS:  0000000000000000(0000) GS:ffff9b87fdc00000(0000) knlGS:0000000000000000
[  123.930106] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  123.930384] CR2: 0000000000000000 CR3: 000000003aa0a000 CR4: 00000000000006f0
[  123.930731] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  123.931077] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Co-developed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
2020-08-28 16:43:57 -07:00
..
accessibility TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
acpi More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
amba
android drivers: android: Fix the SPDX comment style 2020-07-29 17:05:44 +02:00
ata
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
auxdisplay Minor cleanup for auxdisplay: 2020-08-06 18:09:34 -07:00
base More power management updates for 5.9-rc1 2020-08-07 13:13:09 -07:00
bcma bcma: gpio: Use irqchip template 2020-08-02 18:26:51 +03:00
block loop: Set correct device size when using LOOP_CONFIGURE 2020-08-26 09:30:31 -06:00
bluetooth Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2020-07-31 15:11:52 -07:00
bus MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
cdrom
char Linux 5.8 2020-08-11 11:58:31 +10:00
clk More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
clocksource - Core Frameworks 2020-08-15 08:09:38 -07:00
connector
counter
cpufreq cpufreq: intel_pstate: Implement passive mode with HWP enabled 2020-08-11 17:29:45 +02:00
cpuidle powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
crypto virtio: fixes, features 2020-08-11 14:34:17 -07:00
dax libnvdimm for 5.9 2020-08-11 10:59:19 -07:00
dca
devfreq PM / devfreq: Fix the wrong end with semicolon 2020-07-30 17:22:58 +09:00
dio
dma Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
dma-buf A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
edac Fixes for ie31200 driver that missed the first pull 2020-08-15 08:25:41 -07:00
eisa
extcon
firewire
firmware uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
fpga
fsi
gnss
gpio This is the bulk of GPIO changes for the v5.9 kernel cycle: 2020-08-05 12:56:27 -07:00
gpu pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
greybus greybus: Use fallthrough pseudo-keyword 2020-07-29 16:58:08 +02:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2020-08-10 16:33:54 -07:00
hsi
hv hyperv-fixes for 5.9-rc 2020-08-14 13:31:25 -07:00
hwmon pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
hwspinlock
hwtracing
i2c More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
i3c
ide
idle Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
iio
infiniband mm/gup: remove task_struct pointer for all gup code 2020-08-12 10:58:04 -07:00
input Cleanup, SECCOMP_FILTER support, message printing fixes, and other 2020-08-15 18:50:32 -07:00
interconnect Char/Misc driver patches for 5.9-rc1 2020-08-05 11:43:47 -07:00
iommu Merge branch 'akpm' (patches from Andrew) 2020-08-12 11:24:12 -07:00
ipack
irqchip The usual boring updates from the interrupt subsystem: 2020-08-04 18:11:58 -07:00
isdn
leds LEDs changes for 5.9-rc1. 2020-08-05 19:24:27 -07:00
lightnvm
macintosh powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
mailbox iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
mcb
md md/raid5: make sure stripe_size as power of two 2020-08-27 22:41:03 -07:00
media IOMMU Updates for Linux v5.9 2020-08-11 14:13:24 -07:00
memory IOMMU Updates for Linux v5.9 2020-08-11 14:13:24 -07:00
memstick MMC core: 2020-08-05 13:23:24 -07:00
message
mfd - Core Frameworks 2020-08-15 08:09:38 -07:00
misc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
mmc This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
most drivers: most: add USB adapter driver 2020-07-31 14:38:12 +02:00
mtd This pull request contains changes for JFFS2, UBI and UBIFS 2020-08-10 18:20:04 -07:00
mux
net rtl818x: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
nfc
ntb ntb: intel: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
nubus
nvdimm mm: add thp_size 2020-08-14 19:56:56 -07:00
nvme nvme-pci: cancel nvme device request before disabling 2020-08-28 16:43:57 -07:00
nvmem nvmem: qcom-spmi-sdam: Enable multiple devices 2020-07-29 17:12:09 +02:00
of MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
opp Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-08-04 12:44:53 +02:00
oprofile
parisc Merge branch 'parisc-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2020-08-12 12:41:15 -07:00
parport
pci pci-v5.9-changes 2020-08-07 18:48:15 -07:00
pcmcia
perf It looks like a smaller batch of clk updates this time around. In the core 2020-08-07 13:35:51 -07:00
phy
pinctrl This is the bulk of the pin control changes for the v5.9 2020-08-09 12:52:28 -07:00
platform linux-watchdog 5.9-rc1 tag 2020-08-12 12:13:44 -07:00
pnp
power power supply and reset changes for the v5.9 series 2020-08-07 21:27:37 -07:00
powercap This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
pps
ps3
ptp ptp: only allow phase values lower than 1 period 2020-08-05 12:06:44 -07:00
pwm pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
rapidio rapidio/rio_mport_cdev: use array_size() helper in copy_{from,to}_user() 2020-08-12 10:58:01 -07:00
ras
regulator Merge remote-tracking branch 'regulator/for-5.9' into regulator-next 2020-07-30 23:27:08 +01:00
remoteproc remoteproc updates for v5.9 2020-08-11 11:17:45 -07:00
reset
rpmsg
rtc RTC for 5.9 2020-08-12 17:17:00 -07:00
s390 s390/pkey: remove redundant variable initialization 2020-08-11 18:16:31 +02:00
sbus
scsi SCSI misc on 20200814 2020-08-14 16:01:59 -07:00
sfi
sh iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
siox
slimbus
soc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
soundwire
spi sound updates for 5.9 2020-08-06 14:27:31 -07:00
spmi
ssb Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
staging pci-v5.9-changes 2020-08-07 18:48:15 -07:00
target SCSI misc on 20200814 2020-08-14 16:01:59 -07:00
tc
tee
thermal - Core Frameworks 2020-08-15 08:09:38 -07:00
thunderbolt thunderbolt: merge fix for kunix_resource changes 2020-08-09 11:06:10 -07:00
tty TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
uio
usb media updates for v5.9-rc1 2020-08-07 13:00:53 -07:00
vdpa virtio: fixes, features 2020-08-11 14:34:17 -07:00
vfio VFIO updates for v5.9-rc1 2020-08-12 12:09:36 -07:00
vhost virtio: fixes, features 2020-08-11 14:34:17 -07:00
video pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
virt
virtio virtio: pci: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.9-rc1 tag 2020-08-12 12:13:44 -07:00
xen xen: branch for v5.9-rc1b 2020-08-14 13:34:37 -07:00
zorro
Kconfig
Makefile