All of lore.kernel.org
 help / color / mirror / Atom feed
* Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown
@ 2013-12-11  0:37 Peter Chubb
  2013-12-11  7:26 ` Markus Trippelsdorf
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Chubb @ 2013-12-11  0:37 UTC (permalink / raw)
  To: markus, alexander.deucher; +Cc: dri-devel


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
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after  drm/radeon: Implement radeon_pci_shutdown
  2013-12-11  0:37 Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown Peter Chubb
@ 2013-12-11  7:26 ` Markus Trippelsdorf
  2013-12-11 22:11   ` Peter Chubb
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Trippelsdorf @ 2013-12-11  7:26 UTC (permalink / raw)
  To: Peter Chubb; +Cc: alexander.deucher, dri-devel

On 2013.12.11 at 11:37 +1100, Peter Chubb wrote:
> 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
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -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.

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? 

-- 
Markus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown
  2013-12-11  7:26 ` Markus Trippelsdorf
@ 2013-12-11 22:11   ` Peter Chubb
  2013-12-11 23:46     ` Deucher, Alexander
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Chubb @ 2013-12-11 22:11 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: alexander.deucher, Peter Chubb, dri-devel

>>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Can no longer shutdown after  drm/radeon: Implement radeon_pci_shutdown
  2013-12-11 22:11   ` Peter Chubb
@ 2013-12-11 23:46     ` Deucher, Alexander
  2013-12-12  0:04       ` Peter Chubb
  2013-12-12  2:58       ` Markus Trippelsdorf
  0 siblings, 2 replies; 10+ messages in thread
From: Deucher, Alexander @ 2013-12-11 23:46 UTC (permalink / raw)
  To: Peter Chubb, Markus Trippelsdorf; +Cc: dri-devel

> -----Original Message-----
> From: Peter Chubb [mailto:peter.chubb@nicta.com.au]
> Sent: Wednesday, December 11, 2013 5:11 PM
> To: Markus Trippelsdorf
> Cc: Peter Chubb; Deucher, Alexander; airlied@linux.ie; dri-
> devel@lists.freedesktop.org
> Subject: Re: Can no longer shutdown after drm/radeon: Implement
> radeon_pci_shutdown
> 
> >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de> 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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown
  2013-12-11 23:46     ` Deucher, Alexander
@ 2013-12-12  0:04       ` Peter Chubb
  2013-12-12  2:58       ` Markus Trippelsdorf
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Chubb @ 2013-12-12  0:04 UTC (permalink / raw)
  To: Deucher, Alexander; +Cc: Peter Chubb, dri-devel, Markus Trippelsdorf

>>>>> "Deucher," == Deucher, Alexander <Alexander.Deucher@amd.com> writes:

>> 
>> >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de>
>> 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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after  drm/radeon: Implement radeon_pci_shutdown
  2013-12-11 23:46     ` Deucher, Alexander
  2013-12-12  0:04       ` Peter Chubb
@ 2013-12-12  2:58       ` Markus Trippelsdorf
  2013-12-12  3:10         ` Peter Chubb
  2013-12-12  3:27         ` Deucher, Alexander
  1 sibling, 2 replies; 10+ messages in thread
From: Markus Trippelsdorf @ 2013-12-12  2:58 UTC (permalink / raw)
  To: Deucher, Alexander; +Cc: Peter Chubb, dri-devel

On 2013.12.11 at 23:46 +0000, Deucher, Alexander wrote:
> > -----Original Message-----
> > From: Peter Chubb [mailto:peter.chubb@nicta.com.au]
> > Sent: Wednesday, December 11, 2013 5:11 PM
> > To: Markus Trippelsdorf
> > Cc: Peter Chubb; Deucher, Alexander; airlied@linux.ie; dri-
> > devel@lists.freedesktop.org
> > Subject: Re: Can no longer shutdown after drm/radeon: Implement
> > radeon_pci_shutdown
> > 
> > >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de> 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.
> 
> 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?

diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 55d0b474bd37..539e5f1ff5e3 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown
  2013-12-12  2:58       ` Markus Trippelsdorf
@ 2013-12-12  3:10         ` Peter Chubb
  2013-12-12  3:27         ` Deucher, Alexander
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Chubb @ 2013-12-12  3:10 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Deucher, Alexander, Peter Chubb, dri-devel

>>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de> writes:
>> > >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de>


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Can no longer shutdown after  drm/radeon: Implement radeon_pci_shutdown
  2013-12-12  2:58       ` Markus Trippelsdorf
  2013-12-12  3:10         ` Peter Chubb
@ 2013-12-12  3:27         ` Deucher, Alexander
  2013-12-12 13:56           ` Markus Trippelsdorf
  1 sibling, 1 reply; 10+ messages in thread
From: Deucher, Alexander @ 2013-12-12  3:27 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Peter Chubb, dri-devel

> -----Original Message-----
> From: Markus Trippelsdorf [mailto:markus@trippelsdorf.de]
> Sent: Wednesday, December 11, 2013 9:58 PM
> To: Deucher, Alexander
> Cc: Peter Chubb; airlied@linux.ie; dri-devel@lists.freedesktop.org
> Subject: Re: Can no longer shutdown after drm/radeon: Implement
> radeon_pci_shutdown
> 
> On 2013.12.11 at 23:46 +0000, Deucher, Alexander wrote:
> > > -----Original Message-----
> > > From: Peter Chubb [mailto:peter.chubb@nicta.com.au]
> > > Sent: Wednesday, December 11, 2013 5:11 PM
> > > To: Markus Trippelsdorf
> > > Cc: Peter Chubb; Deucher, Alexander; airlied@linux.ie; dri-
> > > devel@lists.freedesktop.org
> > > Subject: Re: Can no longer shutdown after drm/radeon: Implement
> > > radeon_pci_shutdown
> > >
> > > >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de>
> 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.
> >
> > 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

> 
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c
> b/drivers/gpu/drm/radeon/radeon_kms.c
> index 55d0b474bd37..539e5f1ff5e3 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after  drm/radeon: Implement radeon_pci_shutdown
  2013-12-12  3:27         ` Deucher, Alexander
@ 2013-12-12 13:56           ` Markus Trippelsdorf
  2013-12-12 14:11             ` Alex Deucher
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Trippelsdorf @ 2013-12-12 13:56 UTC (permalink / raw)
  To: Deucher, Alexander; +Cc: Peter Chubb, dri-devel

On 2013.12.12 at 03:27 +0000, Deucher, Alexander wrote:
> > On 2013.12.11 at 23:46 +0000, Deucher, Alexander wrote:
> > > > -----Original Message-----
> > > > From: Peter Chubb [mailto:peter.chubb@nicta.com.au]
> > > > Sent: Wednesday, December 11, 2013 5:11 PM
> > > > To: Markus Trippelsdorf
> > > > Cc: Peter Chubb; Deucher, Alexander; airlied@linux.ie; dri-
> > > > devel@lists.freedesktop.org
> > > > Subject: Re: Can no longer shutdown after drm/radeon: Implement
> > > > radeon_pci_shutdown
> > > >
> > > > >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de>
> > 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.
> > >
> > > 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:)
> 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.

-- 
Markus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown
  2013-12-12 13:56           ` Markus Trippelsdorf
@ 2013-12-12 14:11             ` Alex Deucher
  0 siblings, 0 replies; 10+ messages in thread
From: Alex Deucher @ 2013-12-12 14:11 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Deucher, Alexander, Peter Chubb, dri-devel

On Thu, Dec 12, 2013 at 8:56 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2013.12.12 at 03:27 +0000, Deucher, Alexander wrote:
>> > On 2013.12.11 at 23:46 +0000, Deucher, Alexander wrote:
>> > > > -----Original Message-----
>> > > > From: Peter Chubb [mailto:peter.chubb@nicta.com.au]
>> > > > Sent: Wednesday, December 11, 2013 5:11 PM
>> > > > To: Markus Trippelsdorf
>> > > > Cc: Peter Chubb; Deucher, Alexander; airlied@linux.ie; dri-
>> > > > devel@lists.freedesktop.org
>> > > > Subject: Re: Can no longer shutdown after drm/radeon: Implement
>> > > > radeon_pci_shutdown
>> > > >
>> > > > >>>>> "Markus" == Markus Trippelsdorf <markus@trippelsdorf.de>
>> > 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.
>> > >
>> > > 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:)
>> 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.

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

Alex

>
> --
> Markus
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-12-12 14:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11  0:37 Can no longer shutdown after drm/radeon: Implement radeon_pci_shutdown Peter Chubb
2013-12-11  7:26 ` Markus Trippelsdorf
2013-12-11 22:11   ` Peter Chubb
2013-12-11 23:46     ` Deucher, Alexander
2013-12-12  0:04       ` Peter Chubb
2013-12-12  2:58       ` Markus Trippelsdorf
2013-12-12  3:10         ` Peter Chubb
2013-12-12  3:27         ` Deucher, Alexander
2013-12-12 13:56           ` Markus Trippelsdorf
2013-12-12 14:11             ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.