Skip to contentSkip to conversation

Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

PATCH Peter Chubb 4 participants 10 messages Dec 11, 2013 – Dec 12, 2013

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

On my HP Elitebook 8740w qith a Mobility Radeon HD 5870
commit 846ae41ae99d314bf2a02784152208a6ddf7eddc
breaks shutdown. The machine hangs when trying to shutdown, kexec or hibernate, before seeing the usual `machine halted' (or whatever) message.

If I comment out thus:

index 9f5ff28..40bff3c 100644

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -514,7 +514,7 @@ radeon_pci_shutdown(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
-	radeon_driver_unload_kms(dev);
+	/*radeon_driver_unload_kms(dev);*/
 }
 

then everything works again. Thsi is obviously not the proper fix.

--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA

#1 lore raw
Quoted 18 lines · Peter Chubb

On my HP Elitebook 8740w qith a Mobility Radeon HD 5870
commit 846ae41ae99d314bf2a02784152208a6ddf7eddc
breaks shutdown. The machine hangs when trying to shutdown, kexec or hibernate, before seeing the usual `machine halted' (or whatever) message.

If I comment out thus:

index 9f5ff28..40bff3c 100644

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -514,7 +514,7 @@ radeon_pci_shutdown(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
-	radeon_driver_unload_kms(dev);
+	/*radeon_driver_unload_kms(dev);*/
 }
 
Quoted 1 line

then everything works again. Thsi is obviously not the proper fix.

It would be interesting to know where exactly it hangs. Could you comment out the *_fini(rdev) calls in radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c) one after the other to find out which one is responsible?

Signature · 1 line
Markus
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]> writes:

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c) Markus> one after the other to find out which one is responsible?

It's radeon_device_fini() that is the problem.
--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA

#3 lore raw
Quoted 13 lines

-----Original Message-----
From: Peter Chubb [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 5:11 PM
To: Markus Trippelsdorf
Cc: Peter Chubb; Deucher, Alexander; [email protected]; dri- [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]> writes:

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Quoted 7 lines

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c)
Markus> one after the other to find out which one is responsible?

It's radeon_device_fini() that is the problem.

I think the problem is that the drm subsystem tears down the device via drm_driver.unload in drm_dev_unregister(), but now that we have a pci_driver.shutdown callback (which is needed for kexec) that gets called too so the driver gets torn down twice. What exactly happens when you say it's broken?

Alex

#4 lore raw
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · Alexander
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]>

writes:

Quoted 1 line · Peter Chubb
Quoted 1 line

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms

Quoted 1 line
Quoted 1 line

(drivers/gpu/drm/radeon/radeon_kms.c)

Markus> one after the other to find out which one is responsible?

Quoted 2 lines
Quoted 2 lines

It's radeon_device_fini() that is the problem.

Deucher,> I think the problem is that the drm subsystem tears down the Deucher,> device via drm_driver.unload in drm_dev_unregister(), but Deucher,> now that we have a pci_driver.shutdown callback (which is Deucher,> needed for kexec) that gets called too so the driver gets Deucher,> torn down twice. What exactly happens when you say it's Deucher,> broken?

The machine hangs, with blank screen, getting hotter and hotter with the fan screaming. Magic sysrq does nothing. Power button sometimes works and sometimes does nothing. The only sure way out is to take the battery out of the laptop.

--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA

#5 lore raw
In reply to Deucher, Alexander
Quoted 19 lines · Alexander
Quoted 19 lines

-----Original Message-----
From: Peter Chubb [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 5:11 PM
To: Markus Trippelsdorf
Cc: Peter Chubb; Deucher, Alexander; [email protected]; dri- [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]> writes:

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c)
Markus> one after the other to find out which one is responsible?

Quoted 6 lines
Quoted 1 line

It's radeon_device_fini() that is the problem.

I think the problem is that the drm subsystem tears down the device via drm_driver.unload in drm_dev_unregister(), but now that we have a pci_driver.shutdown callback (which is needed for kexec) that gets called too so the driver gets torn down twice.

If that is the case the following patch should fix the issue. Can you give it a try, Peter?

drivers/gpu/drm/radeon/radeon_kms.c +2 -1
index 55d0b474bd37..539e5f1ff5e3 100644
@@ -59,7 +59,8 @@ int radeon_driver_unload_kms(struct drm_device *dev)
 	radeon_acpi_fini(rdev);
 	
 	radeon_modeset_fini(rdev);
-	radeon_device_fini(rdev);
+	if (!rdev->shutdown)
+		radeon_device_fini(rdev);
 
 done_free:
 	kfree(rdev);
Signature · 1 line
Markus
#6 lore raw
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · Markus" == Markus Trippelsdorf
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]>

Markus> If that is the case the following patch should fix the issue. Markus> Can you give it a try, Peter?

Thanks that works. I tested shutdown, kexec, and s2disk --- all work correctly.

Peter C
--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA

#7 lore raw
In reply to Markus Trippelsdorf
Quoted 31 lines

-----Original Message-----
From: Markus Trippelsdorf [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 9:58 PM
To: Deucher, Alexander
Cc: Peter Chubb; [email protected]; [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 10 lines · Alexander
Quoted 10 lines

-----Original Message-----
From: Peter Chubb [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 5:11 PM
To: Markus Trippelsdorf
Cc: Peter Chubb; Deucher, Alexander; [email protected]; dri- [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]>

Quoted 11 lines · writes:
Quoted 10 lines

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c)
Markus> one after the other to find out which one is responsible?

It's radeon_device_fini() that is the problem.

Quoted 7 lines
Quoted 4 lines

I think the problem is that the drm subsystem tears down the device via drm_driver.unload in drm_dev_unregister(), but now that we have a pci_driver.shutdown callback (which is needed for kexec) that gets called too so the driver gets torn down twice.

If that is the case the following patch should fix the issue. Can you give it a try, Peter?

That may work, but I think it's just papering over a race which may still bite someone else depending on the timing.

Alex

Quoted 19 lines
drivers/gpu/drm/radeon/radeon_kms.c +2 -1
index 55d0b474bd37..539e5f1ff5e3 100644
@@ -59,7 +59,8 @@ int radeon_driver_unload_kms(struct drm_device
 *dev)
 	radeon_acpi_fini(rdev);
 
 	radeon_modeset_fini(rdev);
-	radeon_device_fini(rdev);
+	if (!rdev->shutdown)
+		radeon_device_fini(rdev);
 
 done_free:

kfree(rdev);
--
Markus

#8 lore raw
Quoted 23 lines · Alexander
Quoted 23 lines · Alexander
Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Peter Chubb [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 5:11 PM
To: Markus Trippelsdorf
Cc: Peter Chubb; Deucher, Alexander; [email protected]; dri- [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]>

Quoted 11 lines · writes:
Quoted 10 lines

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c)
Markus> one after the other to find out which one is responsible?

It's radeon_device_fini() that is the problem.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

I think the problem is that the drm subsystem tears down the device via drm_driver.unload in drm_dev_unregister(), but now that we have a pci_driver.shutdown callback (which is needed for kexec) that gets called too so the driver gets torn down twice.

If that is the case the following patch should fix the issue. Can you give it a try, Peter?

(Peter:)

Quoted 5 lines

Thanks that works. I tested shutdown, kexec, and s2disk --- all work correctly.

That may work, but I think it's just papering over a race which may still bite someone else depending on the timing.

This leaves three possibilities:

1) Revert 846ae41ae99d now and come up with a solution with proper locking for 3.14
2) Add my simple fix now and implement additional locking if the need arises for 3.14.
3) Implement a fix with proper locking now.

It's your choice Alex.

Signature · 1 line
Markus
#9 lore raw
Quoted 40 lines · Markus Trippelsdorf
Quoted 23 lines · Alexander
Quoted 23 lines · Alexander
Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Peter Chubb [mailto:[email protected]]
Sent: Wednesday, December 11, 2013 5:11 PM
To: Markus Trippelsdorf
Cc: Peter Chubb; Deucher, Alexander; [email protected]; dri- [email protected]
Subject: Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markus" == Markus Trippelsdorf <[email protected]>

Quoted 11 lines · writes:
Quoted 10 lines

Markus> On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:

Markus> It would be interesting to know where exactly it hangs. Could Markus> you comment out the *_fini(rdev) calls in
Markus> radeon_driver_unload_kms (drivers/gpu/drm/radeon/radeon_kms.c)
Markus> one after the other to find out which one is responsible?

It's radeon_device_fini() that is the problem.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

I think the problem is that the drm subsystem tears down the device via drm_driver.unload in drm_dev_unregister(), but now that we have a pci_driver.shutdown callback (which is needed for kexec) that gets called too so the driver gets torn down twice.

If that is the case the following patch should fix the issue. Can you give it a try, Peter?

(Peter:)

Quoted 5 lines

Thanks that works. I tested shutdown, kexec, and s2disk --- all work correctly.

That may work, but I think it's just papering over a race which may still bite someone else depending on the timing.

This leaves three possibilities:

Quoted 7 lines

1) Revert 846ae41ae99d now and come up with a solution with proper locking for 3.14
2) Add my simple fix now and implement additional locking if the need arises for 3.14.
3) Implement a fix with proper locking now.

It's your choice Alex.

I guess I'll revert it for now. I need to think about it a bit more. Thanks for your help.

Alex

Quoted 7 lines

--
Markus
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel