linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: "Ortwin Glück" <odi@odi.ch>
Cc: linux-kernel@vger.kernel.org, bskeggs@redhat.com,
	dri-devel@lists.freedesktop.org, airlied@redhat.com
Subject: Re: drm/nouveau: crash regression in 3.5
Date: Sun, 29 Jul 2012 22:15:32 +0200	[thread overview]
Message-ID: <20120729201532.GA3566@joi.lan> (raw)
In-Reply-To: <50113E76.9090706@odi.ch>

On Thu, Jul 26, 2012 at 02:56:22PM +0200, Ortwin Glück wrote:
> On 25.07.2012 20:42, Marcin Slusarz wrote:
> > Good, below patch should fix this panic.
> >
> > Note that you can hit an oops in drm_handle_vblank because patch from
> > http://lists.freedesktop.org/archives/dri-devel/2012-May/023498.html
> > has not been applied (yet?).
> 
> After applying your patch, it still crashes, although with a slightly 
> different stack trace. I then also applied the second patch, but that 
> doesn't make any difference. New log attached.
> 
> Looks like interrupt occurs before nouveau_software_context_new() is 
> called? Shouldn't the initialization be done from 
> nouveau_irq_preinstall() so it is available when the irq occurs? Again, 
> I am not an expert here. Just guessing...

No, the real problem is: with "noaccel" we don't register "software engine",
but vblank ISR relies on its existance and happily derefences NULL pointer.

Now, this patch should fix it for real...

---
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: [PATCH] drm/nouveau: disable vblank interrupts before registering PDISPLAY ISR

Currently, we register vblank IRQ handler and later we disable vblank
interrupts. So, for the short amount of time, we rely on vblank ISR
to operate correctly, even if vblank interrupts are never going to be
used later.

In "noaccel" case, software engine - which is used by vblank ISR - is not
registered, so if vblank interrupt triggers in a wrong moment, we can hit
NULL pointer dereference in nouveau_software_vblank.

To fix it, disable vblank interrupts before registering PDISPLAY ISR.

Reported-by: Ortwin Glück <odi@odi.ch>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org [3.5]
---
 drivers/gpu/drm/nouveau/nv04_crtc.c    |    1 +
 drivers/gpu/drm/nouveau/nv50_crtc.c    |    1 +
 drivers/gpu/drm/nouveau/nvd0_display.c |    2 ++
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index 4c31c63..38bfe8d 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -1057,6 +1057,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
 	}
 
 	nv04_cursor_init(nv_crtc);
+	nouveau_vblank_disable(dev, crtc_num);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index 97a477b..7648f52 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -792,6 +792,7 @@ nv50_crtc_create(struct drm_device *dev, int index)
 		goto out;
 
 	nv50_cursor_init(nv_crtc);
+	nouveau_vblank_disable(dev, index);
 out:
 	if (ret)
 		nv50_crtc_destroy(&nv_crtc->base);
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index c486d3c..32f8a86 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -908,6 +908,8 @@ nvd0_crtc_create(struct drm_device *dev, int index)
 		goto out;
 
 	nvd0_crtc_lut_load(crtc);
+	/* uncomment once nvd0 vblank lands */
+	/* nouveau_vblank_disable(dev, index); */
 
 out:
 	if (ret)
-- 

  parent reply	other threads:[~2012-07-29 20:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 18:01 drm/nouveau: crash regression in 3.5 Ortwin Glück
2012-07-24 17:00 ` Marcin Slusarz
2012-07-24 17:22   ` Ortwin Glück
2012-07-24 20:57     ` Marcin Slusarz
2012-07-25  8:46       ` Ortwin Glück
2012-07-25 18:42         ` Marcin Slusarz
2012-07-26 12:56           ` Ortwin Glück
2012-07-26 15:47             ` Marcin Slusarz
2012-07-29 20:15             ` Marcin Slusarz [this message]
2012-07-30  8:46               ` Maarten Lankhorst
2012-07-30 11:16               ` Ortwin Glück
2012-07-30 17:16                 ` Marcin Slusarz
2012-07-31  7:06                   ` Ortwin Glück
2012-08-01 15:47                   ` Ortwin Glück
     [not found]                     ` <501A63FF.8030503@odi.ch>
2012-08-02 16:56                       ` Marcin Slusarz
2012-10-30 17:47                         ` Ortwin Glück

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120729201532.GA3566@joi.lan \
    --to=marcin.slusarz@gmail.com \
    --cc=airlied@redhat.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=odi@odi.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).