2008-10-26 15:24:14

by Jiri Slaby

[permalink] [raw]
Subject: oops in radeon_suspend (mmotm 2008-10-22-17-18)

Hi,

this oops occured on suspend of mmotm:
http://decibel.fi.muni.cz/~xslaby/radeon_oops1.png
http://decibel.fi.muni.cz/~xslaby/radeon_oops2.png

radeon_suspend:
movq 288(%rcx), %rax # <variable>.mmio, <variable>.mmio
xorl %edx, %edx # tmp68
movq 24(%rax), %rax # <variable>.handle, <variable>.handle

rax (dev_priv->mmio) is null.


2008-11-08 09:10:20

by Jiri Slaby

[permalink] [raw]
Subject: Re: oops in radeon_suspend (mmotm 2008-10-22-17-18)

Ping

On 10/26/2008 04:23 PM, Jiri Slaby wrote:
> Hi,
>
> this oops occured on suspend of mmotm:
> http://decibel.fi.muni.cz/~xslaby/radeon_oops1.png
> http://decibel.fi.muni.cz/~xslaby/radeon_oops2.png
>
> radeon_suspend:
> movq 288(%rcx), %rax # <variable>.mmio, <variable>.mmio
> xorl %edx, %edx # tmp68
> movq 24(%rax), %rax # <variable>.handle, <variable>.handle
>
> rax (dev_priv->mmio) is null.

2008-11-09 21:56:06

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 1/1] DRM: fix radeon suspend/resume oops

Hi,

I've sent a bugreport twice with no reply, so coming with a patch.
Andrew please apply, if no comments or a better patch from drm
fellows comes.

As the accesses to the mmio member are not protected by anything, they
seem to be racy with the open/clsoe anyways, setting this down there
too.

--
When the driver is bound to a device and nobody opens the device node,
it will oops on suspend and resume, since it's not mapped and
dev_priv->mmio is NULL.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: David Airlie <[email protected]>
---
drivers/gpu/drm/radeon/radeon_drv.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 71af746..2e74a98 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -52,10 +52,14 @@ static int dri_library_name(struct drm_device *dev, char *buf)
"r300"));
}

+/* FIXME all this suspend/resume races with open/close? */
static int radeon_suspend(struct drm_device *dev, pm_message_t state)
{
drm_radeon_private_t *dev_priv = dev->dev_private;

+ if (!dev_priv->mmio)
+ return 0;
+
/* Disable *all* interrupts */
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
@@ -67,6 +71,9 @@ static int radeon_resume(struct drm_device *dev)
{
drm_radeon_private_t *dev_priv = dev->dev_private;

+ if (!dev_priv->mmio)
+ return 0;
+
/* Restore interrupt registers */
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
--
1.6.0.3

2008-11-09 22:02:21

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 1/1 v2] DRM: fix radeon suspend/resume oops

me wrote:
> As the accesses to the mmio member are not protected by anything, they
> seem to be racy with the open/clsoe anyways, setting this down there
> too.

On the second though it should be protected. Updated patch below...

+ added Rafael to cc list

--

When the driver is bound to a device and nobody opens the device node,
it will oops on suspend and resume, since it's not mapped and
dev_priv->mmio is NULL.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
---
drivers/gpu/drm/radeon/radeon_drv.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 71af746..7672310 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -56,6 +56,9 @@ static int radeon_suspend(struct drm_device *dev, pm_message_t state)
{
drm_radeon_private_t *dev_priv = dev->dev_private;

+ if (!dev_priv->mmio)
+ return 0;
+
/* Disable *all* interrupts */
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
@@ -67,6 +70,9 @@ static int radeon_resume(struct drm_device *dev)
{
drm_radeon_private_t *dev_priv = dev->dev_private;

+ if (!dev_priv->mmio)
+ return 0;
+
/* Restore interrupt registers */
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
--
1.6.0.3

2008-11-10 00:10:24

by Dave Airlie

[permalink] [raw]
Subject: Re: [PATCH 1/1] DRM: fix radeon suspend/resume oops


> Andrew please apply, if no comments or a better patch from drm
> fellows comes.
>
> As the accesses to the mmio member are not protected by anything, they
> seem to be racy with the open/clsoe anyways, setting this down there
> too.

We got a patch last week from Jesse Barnes to fix this, I'll pull it and
send it to Linus, I was waiting for some other fixes first.

Dave.

>
> --
> When the driver is bound to a device and nobody opens the device node,
> it will oops on suspend and resume, since it's not mapped and
> dev_priv->mmio is NULL.
>
> Signed-off-by: Jiri Slaby <[email protected]>
> Cc: David Airlie <[email protected]>
> ---
> drivers/gpu/drm/radeon/radeon_drv.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 71af746..2e74a98 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -52,10 +52,14 @@ static int dri_library_name(struct drm_device *dev, char *buf)
> "r300"));
> }
>
> +/* FIXME all this suspend/resume races with open/close? */
> static int radeon_suspend(struct drm_device *dev, pm_message_t state)
> {
> drm_radeon_private_t *dev_priv = dev->dev_private;
>
> + if (!dev_priv->mmio)
> + return 0;
> +
> /* Disable *all* interrupts */
> if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
> RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
> @@ -67,6 +71,9 @@ static int radeon_resume(struct drm_device *dev)
> {
> drm_radeon_private_t *dev_priv = dev->dev_private;
>
> + if (!dev_priv->mmio)
> + return 0;
> +
> /* Restore interrupt registers */
> if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
> RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
>