linux-stable/drivers/misc
Vishnu Dasa 3daed6345d VMCI: Use threaded irqs instead of tasklets
The vmci_dispatch_dgs() tasklet function calls vmci_read_data()
which uses wait_event() resulting in invalid sleep in an atomic
context (and therefore potentially in a deadlock).

Use threaded irqs to fix this issue and completely remove usage
of tasklets.

[   20.264639] BUG: sleeping function called from invalid context at drivers/misc/vmw_vmci/vmci_guest.c:145
[   20.264643] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 762, name: vmtoolsd
[   20.264645] preempt_count: 101, expected: 0
[   20.264646] RCU nest depth: 0, expected: 0
[   20.264647] 1 lock held by vmtoolsd/762:
[   20.264648]  #0: ffff0000874ae440 (sk_lock-AF_VSOCK){+.+.}-{0:0}, at: vsock_connect+0x60/0x330 [vsock]
[   20.264658] Preemption disabled at:
[   20.264659] [<ffff80000151d7d8>] vmci_send_datagram+0x44/0xa0 [vmw_vmci]
[   20.264665] CPU: 0 PID: 762 Comm: vmtoolsd Not tainted 5.19.0-0.rc8.20220727git39c3c396f813.60.fc37.aarch64 #1
[   20.264667] Hardware name: VMware, Inc. VBSA/VBSA, BIOS VEFI 12/31/2020
[   20.264668] Call trace:
[   20.264669]  dump_backtrace+0xc4/0x130
[   20.264672]  show_stack+0x24/0x80
[   20.264673]  dump_stack_lvl+0x88/0xb4
[   20.264676]  dump_stack+0x18/0x34
[   20.264677]  __might_resched+0x1a0/0x280
[   20.264679]  __might_sleep+0x58/0x90
[   20.264681]  vmci_read_data+0x74/0x120 [vmw_vmci]
[   20.264683]  vmci_dispatch_dgs+0x64/0x204 [vmw_vmci]
[   20.264686]  tasklet_action_common.constprop.0+0x13c/0x150
[   20.264688]  tasklet_action+0x40/0x50
[   20.264689]  __do_softirq+0x23c/0x6b4
[   20.264690]  __irq_exit_rcu+0x104/0x214
[   20.264691]  irq_exit_rcu+0x1c/0x50
[   20.264693]  el1_interrupt+0x38/0x6c
[   20.264695]  el1h_64_irq_handler+0x18/0x24
[   20.264696]  el1h_64_irq+0x68/0x6c
[   20.264697]  preempt_count_sub+0xa4/0xe0
[   20.264698]  _raw_spin_unlock_irqrestore+0x64/0xb0
[   20.264701]  vmci_send_datagram+0x7c/0xa0 [vmw_vmci]
[   20.264703]  vmci_datagram_dispatch+0x84/0x100 [vmw_vmci]
[   20.264706]  vmci_datagram_send+0x2c/0x40 [vmw_vmci]
[   20.264709]  vmci_transport_send_control_pkt+0xb8/0x120 [vmw_vsock_vmci_transport]
[   20.264711]  vmci_transport_connect+0x40/0x7c [vmw_vsock_vmci_transport]
[   20.264713]  vsock_connect+0x278/0x330 [vsock]
[   20.264715]  __sys_connect_file+0x8c/0xc0
[   20.264718]  __sys_connect+0x84/0xb4
[   20.264720]  __arm64_sys_connect+0x2c/0x3c
[   20.264721]  invoke_syscall+0x78/0x100
[   20.264723]  el0_svc_common.constprop.0+0x68/0x124
[   20.264724]  do_el0_svc+0x38/0x4c
[   20.264725]  el0_svc+0x60/0x180
[   20.264726]  el0t_64_sync_handler+0x11c/0x150
[   20.264728]  el0t_64_sync+0x190/0x194

Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Suggested-by: Zack Rusin <zackr@vmware.com>
Reported-by: Nadav Amit <namit@vmware.com>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Fixes: 463713eb61 ("VMCI: dma dg: add support for DMA datagrams receive")
Cc: <stable@vger.kernel.org> # v5.18+
Cc: VMware PV-Drivers Reviewers <pv-drivers@vmware.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bryan Tan <bryantan@vmware.com>
Reviewed-by: Bryan Tan <bryantan@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Link: https://lore.kernel.org/r/20221130070511.46558-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-20 13:24:11 +01:00
..
altera-stapl misc: move from strlcpy with unused retval to strscpy 2022-09-01 16:29:42 +02:00
bcm-vk misc: bcm_vk: Remove usage of deprecated functions 2022-09-01 16:29:32 +02:00
c2port
cardreader
cb710
cxl powerpc updates for 6.2 2022-12-19 07:13:33 -06:00
echo
eeprom misc: eeprom/idt_89hpesx: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
genwqe Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
habanalabs Char/Misc driver changes for 6.2-rc1 2022-12-16 03:49:24 -08:00
ibmasm
lis3lv02d misc: lis3lv02d/lis3lv02d_i2c: Convert to i2c's .probe_new() 2022-11-23 19:56:01 +01:00
lkdtm lkdtm: cfi: Make PAC test work with GCC 7 and 8 2022-12-14 16:05:09 -08:00
mchp_pci1xxxx misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe() 2022-09-22 16:54:35 +02:00
mei mei: me: add meteor lake point M DID 2023-01-20 13:21:48 +01:00
ocxl Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
pvpanic
sgi-gru misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-11-23 19:55:48 +01:00
sgi-xp drivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h 2022-09-24 14:57:19 +02:00
ti-st
uacce iommu: Remove SVM_FLAG_SUPERVISOR_MODE support 2022-11-03 15:47:45 +01:00
vmw_vmci VMCI: Use threaded irqs instead of tasklets 2023-01-20 13:24:11 +01:00
Kconfig misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
Makefile misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
ad525x_dpot-i2c.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c misc: apds990x: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
apds9802als.c misc: apds9802als: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
atmel-ssc.c misc: update maintainer email address and description for atmel-ssc 2022-08-03 11:03:03 +02:00
bh1770glc.c misc: bh1770glc: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
cs5535-mfgpt.c
ds1682.c misc: ds1682: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
dummy-irq.c
dw-xdata-pcie.c
enclosure.c
fastrpc.c misc: fastrpc: Pass bitfield into qcom_scm_assign_mem 2023-01-20 13:23:57 +01:00
gehc-achc.c
hi6421v600-irq.c
hisi_hikey_usb.c
hmc6352.c misc: hmc6352: Convert to i2c's .probe_new() 2022-11-23 19:56:38 +01:00
hpilo.c
hpilo.h
ibmvmc.c ibmvmc: don't open-code file_inode() 2022-09-01 17:42:27 -04:00
ibmvmc.h
ics932s401.c misc: ics932s401: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
isl29003.c misc: isl29003: Convert to i2c's .probe_new() 2022-11-23 19:56:39 +01:00
isl29020.c misc: isl29020: Convert to i2c's .probe_new() 2022-11-23 19:56:07 +01:00
kgdbts.c
lattice-ecp3-config.c
open-dice.c
pch_phub.c
pci_endpoint_test.c misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic 2022-09-09 10:24:12 +02:00
phantom.c
qcom-coincell.c
smpro-errmon.c misc: smpro-errmon: Add Ampere's SMpro error monitor driver 2022-11-10 19:02:43 +01:00
smpro-misc.c misc: smpro-misc: Add Ampere's Altra SMpro misc driver 2022-11-10 19:03:03 +01:00
sram-exec.c mm: Introduce set_memory_rox() 2022-12-15 10:37:26 -08:00
sram.c
sram.h
tifm_7xx1.c misc: tifm: fix possible memory leak in tifm_7xx1_switch_media() 2022-11-23 19:55:26 +01:00
tifm_core.c
tsl2550.c misc: tsl2550: Convert to i2c's .probe_new() 2022-11-23 19:56:05 +01:00
vcpu_stall_detector.c misc: Add a mechanism to detect stalls on guest vCPUs 2022-07-14 16:54:17 +02:00
vmw_balloon.c - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
xilinx_sdfec.c misc/xilinx_sdfec: Replace kmap() with kmap_local_page() 2022-09-09 10:22:36 +02:00