Re: [PATCH 2/3] drm/i915: Detect page faults during hangcheck

Daniel Vetter
2015-03-17T10:29:35Z

On Mon, Mar 16, 2015 at 09:30:44PM +0000, Chris Wilson wrote:
> On Mon, Mar 16, 2015 at 06:53:40PM +0100, Daniel Vetter wrote:
> > On Mon, Mar 16, 2015 at 03:46:35PM +0200, Mika Kuoppala wrote:
> > > From: Chris Wilson <chris@chris-wilson.co.uk>
> > >
> > > On Sandybridge+, the GPU provides the ERROR register for detecting page
> > > faults. Hook this up to our hangcheck so that we can dump the error
> > > state soon after such an event occurs. This would be better inside an
> > > interrupt handler, but it serves a purpose here as it detects that our
> > > initial context setup is invalid...
> > >
> > > Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > ---
> > > drivers/gpu/drm/i915/i915_irq.c | 5 +++++
> > > drivers/gpu/drm/i915/intel_uncore.c | 2 ++
> > > 2 files changed, 7 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > > index 49ad5fb..ea668fc 100644
> > > --- a/drivers/gpu/drm/i915/i915_irq.c
> > > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > > @@ -2929,6 +2929,11 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
> > > if (!i915.enable_hangcheck)
> > > return;
> > >
> > > + if (INTEL_INFO(dev_priv)->gen >= 6 && I915_READ(ERROR_GEN6)) {
> > > + i915_handle_error(dev, false, "GPU reported a page fault");
> > > + I915_WRITE(ERROR_GEN6, 0);
> >
> > Shouldn't we also at least report the bits from the ERROR register
> > somewhere? Or are they supremely useless?
>
> It's recorded in the hangcheck already - that's how I knew we were
> generating pagefaults during module init in the first place.

Ah right missed that, so I think we're covered. Maybe a comment that
handle_error captures ERROR_GEN6? Doesn't really need to be though, just
in case someone decides to reorder the clearing with the handling.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation