mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 22:53:20 +00:00
28b70cd923
The workqueue hfi1_wq is destroyed in function shutdown_device(), which is
called by either shutdown_one() or remove_one(). The function
shutdown_one() is called when the kernel is rebooted while remove_one() is
called when the hfi1 driver is unloaded. When the kernel is rebooted,
hfi1_wq is destroyed while all qps are still active, leading to a kernel
crash:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000102
IP: [<ffffffff94cb7b02>] __queue_work+0x32/0x3e0
PGD 0
Oops: 0000 [#1] SMP
Modules linked in: dm_round_robin nvme_rdma(OE) nvme_fabrics(OE) nvme_core(OE) ib_isert iscsi_target_mod target_core_mod ib_ucm mlx4_ib iTCO_wdt iTCO_vendor_support mxm_wmi sb_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm rpcrdma sunrpc irqbypass crc32_pclmul ghash_clmulni_intel rdma_ucm aesni_intel ib_uverbs lrw gf128mul opa_vnic glue_helper ablk_helper ib_iser cryptd ib_umad rdma_cm iw_cm ses enclosure libiscsi scsi_transport_sas pcspkr joydev ib_ipoib(OE) scsi_transport_iscsi ib_cm sg ipmi_ssif mei_me lpc_ich i2c_i801 mei ioatdma ipmi_si dm_multipath ipmi_devintf ipmi_msghandler wmi acpi_pad acpi_power_meter hangcheck_timer ip_tables ext4 mbcache jbd2 mlx4_en sd_mod crc_t10dif crct10dif_generic mgag200 drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm hfi1(OE)
crct10dif_pclmul crct10dif_common crc32c_intel drm ahci mlx4_core libahci rdmavt(OE) igb megaraid_sas ib_core libata drm_panel_orientation_quirks ptp pps_core devlink dca i2c_algo_bit dm_mirror dm_region_hash dm_log dm_mod
CPU: 19 PID: 0 Comm: swapper/19 Kdump: loaded Tainted: G OE ------------ 3.10.0-957.el7.x86_64 #1
Hardware name: Phegda X2226A/S2600CW, BIOS SE5C610.86B.01.01.0024.021320181901 02/13/2018
task: ffff8a799ba0d140 ti: ffff8a799bad8000 task.ti: ffff8a799bad8000
RIP: 0010:[<ffffffff94cb7b02>] [<ffffffff94cb7b02>] __queue_work+0x32/0x3e0
RSP: 0018:ffff8a90dde43d80 EFLAGS: 00010046
RAX: 0000000000000082 RBX: 0000000000000086 RCX: 0000000000000000
RDX: ffff8a90b924fcb8 RSI: 0000000000000000 RDI: 000000000000001b
RBP: ffff8a90dde43db8 R08: ffff8a799ba0d6d8 R09: ffff8a90dde53900
R10: 0000000000000002 R11: ffff8a90dde43de8 R12: ffff8a90b924fcb8
R13: 000000000000001b R14: 0000000000000000 R15: ffff8a90d2890000
FS: 0000000000000000(0000) GS:ffff8a90dde40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000102 CR3: 0000001a70410000 CR4: 00000000001607e0
Call Trace:
[<ffffffff94cb8105>] queue_work_on+0x45/0x50
[<ffffffffc03f781e>] _hfi1_schedule_send+0x6e/0xc0 [hfi1]
[<ffffffffc03f78a2>] hfi1_schedule_send+0x32/0x70 [hfi1]
[<ffffffffc02cf2d9>] rvt_rc_timeout+0xe9/0x130 [rdmavt]
[<ffffffff94ce563a>] ? trigger_load_balance+0x6a/0x280
[<ffffffffc02cf1f0>] ? rvt_free_qpn+0x40/0x40 [rdmavt]
[<ffffffff94ca7f58>] call_timer_fn+0x38/0x110
[<ffffffffc02cf1f0>] ? rvt_free_qpn+0x40/0x40 [rdmavt]
[<ffffffff94caa3bd>] run_timer_softirq+0x24d/0x300
[<ffffffff94ca0f05>] __do_softirq+0xf5/0x280
[<ffffffff9537832c>] call_softirq+0x1c/0x30
[<ffffffff94c2e675>] do_softirq+0x65/0xa0
[<ffffffff94ca1285>] irq_exit+0x105/0x110
[<ffffffff953796c8>] smp_apic_timer_interrupt+0x48/0x60
[<ffffffff95375df2>] apic_timer_interrupt+0x162/0x170
<EOI>
[<ffffffff951adfb7>] ? cpuidle_enter_state+0x57/0xd0
[<ffffffff951ae10e>] cpuidle_idle_call+0xde/0x230
[<ffffffff94c366de>] arch_cpu_idle+0xe/0xc0
[<ffffffff94cfc3ba>] cpu_startup_entry+0x14a/0x1e0
[<ffffffff94c57db7>] start_secondary+0x1f7/0x270
[<ffffffff94c000d5>] start_cpu+0x5/0x14
The solution is to destroy the workqueue only when the hfi1 driver is
unloaded, not when the device is shut down. In addition, when the device
is shut down, no more work should be scheduled on the workqueues and the
workqueues are flushed.
Fixes:
|
||
---|---|---|
.. | ||
affinity.c | ||
affinity.h | ||
aspm.c | ||
aspm.h | ||
chip_registers.h | ||
chip.c | ||
chip.h | ||
common.h | ||
debugfs.c | ||
debugfs.h | ||
device.c | ||
device.h | ||
driver.c | ||
efivar.c | ||
efivar.h | ||
eprom.c | ||
eprom.h | ||
exp_rcv.c | ||
exp_rcv.h | ||
fault.c | ||
fault.h | ||
file_ops.c | ||
firmware.c | ||
hfi.h | ||
init.c | ||
intr.c | ||
iowait.c | ||
iowait.h | ||
ipoib_main.c | ||
ipoib_rx.c | ||
ipoib_tx.c | ||
ipoib.h | ||
Kconfig | ||
mad.c | ||
mad.h | ||
Makefile | ||
mmu_rb.c | ||
mmu_rb.h | ||
msix.c | ||
msix.h | ||
netdev_rx.c | ||
netdev.h | ||
opa_compat.h | ||
opfn.c | ||
opfn.h | ||
pcie.c | ||
pio_copy.c | ||
pio.c | ||
pio.h | ||
platform.c | ||
platform.h | ||
qp.c | ||
qp.h | ||
qsfp.c | ||
qsfp.h | ||
rc.c | ||
rc.h | ||
ruc.c | ||
sdma_txreq.h | ||
sdma.c | ||
sdma.h | ||
sysfs.c | ||
tid_rdma.c | ||
tid_rdma.h | ||
trace_ctxts.h | ||
trace_dbg.h | ||
trace_ibhdrs.h | ||
trace_iowait.h | ||
trace_misc.h | ||
trace_mmu.h | ||
trace_rc.h | ||
trace_rx.h | ||
trace_tid.h | ||
trace_tx.h | ||
trace.c | ||
trace.h | ||
uc.c | ||
ud.c | ||
user_exp_rcv.c | ||
user_exp_rcv.h | ||
user_pages.c | ||
user_sdma.c | ||
user_sdma.h | ||
verbs_txreq.c | ||
verbs_txreq.h | ||
verbs.c | ||
verbs.h | ||
vnic_main.c | ||
vnic_sdma.c | ||
vnic.h |