Skip to contentSkip to conversation

drm/amdgpu: lock and unlock console only for amdgpu_fbdev_set_suspend [V2]

PATCH In review Shirish S 2 participants 5 messages Jul 18, 2018 – Jul 20, 2018 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amdgpu: lock and unlock console only for amdgpu_fbdev_set_suspend [V2]

[Why]
While the console_lock is held, console output will be buffered, till its unlocked it wont be emitted, hence its ideal to unlock sooner to enable debugging/detecting/fixing of any issue in the remaining sequence of events in resume path.

[How]
This patch restructures the console_lock, console_unlock around amdgpu_fbdev_set_suspend() and moves this new block appropriately.

V2: Kept amdgpu_fbdev_set_suspend after pci_set_power_state

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -10
index 709e4a3..b0fe727 100644
@@ -2720,9 +2720,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
-	if (fbcon)
-		console_lock();
-
 	if (resume) {
 		pci_set_power_state(dev->pdev, PCI_D0);
 		pci_restore_state(dev->pdev);
@@ -2746,7 +2743,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 
 	amdgpu_fence_driver_resume(adev);
 
-
 	r = amdgpu_device_ip_late_init(adev);
 	if (r)
 		goto unlock;
@@ -2784,6 +2780,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 			}
 			drm_modeset_unlock_all(dev);
 		}
+		console_lock();
+		amdgpu_fbdev_set_suspend(adev, 0);
+		console_unlock();
 	}
 
 	drm_kms_helper_poll_enable(dev);
@@ -2808,13 +2807,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	dev->dev->power.disable_depth--;
 #endif
 
-	if (fbcon)
-		amdgpu_fbdev_set_suspend(adev, 0);
-
 unlock:
-	if (fbcon)
-		console_unlock();
-
 	return r;
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1531909474-9661-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 5 lines · Shirish S

[Why]
While the console_lock is held, console output will be buffered, till its unlocked it wont be emitted, hence its ideal to unlock sooner to enable debugging/detecting/fixing of any issue in the remaining sequence of events in resume path.

Maybe this could be clarified that the concern is about consoles other than fbcon on this device, e.g. a serial console.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) · line 2748

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
@@ -2746,7 +2743,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 
 	amdgpu_fence_driver_resume(adev);
 
-
 	r = amdgpu_device_ip_late_init(adev);
 	if (r)
 		goto unlock;

Drop this hunk.

With the above fixed,

Possible follow-up work:

* Move the console_(un)lock calls into amdgpu_fbdev_set_suspend, or maybe use drm_fb_helper_set_suspend_unlocked instead of locking ourselves

* Move the amdgpu_fbdev_set_suspend call in amdgpu_device_suspend further up, at least before the pci_set_power_state call.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): ad4b3eec-d4d8-ceb5-dd11-e1562a82cc61-otUistvHUpPR7s880joybQ@public.gmane.org

#4 lore raw
Quoted 8 lines · Michel Dänzer

Possible follow-up work:

* Move the console_(un)lock calls into amdgpu_fbdev_set_suspend, or maybe use drm_fb_helper_set_suspend_unlocked instead of locking ourselves

* Move the amdgpu_fbdev_set_suspend call in amdgpu_device_suspend further up, at least before the pci_set_power_state call.

Shirish, would you like to look into these?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2362eda1-1e47-fd99-fdbd-c02c208d18bf-otUistvHUpPR7s880joybQ@public.gmane.org

author
#6 lore raw

Sure Michel, but not immediately.
Is that fine?
Regards,
Shirish S

-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Friday, July 20, 2018 1:04 PM
To: S, Shirish <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu: lock and unlock console only for amdgpu_fbdev_set_suspend [V2]

Quoted 9 lines · Michel Dänzer

Possible follow-up work:

* Move the console_(un)lock calls into amdgpu_fbdev_set_suspend, or maybe use drm_fb_helper_set_suspend_unlocked instead of locking ourselves

* Move the amdgpu_fbdev_set_suspend call in amdgpu_device_suspend further up, at least before the pci_set_power_state call.

Shirish, would you like to look into these?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BLUPR12MB0452C43DC65A9023EF3231B2F2510-7LeqcoF/[email protected]

#8 lore raw
Quoted 2 lines · Shirish

Sure Michel, but not immediately.
Is that fine?

Sure, thanks.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx