drm/amdgpu: revert part of a commit fac53471d0ea9
Subsystems (2)
PATCH 1/1 drm/amdgpu: revert part of a commit fac53471d0ea9
From: Vitaly Prosyak <[email protected]>
Revert the following change: move drm_dev_unplug call after amdgpu_driver_unload_kms in amdgpu_pci_remove.
The reason is following: amdgpu_pci_remove calls drm_dev_unregister and it should be called first to ensure userspace can't access the device instance anymore. If we call drm_dev_unplug after amdgpu_driver_unload_kms then we observe IGT PCI software unplug test failure (kernel hung) for all ASIC's. This is how this regression was found.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
@@ -2226,6 +2226,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);struct amdgpu_device *adev =drm_to_adev (dev); +drm_dev_unplug (dev); +if (adev->pm.rpm_mode !=AMDGPU_RUNPM_NONE ) {pm_runtime_get_sync (dev->dev);pm_runtime_forbid (dev->dev);
@@ -2265,7 +2267,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)amdgpu_driver_unload_kms (dev); -drm_dev_unplug (dev); +/* * Flush any in flight DMA operations from device.
Signature · 1 line
2.25.1
Quoted 11 lines · On Fri, Jan 13, 2023 at 4:44 AM <[email protected]> wrote:
From: Vitaly Prosyak <[email protected]>
Revert the following change: move
drm_dev_unplugcall afteramdgpu_driver_unload_kmsinamdgpu_pci_remove.
The reason is following:amdgpu_pci_removecallsdrm_dev_unregisterand it should be called first to ensure userspace can't access the device instance anymore. If we calldrm_dev_unplugafteramdgpu_driver_unload_kmsthen we observe IGT PCI software unplug test failure (kernel hung) for all ASIC's. This is how this regression was found.
Maybe just revert the entire patch rather than a partial revert? That said, reverting the change will break
driver unload because we need to send certain messages to the PSP to clean things up. I'm not sure
what the best way around that is.
Alex
Quoted 31 lines
Signed-off-by Vitaly Prosyak <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3
-2@@ -2226,6 +2226,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);struct amdgpu_device *adev =drm_to_adev (dev); +drm_dev_unplug (dev); +if (adev->pm.rpm_mode !=AMDGPU_RUNPM_NONE ) {pm_runtime_get_sync (dev->dev);pm_runtime_forbid (dev->dev);@@ -2265,7 +2267,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)amdgpu_driver_unload_kms (dev); -drm_dev_unplug (dev); +/* * Flush any in flight DMA operations from device. -- 2.25.1