Skip to contentSkip to conversation

Revert "nouveau: pci: quiesce GPU on shutdown"

PATCH In review Marek Vasut 3 participants 5 messages Oct 25 – Nov 26

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "nouveau: pci: quiesce GPU on shutdown"

This reverts commit 310326bb7df4bba094a3fc60364c641c547fd923.

This breaks shutdown on ThinkPad W510, without the offending commit the system normally powers off, with the offending commit the system ends up spinning indefinitely and the CPU fan goes full throttle on shutdown.

The behavior was already reported in debian bugtracker multiple times for various other computers too, and git bisect lands as this commit.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141969
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1146033

I tested the revert with Linux 7.2.12 from debian unstable, not next or drm trees, mainly because it was easier with debian test-patches script on that machine.

---
Cc: Danilo Krummrich <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Li Chen <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Ole Carlsen <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Uwe Kleine-König <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
NOTE: Maybe the revert is not the ideal solution, but it does fix my
problem, and I think being able to shut computer down is a good functionality to have.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 32 ---------------------------
 1 file changed, 32 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -32
index 5e1336615cf6d..36c74f9edaa83 100644
@@ -1090,37 +1090,6 @@ nouveau_pmops_resume(struct device *dev)
 	return ret;
 }
 
-static void
-nouveau_drm_shutdown(struct pci_dev *pdev)
-{
-	struct nouveau_drm *drm = pci_get_drvdata(pdev);
-	int ret;
-
-	if (!drm)
-		return;
-
-	if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
-	    drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
-		return;
-
-	ret = nouveau_do_suspend(drm, false);
-	if (ret)
-		NV_ERROR(drm, "shutdown suspend failed with: %d\n", ret);
-
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-	/*
-	 *  This is just to give the pci power transition time to settle
-	 *  before an immediate kexec jump. it’s mirroring the existing
-	 *  nouveau_pmops_suspend() behavior, which already does
-	 *  udelay(200) right after pci_set_power_state(..., pci_d3hot). In
-	 *  ->shutdown() we’re allowed to sleep, so I used usleep_range()
-	 *  instead of a busy-wait udelay().
-	 */
-	usleep_range(200, 400);
-}
-
 static int
 nouveau_pmops_freeze(struct device *dev)
 {
@@ -1480,7 +1449,6 @@ nouveau_drm_pci_driver = {
 	.id_table = nouveau_drm_pci_table,
 	.probe = nouveau_drm_probe,
 	.remove = nouveau_drm_remove,
-	.shutdown = nouveau_drm_shutdown,
 	.driver.pm = &nouveau_pm_ops,
 };
 
Signature · 1 line
2.53.0
#1 lore raw

Control: forwarded -1 https://lore.kernel.org/nouveau/aviIPk4xbKhgqcTy@monoceros

Hello,

Quoted 10 lines · Marek Vasut

This reverts commit 310326bb7df4bba094a3fc60364c641c547fd923.

This breaks shutdown on ThinkPad W510, without the offending commit the system normally powers off, with the offending commit the system ends up spinning indefinitely and the CPU fan goes full throttle on shutdown.

The behavior was already reported in debian bugtracker multiple times for various other computers too, and git bisect lands as this commit.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141969

I think the original bug #1141969 is a different issue.

Quoted 1 line

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1146033

Here it affects a Lenovo ThinkPad T510 and I think that's the same issue that Marek has.

Quoted 56 lines

I tested the revert with Linux 7.2.12 from debian unstable, not next or drm trees, mainly because it was easier with debian test-patches script on that machine.

---
Cc: Danilo Krummrich <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Li Chen <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Ole Carlsen <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Uwe Kleine-König <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
NOTE: Maybe the revert is not the ideal solution, but it does fix my
problem, and I think being able to shut computer down is a good functionality to have.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 32 ---------------------------
 1 file changed, 32 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -21
index 5e1336615cf6d..36c74f9edaa83 100644
@@ -1090,37 +1090,6 @@ nouveau_pmops_resume(struct device *dev)
 	return ret;
 }
 
-static void
-nouveau_drm_shutdown(struct pci_dev *pdev)
-{
-	struct nouveau_drm *drm = pci_get_drvdata(pdev);
-	int ret;
-
-	if (!drm)
-		return;
-
-	if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
-	    drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
-		return;
-
-	ret = nouveau_do_suspend(drm, false);
-	if (ret)
-		NV_ERROR(drm, "shutdown suspend failed with: %d\n", ret);
-
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-	/*

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_pmops_resume(struct device *dev) · line 1123

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -10
-	 *  This is just to give the pci power transition time to settle
-	 *  before an immediate kexec jump. it’s mirroring the existing
-	 *  nouveau_pmops_suspend() behavior, which already does
-	 *  udelay(200) right after pci_set_power_state(..., pci_d3hot). In
-	 *  ->shutdown() we’re allowed to sleep, so I used usleep_range()
-	 *  instead of a busy-wait udelay().
-	 */
-	usleep_range(200, 400);
-}
-

I cannot reproduce it, but maybe it's helpful to find out where/how the driver hangs. Adding printks might be enough, and if not, remove stuff from nouveau_drm_shutdown() until it works. I'd guess this gives the needed insights to determine a fix without reverting the identified commit.

Best regards
Uwe

#2 lore raw

On 11/14/26 5:20 PM, Uwe Kleine-König wrote:

[...]

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -25
-static void
-nouveau_drm_shutdown(struct pci_dev *pdev)
-{
-	struct nouveau_drm *drm = pci_get_drvdata(pdev);
-	int ret;
-
-	if (!drm)
-		return;
-
-	if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
-	    drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
-		return;
-
-	ret = nouveau_do_suspend(drm, false);
-	if (ret)
-		NV_ERROR(drm, "shutdown suspend failed with: %d\n", ret);
-
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-	/*
-	 *  This is just to give the pci power transition time to settle
-	 *  before an immediate kexec jump. it’s mirroring the existing
-	 *  nouveau_pmops_suspend() behavior, which already does
-	 *  udelay(200) right after pci_set_power_state(..., pci_d3hot). In
Quoted 8 lines

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_pmops_resume(struct device *dev) · line 1123

Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -6
-	 *  ->shutdown() we’re allowed to sleep, so I used usleep_range()
-	 *  instead of a busy-wait udelay().
-	 */
-	usleep_range(200, 400);
-}
-

I cannot reproduce it

I can surely reproduce it, because since Linux 7.1 I cannot shut down my computer, something which worked since the beginning.

Quoted 3 lines

, but maybe it's helpful to find out where/how the
driver hangs. Adding printks might be enough, and if not, remove stuff from nouveau_drm_shutdown() until it works.

The laptop screen goes off, the machine is unresponsive this late during shutdown, so adding printks() does not help.

Quoted 3 lines

I'd guess this gives the
needed insights to determine a fix without reverting the identified commit.

The problematic commit should be reverted and reworked, since it breaks existing users. I am open to testing patches on that machine.

#3 lore raw
In reply to Marek Vasut

Control: forwarded 1146033 https://lore.kernel.org/[email protected]

#regzbot ^introduced: 310326bb7df4bba094a3fc60364c641c547fd923

Hello,

Quoted 12 lines · Marek Vasut

This reverts commit 310326bb7df4bba094a3fc60364c641c547fd923.

This breaks shutdown on ThinkPad W510, without the offending commit the system normally powers off, with the offending commit the system ends up spinning indefinitely and the CPU fan goes full throttle on shutdown.

The behavior was already reported in debian bugtracker multiple times for various other computers too, and git bisect lands as this commit.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141969
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1146033

Quoted 5 lines

I tested the revert with Linux 7.2.12 from debian unstable, not next or drm trees, mainly because it was easier with debian test-patches script on that machine.

Quoting the documentation:

Try to fix regressions quickly once the culprit has been identified; fixes for most regressions should be merged within two weeks.

In the meantime this report is more than 4 weeks old with no signal that someone looks into it. :-\

Can someone with the problem test the following patch please?:

drivers/gpu/drm/nouveau/nouveau_drm.c +0 -13
index 30311688618c..fd3518d4407e 100644
@@ -1111,19 +1111,6 @@ nouveau_drm_shutdown(struct pci_dev *pdev)
 	ret = nouveau_do_suspend(drm, false);
 	if (ret)
 		NV_ERROR(drm, "shutdown suspend failed with: %d\n", ret);
-
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-	/*
-	 *  This is just to give the pci power transition time to settle
-	 *  before an immediate kexec jump. it’s mirroring the existing
-	 *  nouveau_pmops_suspend() behavior, which already does
-	 *  udelay(200) right after pci_set_power_state(..., pci_d3hot). In
-	 *  ->shutdown() we’re allowed to sleep, so I used usleep_range()
-	 *  instead of a busy-wait udelay().
-	 */
-	usleep_range(200, 400);
 }
 
 static int

Bonus points to bisect further in that function (that is, readd lines if the above patch fixes the issue or remove further lines from the end if it doesn't).

Best regards
Uwe

#4 lore raw
In reply to Marek Vasut
Quoted 11 lines · Marek Vasut

This reverts commit 310326bb7df4bba094a3fc60364c641c547fd923.

This breaks shutdown on ThinkPad W510, without the offending commit the system normally powers off, with the offending commit the system ends up spinning indefinitely and the CPU fan goes full throttle on shutdown.

The behavior was already reported in debian bugtracker multiple times for various other computers too, and git bisect lands as this commit.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1141969
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1146033

@airlied: given that you recently applied a few nouveau bugfixes, could you maybe pick this one up, too?

I'd even say it's eligible for -fixes, as I'd say this is still a somewhat recent regressions and the fix hence "should be expedited", as Linus said some time ago[1].

And to make it obvious: this will reintroduce warnings during kexec the commit being reverted tried to fix. YMMV, but that seems like the smaller problem.

Ciao, Thorsten

[1]
https://lore.kernel.org/all/CAHk-=wis_qQy4oDNynNKi5b7Qhosmxtoj1jxo5wmB6SRUwQUBQ@mail.gmail.com/

Quoted 77 lines

I tested the revert with Linux 7.2.12 from debian unstable, not next or drm trees, mainly because it was easier with debian test-patches script on that machine.

---
Cc: Danilo Krummrich <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Li Chen <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Ole Carlsen <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Uwe Kleine-König <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
NOTE: Maybe the revert is not the ideal solution, but it does fix my
problem, and I think being able to shut computer down is a good functionality to have.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 32 ---------------------------
 1 file changed, 32 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -32
index 5e1336615cf6d..36c74f9edaa83 100644
@@ -1090,37 +1090,6 @@ nouveau_pmops_resume(struct device *dev)
 	return ret;
 }
 
-static void
-nouveau_drm_shutdown(struct pci_dev *pdev)
-{
-	struct nouveau_drm *drm = pci_get_drvdata(pdev);
-	int ret;
-
-	if (!drm)
-		return;
-
-	if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
-	    drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
-		return;
-
-	ret = nouveau_do_suspend(drm, false);
-	if (ret)
-		NV_ERROR(drm, "shutdown suspend failed with: %d\n", ret);
-
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-	/*
-	 *  This is just to give the pci power transition time to settle
-	 *  before an immediate kexec jump. it’s mirroring the existing
-	 *  nouveau_pmops_suspend() behavior, which already does
-	 *  udelay(200) right after pci_set_power_state(..., pci_d3hot). In
-	 *  ->shutdown() we’re allowed to sleep, so I used usleep_range()
-	 *  instead of a busy-wait udelay().
-	 */
-	usleep_range(200, 400);
-}
-
 static int
 nouveau_pmops_freeze(struct device *dev)
 {
@@ -1480,7 +1449,6 @@ nouveau_drm_pci_driver = {
 	.id_table = nouveau_drm_pci_table,
 	.probe = nouveau_drm_probe,
 	.remove = nouveau_drm_remove,
-	.shutdown = nouveau_drm_shutdown,
 	.driver.pm = &nouveau_pm_ops,
 };