linux/drivers/dma
Fenghua Yu f221033f5c dmaengine: idxd: Fix oops during rmmod on single-CPU platforms
During the removal of the idxd driver, registered offline callback is
invoked as part of the clean up process. However, on systems with only
one CPU online, no valid target is available to migrate the
perf context, resulting in a kernel oops:

    BUG: unable to handle page fault for address: 000000000002a2b8
    #PF: supervisor write access in kernel mode
    #PF: error_code(0x0002) - not-present page
    PGD 1470e1067 P4D 0
    Oops: 0002 [#1] PREEMPT SMP NOPTI
    CPU: 0 PID: 20 Comm: cpuhp/0 Not tainted 6.8.0-rc6-dsa+ #57
    Hardware name: Intel Corporation AvenueCity/AvenueCity, BIOS BHSDCRB1.86B.2492.D03.2307181620 07/18/2023
    RIP: 0010:mutex_lock+0x2e/0x50
    ...
    Call Trace:
    <TASK>
    __die+0x24/0x70
    page_fault_oops+0x82/0x160
    do_user_addr_fault+0x65/0x6b0
    __pfx___rdmsr_safe_on_cpu+0x10/0x10
    exc_page_fault+0x7d/0x170
    asm_exc_page_fault+0x26/0x30
    mutex_lock+0x2e/0x50
    mutex_lock+0x1e/0x50
    perf_pmu_migrate_context+0x87/0x1f0
    perf_event_cpu_offline+0x76/0x90 [idxd]
    cpuhp_invoke_callback+0xa2/0x4f0
    __pfx_perf_event_cpu_offline+0x10/0x10 [idxd]
    cpuhp_thread_fun+0x98/0x150
    smpboot_thread_fn+0x27/0x260
    smpboot_thread_fn+0x1af/0x260
    __pfx_smpboot_thread_fn+0x10/0x10
    kthread+0x103/0x140
    __pfx_kthread+0x10/0x10
    ret_from_fork+0x31/0x50
    __pfx_kthread+0x10/0x10
    ret_from_fork_asm+0x1b/0x30
    <TASK>

Fix the issue by preventing the migration of the perf context to an
invalid target.

Fixes: 81dd4d4d61 ("dmaengine: idxd: Add IDXD performance monitor support")
Reported-by: Terrence Xu <terrence.xu@intel.com>
Tested-by: Terrence Xu <terrence.xu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Link: https://lore.kernel.org/r/20240313214031.1658045-1-fenghua.yu@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2024-04-07 17:56:06 +05:30
..
bestcomm dmaengine: bestcomm: Code cleanup for bcom_sram_init 2024-01-30 22:11:56 +05:30
dw dmaengine: dw: platform: Convert to platform remove callback returning void 2023-09-28 13:10:47 +05:30
dw-axi-dmac dmaengine: dw-axi-dmac: Add support DMAX_NUM_CHANNELS > 16 2023-10-16 16:38:10 +05:30
dw-edma dmaengine: dw-edma: eDMA: Add sync read before starting the DMA transfer in remote setup 2024-02-07 09:30:52 +01:00
fsl-dpaa2-qdma dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools 2024-01-22 16:05:05 +05:30
hsu dmaengine: hsu: Include headers we are direct user of 2022-09-04 22:49:35 +05:30
idxd dmaengine: idxd: Fix oops during rmmod on single-CPU platforms 2024-04-07 17:56:06 +05:30
ioat dmaengine: ioatdma: use pci_dev_id() to simplify the code 2023-08-21 18:39:25 +05:30
lgm dmaengine: lgm: Use builtin_platform_driver macro to simplify the code 2023-08-21 11:13:09 +05:30
mediatek dmaengine updates for v6.7 2023-11-03 18:56:51 -10:00
ppc4xx dmaengine: ppc4xx: adma: Convert to platform remove callback returning void 2023-09-28 13:10:52 +05:30
ptdma dmaengine: ptdma: use consistent DMA masks 2024-02-23 12:22:55 +05:30
qcom irqchip: Convert all platform MSI users to the new API 2024-02-15 17:55:40 +01:00
sf-pdma dmaengine: sf-pdma: add mpfs-pdma compatible name 2023-12-11 16:33:22 +05:30
sh dmaengine: shdma: increase size of 'dev_id' 2024-01-19 18:12:10 +05:30
ti dmaengine updates for v6.9 2024-03-15 12:25:13 -07:00
xilinx dmaengine: xilinx: xdma: Clarify kdoc in XDMA driver 2024-04-07 17:08:45 +05:30
acpi-dma.c dmaengine: acpi: Check for errors from acpi_register_gsi() separately 2021-08-06 21:48:11 +05:30
altera-msgdma.c dmaengine: altera-msgdma: Convert to platform remove callback returning void 2023-09-28 13:10:45 +05:30
amba-pl08x.c dmaengine: pl08x: constify pointer to char in filter function 2024-02-23 12:44:08 +05:30
apple-admac.c dmaengine: apple-admac: Keep upper bits of REG_BUS_WIDTH 2023-11-24 18:57:56 +05:30
at_hdmac.c dmaengine: at_hdmac: add missing kernel-doc style description 2024-02-02 17:16:55 +01:00
at_xdmac.c dmaengine: at_xdmac: Convert to platform remove callback returning void 2023-09-28 13:10:45 +05:30
bcm2835-dma.c dmaengine: bcm2835-dma: Convert to platform remove callback returning void 2023-09-28 13:10:46 +05:30
bcm-sba-raid.c dmaengine: bcm-sba-raid: Convert to platform remove callback returning void 2023-09-28 13:10:46 +05:30
dma-axi-dmac.c dmaengine: axi-dmac: Improve cyclic DMA transfers in SG mode 2023-12-21 21:39:56 +05:30
dma-jz4780.c dmaengine: dma-jz4780: Convert to platform remove callback returning void 2023-09-28 13:10:47 +05:30
dmaengine.c dmaengine: fix NULL pointer in channel unregistration function 2023-12-21 21:44:29 +05:30
dmaengine.h dmaengine: dmaengine_desc_callback_valid(): Check for callback_result 2021-10-25 09:42:56 +05:30
dmatest.c dmaengine: dmatest: prevent using swiotlb buffer with nobounce parameter 2023-12-11 20:15:27 +05:30
ep93xx_dma.c dmaengine: ep93xx_dma: Annotate struct ep93xx_dma_engine with __counted_by 2023-10-04 15:12:57 +05:30
fsl_raid.c dmaengine: fsl_raid: Convert to platform remove callback returning void 2023-09-28 13:10:48 +05:30
fsl_raid.h
fsl-edma-common.c dmaengine updates for v6.9 2024-03-15 12:25:13 -07:00
fsl-edma-common.h dmaengine updates for v6.9 2024-03-15 12:25:13 -07:00
fsl-edma-main.c dmaengine updates for v6.9 2024-03-15 12:25:13 -07:00
fsl-qdma.c dmaengine: fsl-qdma: add __iomem and struct in union to fix sparse warning 2024-02-23 12:20:39 +05:30
fsldma.c dmaengine: fsldma: Convert to platform remove callback returning void 2023-09-28 13:10:48 +05:30
fsldma.h
hisi_dma.c dmaengine: hisilicon: Annotate struct hisi_dma_dev with __counted_by 2023-09-28 16:42:14 +05:30
idma64.c idma64: Don't try to serve interrupts when device is powered off 2024-03-28 12:41:58 +05:30
idma64.h
img-mdc-dma.c dmaengine: img-mdc-dma: Convert to platform remove callback returning void 2023-09-28 13:10:48 +05:30
imx-dma.c dmaengine: imx-dma: Convert to platform remove callback returning void 2023-09-28 13:10:49 +05:30
imx-sdma.c dmaengine: imx-sdma: fix Excess kernel-doc warnings 2024-01-19 17:05:04 +05:30
k3dma.c dmaengine: Drop unnecessary of_match_device() calls 2023-10-09 10:55:16 +05:30
Kconfig dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA 2024-01-22 16:38:11 +05:30
lpc18xx-dmamux.c dmaengine: Explicitly include correct DT includes 2023-08-01 23:51:27 +05:30
ls2x-apb-dma.c dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller 2023-12-21 21:35:13 +05:30
Makefile dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller 2023-12-21 21:35:13 +05:30
mcf-edma-main.c dmaengine: mcf-edma: utilize edma_write_tcdreg() macro for TCD Access 2024-02-07 09:40:17 +01:00
milbeaut-hdmac.c dmaengine: milbeaut-hdmac: Convert to platform remove callback returning void 2023-11-24 18:32:30 +05:30
milbeaut-xdmac.c dmaengine: milbeaut-xdmac: Convert to platform remove callback returning void 2023-11-24 18:32:30 +05:30
mmp_pdma.c dmaengine: Drop unnecessary of_match_device() calls 2023-10-09 10:55:16 +05:30
mmp_tdma.c dmaengine: mmp_tdma: drop unused variable 'of_id' 2023-10-10 23:30:52 +05:30
moxart-dma.c dmaengine: moxart-dma: Annotate struct moxart_desc with __counted_by 2023-09-28 16:42:14 +05:30
mpc512x_dma.c dmaengine: mpc512x_dma: Convert to platform remove callback returning void 2023-09-28 13:10:51 +05:30
mv_xor_v2.c irqchip: Convert all platform MSI users to the new API 2024-02-15 17:55:40 +01:00
mv_xor.c dmaengine: Use device_get_match_data() 2023-10-09 10:54:48 +05:30
mv_xor.h
mxs-dma.c dmaengine: Explicitly include correct DT includes 2023-08-01 23:51:27 +05:30
nbpfaxi.c dmaengine: nbpfaxi: Convert to platform remove callback returning void 2023-09-28 13:10:52 +05:30
of-dma.c dmaengine: of: constify of_phandle_args in of_dma_find_controller() 2024-02-23 12:44:08 +05:30
owl-dma.c dmaengine: owl: fix register access functions 2024-03-28 12:29:36 +05:30
pch_dma.c dmaengine: pch_dma: Remove usage of the deprecated "pci-dma-compat.h" API 2022-01-08 22:16:44 +05:30
pl330.c dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-03-28 12:28:00 +05:30
plx_dma.c dmaengine: plx_dma: Don't set chancnt 2023-05-24 12:24:32 +05:30
pxa_dma.c dmaengine: Drop unnecessary of_match_device() calls 2023-10-09 10:55:16 +05:30
sa11x0-dma.c dmaengine: sa11x0: Annotate struct sa11x0_dma_desc with __counted_by 2023-09-28 16:42:14 +05:30
sprd-dma.c dmaengine: sprd: delete redundant parameter for dma driver function 2023-10-02 21:28:33 +05:30
st_fdma.c dmaengine: Use device_get_match_data() 2023-10-09 10:54:48 +05:30
st_fdma.h dmaengine: st_fdma: Annotate struct st_fdma_desc with __counted_by 2023-09-28 16:42:14 +05:30
ste_dma40_ll.c dmaengine: ste_dma40: Remove platform data 2023-05-16 23:00:19 +05:30
ste_dma40_ll.h
ste_dma40.c dmaengine: std_dma40: fix kernel-doc warnings and spelling 2023-12-21 21:31:30 +05:30
ste_dma40.h dmaengine: ste_dma40: Remove platform data 2023-05-16 23:00:19 +05:30
stm32-dma.c dmaengine: stm32-dma: avoid bitfield overflow assertion 2023-11-24 18:28:25 +05:30
stm32-dmamux.c dmaengine: Explicitly include correct DT includes 2023-08-01 23:51:27 +05:30
stm32-mdma.c dmaengine updates for v6.7 2023-11-03 18:56:51 -10:00
sun4i-dma.c dmaengine: sun4i-dma: Convert to platform remove callback returning void 2023-09-28 13:10:55 +05:30
sun6i-dma.c dmaengine: sun6i-dma: Convert to platform remove callback returning void 2023-09-28 13:10:56 +05:30
tegra20-apb-dma.c dmaengine: tegra20-apb-dma: Convert to platform remove callback returning void 2023-09-28 13:10:56 +05:30
tegra186-gpc-dma.c dmaengine: tegra186: Fix residual calculation 2024-03-28 12:31:42 +05:30
tegra210-adma.c dmaengine: tegra210-adma: Support dma-channel-mask property 2023-12-11 17:44:18 +05:30
timb_dma.c dmaengine: timb_dma: Convert to platform remove callback returning void 2023-09-28 13:10:58 +05:30
TODO
txx9dmac.c dmaengine: txx9dmac: Convert to platform remove callback returning void 2023-09-28 13:10:58 +05:30
txx9dmac.h
uniphier-mdmac.c dmaengine: uniphier-mdmac: Convert to platform remove callback returning void 2023-11-24 18:32:30 +05:30
uniphier-xdmac.c dmaengine: uniphier-xdmac: Convert to platform remove callback returning void 2023-11-24 18:32:30 +05:30
virt-dma.c
virt-dma.h
xgene-dma.c dmaengine: xgene-dma: Convert to platform remove callback returning void 2023-09-28 13:10:58 +05:30