[Intel-gfx] [PATCH 4/4] drm/i915: Only print an message if there was an error
Jesse Barnes
jbarnes at virtuousgeek.org
Mon Jan 4 20:33:35 CET 2010
On Mon, 4 Jan 2010 18:57:59 +0000
Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Only report an error if the GPU has actually detected one, otherwise
> we are just hung.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_irq.c | 188
> ++++++++++++++++++++------------------- 1 files changed, 95
> insertions(+), 93 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c
> b/drivers/gpu/drm/i915/i915_irq.c index 86b2f53..0edd431 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -559,105 +559,107 @@ static void i915_handle_error(struct
> drm_device *dev, bool wedged)
> i915_capture_error_state(dev);
>
> - printk(KERN_ERR "render error detected, EIR: 0x%08x\n",
> - eir);
> -
> - if (IS_G4X(dev)) {
> - if (eir & (GM45_ERROR_MEM_PRIV |
> GM45_ERROR_CP_PRIV)) {
> - u32 ipeir = I915_READ(IPEIR_I965);
> -
> - printk(KERN_ERR " IPEIR: 0x%08x\n",
> - I915_READ(IPEIR_I965));
> - printk(KERN_ERR " IPEHR: 0x%08x\n",
> - I915_READ(IPEHR_I965));
> - printk(KERN_ERR " INSTDONE: 0x%08x\n",
> - I915_READ(INSTDONE_I965));
> - printk(KERN_ERR " INSTPS: 0x%08x\n",
> - I915_READ(INSTPS));
> - printk(KERN_ERR " INSTDONE1: 0x%08x\n",
> - I915_READ(INSTDONE1));
> - printk(KERN_ERR " ACTHD: 0x%08x\n",
> - I915_READ(ACTHD_I965));
> - I915_WRITE(IPEIR_I965, ipeir);
> - (void)I915_READ(IPEIR_I965);
> - }
> - if (eir & GM45_ERROR_PAGE_TABLE) {
> - u32 pgtbl_err = I915_READ(PGTBL_ER);
> - printk(KERN_ERR "page table error\n");
> - printk(KERN_ERR " PGTBL_ER: 0x%08x\n",
> - pgtbl_err);
> - I915_WRITE(PGTBL_ER, pgtbl_err);
> - (void)I915_READ(PGTBL_ER);
> + if (eir) {
> + printk(KERN_ERR "render error detected, EIR:
> 0x%08x\n",
> + eir);
> +
> + if (IS_G4X(dev)) {
> + if (eir & (GM45_ERROR_MEM_PRIV |
> GM45_ERROR_CP_PRIV)) {
> + u32 ipeir = I915_READ(IPEIR_I965);
> +
> + printk(KERN_ERR " IPEIR: 0x%08x\n",
> + I915_READ(IPEIR_I965));
> + printk(KERN_ERR " IPEHR: 0x%08x\n",
> + I915_READ(IPEHR_I965));
> + printk(KERN_ERR " INSTDONE:
> 0x%08x\n",
> + I915_READ(INSTDONE_I965));
> + printk(KERN_ERR " INSTPS: 0x%08x\n",
> + I915_READ(INSTPS));
> + printk(KERN_ERR " INSTDONE1:
> 0x%08x\n",
> + I915_READ(INSTDONE1));
> + printk(KERN_ERR " ACTHD: 0x%08x\n",
> + I915_READ(ACTHD_I965));
> + I915_WRITE(IPEIR_I965, ipeir);
> + (void)I915_READ(IPEIR_I965);
> + }
> + if (eir & GM45_ERROR_PAGE_TABLE) {
> + u32 pgtbl_err = I915_READ(PGTBL_ER);
> + printk(KERN_ERR "page table
> error\n");
> + printk(KERN_ERR " PGTBL_ER:
> 0x%08x\n",
> + pgtbl_err);
> + I915_WRITE(PGTBL_ER, pgtbl_err);
> + (void)I915_READ(PGTBL_ER);
> + }
> }
> - }
>
> - if (IS_I9XX(dev)) {
> - if (eir & I915_ERROR_PAGE_TABLE) {
> - u32 pgtbl_err = I915_READ(PGTBL_ER);
> - printk(KERN_ERR "page table error\n");
> - printk(KERN_ERR " PGTBL_ER: 0x%08x\n",
> - pgtbl_err);
> - I915_WRITE(PGTBL_ER, pgtbl_err);
> - (void)I915_READ(PGTBL_ER);
> + if (IS_I9XX(dev)) {
> + if (eir & I915_ERROR_PAGE_TABLE) {
> + u32 pgtbl_err = I915_READ(PGTBL_ER);
> + printk(KERN_ERR "page table
> error\n");
> + printk(KERN_ERR " PGTBL_ER:
> 0x%08x\n",
> + pgtbl_err);
> + I915_WRITE(PGTBL_ER, pgtbl_err);
> + (void)I915_READ(PGTBL_ER);
> + }
> }
> - }
>
> - if (eir & I915_ERROR_MEMORY_REFRESH) {
> - printk(KERN_ERR "memory refresh error\n");
> - printk(KERN_ERR "PIPEASTAT: 0x%08x\n",
> - pipea_stats);
> - printk(KERN_ERR "PIPEBSTAT: 0x%08x\n",
> - pipeb_stats);
> - /* pipestat has already been acked */
> - }
> - if (eir & I915_ERROR_INSTRUCTION) {
> - printk(KERN_ERR "instruction error\n");
> - printk(KERN_ERR " INSTPM: 0x%08x\n",
> - I915_READ(INSTPM));
> - if (!IS_I965G(dev)) {
> - u32 ipeir = I915_READ(IPEIR);
> -
> - printk(KERN_ERR " IPEIR: 0x%08x\n",
> - I915_READ(IPEIR));
> - printk(KERN_ERR " IPEHR: 0x%08x\n",
> - I915_READ(IPEHR));
> - printk(KERN_ERR " INSTDONE: 0x%08x\n",
> - I915_READ(INSTDONE));
> - printk(KERN_ERR " ACTHD: 0x%08x\n",
> - I915_READ(ACTHD));
> - I915_WRITE(IPEIR, ipeir);
> - (void)I915_READ(IPEIR);
> - } else {
> - u32 ipeir = I915_READ(IPEIR_I965);
> -
> - printk(KERN_ERR " IPEIR: 0x%08x\n",
> - I915_READ(IPEIR_I965));
> - printk(KERN_ERR " IPEHR: 0x%08x\n",
> - I915_READ(IPEHR_I965));
> - printk(KERN_ERR " INSTDONE: 0x%08x\n",
> - I915_READ(INSTDONE_I965));
> - printk(KERN_ERR " INSTPS: 0x%08x\n",
> - I915_READ(INSTPS));
> - printk(KERN_ERR " INSTDONE1: 0x%08x\n",
> - I915_READ(INSTDONE1));
> - printk(KERN_ERR " ACTHD: 0x%08x\n",
> - I915_READ(ACTHD_I965));
> - I915_WRITE(IPEIR_I965, ipeir);
> - (void)I915_READ(IPEIR_I965);
> + if (eir & I915_ERROR_MEMORY_REFRESH) {
> + printk(KERN_ERR "memory refresh error\n");
> + printk(KERN_ERR "PIPEASTAT: 0x%08x\n",
> + pipea_stats);
> + printk(KERN_ERR "PIPEBSTAT: 0x%08x\n",
> + pipeb_stats);
> + /* pipestat has already been acked */
> + }
> + if (eir & I915_ERROR_INSTRUCTION) {
> + printk(KERN_ERR "instruction error\n");
> + printk(KERN_ERR " INSTPM: 0x%08x\n",
> + I915_READ(INSTPM));
> + if (!IS_I965G(dev)) {
> + u32 ipeir = I915_READ(IPEIR);
> +
> + printk(KERN_ERR " IPEIR: 0x%08x\n",
> + I915_READ(IPEIR));
> + printk(KERN_ERR " IPEHR: 0x%08x\n",
> + I915_READ(IPEHR));
> + printk(KERN_ERR " INSTDONE:
> 0x%08x\n",
> + I915_READ(INSTDONE));
> + printk(KERN_ERR " ACTHD: 0x%08x\n",
> + I915_READ(ACTHD));
> + I915_WRITE(IPEIR, ipeir);
> + (void)I915_READ(IPEIR);
> + } else {
> + u32 ipeir = I915_READ(IPEIR_I965);
> +
> + printk(KERN_ERR " IPEIR: 0x%08x\n",
> + I915_READ(IPEIR_I965));
> + printk(KERN_ERR " IPEHR: 0x%08x\n",
> + I915_READ(IPEHR_I965));
> + printk(KERN_ERR " INSTDONE:
> 0x%08x\n",
> + I915_READ(INSTDONE_I965));
> + printk(KERN_ERR " INSTPS: 0x%08x\n",
> + I915_READ(INSTPS));
> + printk(KERN_ERR " INSTDONE1:
> 0x%08x\n",
> + I915_READ(INSTDONE1));
> + printk(KERN_ERR " ACTHD: 0x%08x\n",
> + I915_READ(ACTHD_I965));
> + I915_WRITE(IPEIR_I965, ipeir);
> + (void)I915_READ(IPEIR_I965);
> + }
> }
> - }
>
> - I915_WRITE(EIR, eir);
> - (void)I915_READ(EIR);
> - eir = I915_READ(EIR);
> - if (eir) {
> - /*
> - * some errors might have become stuck,
> - * mask them.
> - */
> - DRM_ERROR("EIR stuck: 0x%08x, masking\n", eir);
> - I915_WRITE(EMR, I915_READ(EMR) | eir);
> - I915_WRITE(IIR,
> I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
> + I915_WRITE(EIR, eir);
> + (void)I915_READ(EIR);
> + eir = I915_READ(EIR);
> + if (eir) {
> + /*
> + * some errors might have become stuck,
> + * mask them.
> + */
> + DRM_ERROR("EIR stuck: 0x%08x, masking\n",
> eir);
> + I915_WRITE(EMR, I915_READ(EMR) | eir);
> + I915_WRITE(IIR,
> I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT);
> + }
> }
>
> if (wedged) {
Wouldn't this patch be smaller and simpler if you put an if (!eir) goto
wedged; at the top instead, along with a new wedged: label?
--
Jesse Barnes, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list