Message ID | 20221215141251.3688780-1-vladimir.oltean@nxp.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v2,1/2] iommu/arm-smmu: don't unregister on shutdown | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Thu, 15 Dec 2022 16:12:50 +0200, Vladimir Oltean wrote: > Michael Walle says he noticed the following stack trace while performing > a shutdown with "reboot -f". He suggests he got "lucky" and just hit the > correct spot for the reboot while there was a packet transmission in > flight. > > Unable to handle kernel NULL pointer dereference at virtual address 0000000000000098 > CPU: 0 PID: 23 Comm: kworker/0:1 Not tainted 6.1.0-rc5-00088-gf3600ff8e322 #1930 > Hardware name: Kontron KBox A-230-LS (DT) > pc : iommu_get_dma_domain+0x14/0x20 > lr : iommu_dma_map_page+0x9c/0x254 > Call trace: > iommu_get_dma_domain+0x14/0x20 > dma_map_page_attrs+0x1ec/0x250 > enetc_start_xmit+0x14c/0x10b0 > enetc_xmit+0x60/0xdc > dev_hard_start_xmit+0xb8/0x210 > sch_direct_xmit+0x11c/0x420 > __dev_queue_xmit+0x354/0xb20 > ip6_finish_output2+0x280/0x5b0 > __ip6_finish_output+0x15c/0x270 > ip6_output+0x78/0x15c > NF_HOOK.constprop.0+0x50/0xd0 > mld_sendpack+0x1bc/0x320 > mld_ifc_work+0x1d8/0x4dc > process_one_work+0x1e8/0x460 > worker_thread+0x178/0x534 > kthread+0xe0/0xe4 > ret_from_fork+0x10/0x20 > Code: d503201f f9416800 d503233f d50323bf (f9404c00) > ---[ end trace 0000000000000000 ]--- > Kernel panic - not syncing: Oops: Fatal exception in interrupt > > [...] Applied to will (for-joerg/arm-smmu/fixes), thanks! [1/2] iommu/arm-smmu: don't unregister on shutdown https://git.kernel.org/will/c/42afa58a2431 [2/2] iommu/arm-smmu-v3: don't unregister on shutdown https://git.kernel.org/will/c/1dc4b4b5c5e7 Cheers,
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 30dab1418e3f..b2cf0871a5c0 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -2188,19 +2188,16 @@ static int arm_smmu_device_probe(struct platform_device *pdev) return 0; } -static int arm_smmu_device_remove(struct platform_device *pdev) +static void arm_smmu_device_shutdown(struct platform_device *pdev) { struct arm_smmu_device *smmu = platform_get_drvdata(pdev); if (!smmu) - return -ENODEV; + return; if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS)) dev_notice(&pdev->dev, "disabling translation\n"); - iommu_device_unregister(&smmu->iommu); - iommu_device_sysfs_remove(&smmu->iommu); - arm_smmu_rpm_get(smmu); /* Turn the thing off */ arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sCR0, ARM_SMMU_sCR0_CLIENTPD); @@ -2212,12 +2209,21 @@ static int arm_smmu_device_remove(struct platform_device *pdev) clk_bulk_disable(smmu->num_clks, smmu->clks); clk_bulk_unprepare(smmu->num_clks, smmu->clks); - return 0; } -static void arm_smmu_device_shutdown(struct platform_device *pdev) +static int arm_smmu_device_remove(struct platform_device *pdev) { - arm_smmu_device_remove(pdev); + struct arm_smmu_device *smmu = platform_get_drvdata(pdev); + + if (!smmu) + return -ENODEV; + + iommu_device_unregister(&smmu->iommu); + iommu_device_sysfs_remove(&smmu->iommu); + + arm_smmu_device_shutdown(pdev); + + return 0; } static int __maybe_unused arm_smmu_runtime_resume(struct device *dev)