Skip to contentSkip to conversation

drm/amd/amdgpu: S3 resume fail

PATCH In review jimqu 3 participants 10 messages Aug 10, 2016 – Aug 15, 2016 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

jimqu

author
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: S3 resume fail

Doing S3 stress test, sometimes, driver can not get console lock. So use console_trylock() to instead it.

Change-Id I50177f3d7dbb923cb4f602a11ea51c397b12b3e6
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -3
index 087e520..bd5387d 100644
@@ -1889,9 +1889,6 @@ int amdgpu_resume_kms(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);
@@ -1989,6 +1986,8 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
 #endif
 
 	if (fbcon) {
+		if (!console_trylock())
+			return 0;
 		amdgpu_fbdev_set_suspend(adev, 0);
 		console_unlock();
 	}
Signature · 6 lines
1.9.1

_______________________________________________
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): 1470798241-30117-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 2 lines · jimqu

Doing S3 stress test, sometimes, driver can not get console lock. So use console_trylock() to instead it.

This raises some questions:

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

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
index 087e520..bd5387d 100644
@@ -1889,9 +1889,6 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
-	if (fbcon) {
-		console_lock();
-	}

What else is holding console_lock at this time?

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

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -1989,6 +1986,8 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
 #endif
 
 	if (fbcon) {
+		if (!console_trylock())
+			return 0;
 		amdgpu_fbdev_set_suspend(adev, 0);
 		console_unlock();
 	}

Do virtual terminals controlled by fbcon actually work if we don't call amdgpu_fbdev_set_suspend(adev, 0) here?

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): efcd0456-211f-25cf-e173-a7a71ff8d2a6-otUistvHUpPR7s880joybQ@public.gmane.org

#4 lore raw
Quoted 15 lines · Michel Dänzer
Quoted 2 lines · jimqu

Doing S3 stress test, sometimes, driver can not get console lock. So use console_trylock() to instead it.

This raises some questions:

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 087e520..bd5387d 100644
@@ -1889,9 +1889,6 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
Quoted 5 lines

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
-	if (fbcon) {
-		console_lock();
-	}

What else is holding console_lock at this time?

Maybe something calls console_lock but not console_unlock? E.g. I see some error cases in amdgpu_resume_kms were this could happen.

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): 5873b905-5835-0b33-7814-43d9cb377a29-otUistvHUpPR7s880joybQ@public.gmane.org

author
#6 lore raw

HI Michel:

1. So far, I not sure which one causes the console_lock() fail, maybe I need enable kernel mutex debug feature to trace it.

2. Phenomenally, it can be restore to desktop normally. Do you know any methods to check it whether driver without calling amdgpu_fbdev_set_suspend(adev, 0) has side effect or not?

Thanks
JimQu

________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2016年8月10日 11:28:39
收件人: Qu, Jim
抄送: [email protected]
主题: Re: [PATCH] drm/amd/amdgpu: S3 resume fail

Quoted 15 lines · Michel Dänzer
Quoted 2 lines · jimqu

Doing S3 stress test, sometimes, driver can not get console lock. So use console_trylock() to instead it.

This raises some questions:

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 087e520..bd5387d 100644
@@ -1889,9 +1889,6 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
     if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
             return 0;
 
Quoted 5 lines

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
-    if (fbcon) {
-            console_lock();
-    }

What else is holding console_lock at this time?

Maybe something calls console_lock but not console_unlock? E.g. I see some error cases in amdgpu_resume_kms were this could happen.

--
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): BY2PR12MB06141D01D607DB4D7FE2B155991D0-K//h7OWB4q5SmL+xRiD5tgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#8 lore raw
Quoted 4 lines · Jim

HI Michel:

1. So far, I not sure which one causes the console_lock() fail, maybe I need enable kernel mutex debug feature to trace it.

Or, maybe you can just try fixing the cases in amdgpu_resume_kms where console_unlock() isn't called, and see if that fixes the problem?

Quoted 3 lines

2. Phenomenally, it can be restore to desktop normally. Do you know any methods to check it whether driver without calling amdgpu_fbdev_set_suspend(adev, 0) has side effect or not?

Does VT switching to console with Ctrl-Alt-Fx work? Does logging into the console and interacting with the shell work?

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): 0638514e-e893-f21d-64bf-85399b542453-otUistvHUpPR7s880joybQ@public.gmane.org

author
#10 lore raw

Hi Michel:

1. add console_unlock() in fail case
------issue also can be observed.
2. with console_trylock()
------switch VT is no problem.
------log into console and interact with shell are no problem.

Thanks
JimQu

________________________________________
发件人: Michel Dänzer <[email protected]> 发送时间: 2016年8月10日 14:54:48
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: [PATCH] drm/amd/amdgpu: S3 resume fail

Quoted 4 lines · Jim

HI Michel:

1. So far, I not sure which one causes the console_lock() fail, maybe I need enable kernel mutex debug feature to trace it.

Or, maybe you can just try fixing the cases in amdgpu_resume_kms where console_unlock() isn't called, and see if that fixes the problem?

Quoted 3 lines

2. Phenomenally, it can be restore to desktop normally. Do you know any methods to check it whether driver without calling amdgpu_fbdev_set_suspend(adev, 0) has side effect or not?

Does VT switching to console with Ctrl-Alt-Fx work? Does logging into the console and interacting with the shell work?

--
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): BY2PR12MB0614C7B2175A68AA49B966EE99100-K//h7OWB4q5SmL+xRiD5tgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#12 lore raw

Michel is correct your patch will probably break resume in some cases.

Please enable lockdep debugging during your kernel compile and take a look what is deadlocking here and why instead of trying to band aid over the real problem.

Regards,
Christian.

Am 13.08.2016 um 08:56 schrieb Qu, Jim:

Quoted 35 lines

Hi Michel:

1. add console_unlock() in fail case
------issue also can be observed.
2. with console_trylock()
------switch VT is no problem.
------log into console and interact with shell are no problem.

Thanks
JimQu

________________________________________
发件人: Michel Dänzer <[email protected]> 发送时间: 2016年8月10日 14:54:48
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: [PATCH] drm/amd/amdgpu: S3 resume fail

Quoted 4 lines · Jim

HI Michel:

1. So far, I not sure which one causes the console_lock() fail, maybe I need enable kernel mutex debug feature to trace it.

Or, maybe you can just try fixing the cases in amdgpu_resume_kms where console_unlock() isn't called, and see if that fixes the problem?

Quoted 3 lines

2. Phenomenally, it can be restore to desktop normally. Do you know any methods to check it whether driver without calling amdgpu_fbdev_set_suspend(adev, 0) has side effect or not?

Does VT switching to console with Ctrl-Alt-Fx work? Does logging into the console and interacting with the shell work?

Quoted 7 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

_______________________________________________
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): 3f9fbabd-53ba-6c7a-ca55-6c9ad78791cf-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

author
#14 lore raw

Hi Christian:

OK, I will do it after solve VCE reset problem.

Thanks
JimQu

________________________________________
发件人: Christian König <[email protected]> 发送时间: 2016年8月13日 16:51:49
收件人: Qu, Jim; Michel Dänzer
抄送: [email protected]
主题: Re: 答复: 答复: [PATCH] drm/amd/amdgpu: S3 resume fail

Michel is correct your patch will probably break resume in some cases.

Please enable lockdep debugging during your kernel compile and take a look what is deadlocking here and why instead of trying to band aid over the real problem.

Regards,
Christian.

Am 13.08.2016 um 08:56 schrieb Qu, Jim:

Quoted 35 lines

Hi Michel:

1. add console_unlock() in fail case
------issue also can be observed.
2. with console_trylock()
------switch VT is no problem.
------log into console and interact with shell are no problem.

Thanks
JimQu

________________________________________
发件人: Michel Dänzer <[email protected]> 发送时间: 2016年8月10日 14:54:48
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: [PATCH] drm/amd/amdgpu: S3 resume fail

Quoted 4 lines · Jim

HI Michel:

1. So far, I not sure which one causes the console_lock() fail, maybe I need enable kernel mutex debug feature to trace it.

Or, maybe you can just try fixing the cases in amdgpu_resume_kms where console_unlock() isn't called, and see if that fixes the problem?

Quoted 3 lines

2. Phenomenally, it can be restore to desktop normally. Do you know any methods to check it whether driver without calling amdgpu_fbdev_set_suspend(adev, 0) has side effect or not?

Does VT switching to console with Ctrl-Alt-Fx work? Does logging into the console and interacting with the shell work?

Quoted 7 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

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

#15 lore raw
In reply to a message not in the archive
Quoted 5 lines · Jim

Hi Michel:

2. with console_trylock()
------switch VT is no problem.
------log into console and interact with shell are no problem.

Just to be clear, that's the case even if console_trylock() fails, and amdgpu_fbdev_set_suspend(adev, 0) isn't called?

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): 05b699c4-d38d-b38b-2c30-4b1ca99fecb1-otUistvHUpPR7s880joybQ@public.gmane.org

author
#17 lore raw

Hi Michel:

I modify the code like as:

        if (fbcon) {
                return 0;
                if (!console_trylock())
                        return 0;
                amdgpu_fbdev_set_suspend(adev, 0);
                console_unlock();
        }

Thanks
JimQu

________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2016年8月15日 8:44:29
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: 答复: [PATCH] drm/amd/amdgpu: S3 resume fail

Quoted 5 lines · Jim

Hi Michel:

2. with console_trylock()
------switch VT is no problem.
------log into console and interact with shell are no problem.

Just to be clear, that's the case even if console_trylock() fails, and amdgpu_fbdev_set_suspend(adev, 0) isn't called?

--
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