drm/radeon: Do not hold console lock during resume
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 15 Jul 2025 09:50:54 +0000 (11:50 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 16 Jul 2025 20:48:34 +0000 (16:48 -0400)
The function radeon_resume_kms() acquires the console lock. It is
inconsistent, as it depends on the notify_client argument. That
lock then covers a number of suspend operations that are unrelated
to the console.

Remove the calls to console_lock() and console_unlock() from the
radeon function. The console lock is only required by DRM's fbdev
emulation, which acquires it as necessary.

Also fixes a possible circular dependency between the console lock
and the client-list mutex, where the mutex is supposed to be taken
first.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fff8e0504499a929f26e2fb7cf7e2c9854e37b91)

drivers/gpu/drm/radeon/radeon_device.c

index 6f50cfdfe5a2ee72f1a533d24c919b45724bfd46..7a3e510327b7933623a0743f22381727fccc1e9b 100644 (file)
@@ -26,7 +26,6 @@
  *          Jerome Glisse
  */
 
-#include <linux/console.h>
 #include <linux/efi.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
@@ -1659,17 +1658,11 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool notify_clients)
        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;
 
-       if (notify_clients) {
-               console_lock();
-       }
        if (resume) {
                pci_set_power_state(pdev, PCI_D0);
                pci_restore_state(pdev);
-               if (pci_enable_device(pdev)) {
-                       if (notify_clients)
-                               console_unlock();
+               if (pci_enable_device(pdev))
                        return -1;
-               }
        }
        /* resume AGP if in use */
        radeon_agp_resume(rdev);
@@ -1745,10 +1738,8 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool notify_clients)
        if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled)
                radeon_pm_compute_clocks(rdev);
 
-       if (notify_clients) {
-               drm_client_dev_resume(dev, true);
-               console_unlock();
-       }
+       if (notify_clients)
+               drm_client_dev_resume(dev, false);
 
        return 0;
 }