[Intel-gfx] [PATCH] drm/i915/uncore: Warn on previous unclaimed accesses

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Apr 8 12:44:44 UTC 2022


On 05/04/2022 01:11, Lucas De Marchi wrote:
> Since gen6 we use FPGA_DBG register to detect unclaimed MMIO registers.
> This register is in the display engine IP and can only ever detect
> unclaimed accesses to registers in this area. However sometimes there
> are reports of this triggering for registers in other areas, which
> should not be possible.
> 
> Right now we always warn after the read/write of registers going through
> unclaimed_reg_debug(). However places using __raw_uncore_* may be
> triggering the unclaimed access and those being later accounted to a
> different register. Let's warn both before and after the read/write
> with a slightly different message, so it's clear if the register
> reported in the warning is actually the culprit.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

I see this triggering a lot on drm-tip today (TGL), is that expected?

[    3.994907] i915 0000:00:02.0: [drm:intel_uncore_init_mmio [i915]] unclaimed mmio detected on uncore init, clearing
[    4.392525] i915 0000:00:02.0: Unclaimed access detected before read from register 0x44408
[    5.669929] i915 0000:00:02.0: Unclaimed access detected before write to register 0x50380
[    6.652808] i915 0000:00:02.0: Unclaimed access detected before write to register 0x50380
[   13.015978] i915 0000:00:02.0: Unclaimed access detected before write to register 0x50380
[   16.876802] i915 0000:00:02.0: Unclaimed access detected before write to register 0x44404
[   45.174395] i915 0000:00:02.0: Unclaimed access detected before write to register 0x44404

It continues at runtime as well:

[10265.010902] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10329.093078] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10354.060331] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10385.486480] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10408.910533] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10433.398443] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10444.110593] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10468.302627] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10493.398727] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10515.366845] i915 0000:00:02.0: Unclaimed access detected before read from register 0x44408
[10518.674046] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc7204
[10529.934735] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10553.398808] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10599.684455] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc4008
[10602.898167] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc7204
[10613.398909] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10686.006783] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10711.906813] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10745.860538] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10771.812277] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10805.903058] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10831.927073] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10853.398958] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10866.007084] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10879.378435] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc7204
[10891.727120] i915 0000:00:02.0: Unclaimed access detected before write to register 0x190030
[10913.395161] i915 0000:00:02.0: Unclaimed access detected before write to register 0x1900ec
[10939.026480] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc7204
[10964.626494] i915 0000:00:02.0: Unclaimed access detected before read from register 0xc7204

It don't think this machine had a problem with this before, or perhaps it was going undetected?

Regards,

Tvrtko

> ---
>   drivers/gpu/drm/i915/intel_uncore.c | 29 +++++++++++++++++++++--------
>   1 file changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index 8b9caaaacc21..df59ec88459e 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -1502,11 +1502,10 @@ ilk_dummy_write(struct intel_uncore *uncore)
>   static void
>   __unclaimed_reg_debug(struct intel_uncore *uncore,
>   		      const i915_reg_t reg,
> -		      const bool read,
> -		      const bool before)
> +		      const bool read)
>   {
>   	if (drm_WARN(&uncore->i915->drm,
> -		     check_for_unclaimed_mmio(uncore) && !before,
> +		     check_for_unclaimed_mmio(uncore),
>   		     "Unclaimed %s register 0x%x\n",
>   		     read ? "read from" : "write to",
>   		     i915_mmio_reg_offset(reg)))
> @@ -1514,6 +1513,20 @@ __unclaimed_reg_debug(struct intel_uncore *uncore,
>   		uncore->i915->params.mmio_debug--;
>   }
>   
> +static void
> +__unclaimed_previous_reg_debug(struct intel_uncore *uncore,
> +			       const i915_reg_t reg,
> +			       const bool read)
> +{
> +	if (drm_WARN(&uncore->i915->drm,
> +		     check_for_unclaimed_mmio(uncore),
> +		     "Unclaimed access detected before %s register 0x%x\n",
> +		     read ? "read from" : "write to",
> +		     i915_mmio_reg_offset(reg)))
> +		/* Only report the first N failures */
> +		uncore->i915->params.mmio_debug--;
> +}
> +
>   static inline void
>   unclaimed_reg_debug(struct intel_uncore *uncore,
>   		    const i915_reg_t reg,
> @@ -1526,13 +1539,13 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
>   	/* interrupts are disabled and re-enabled around uncore->lock usage */
>   	lockdep_assert_held(&uncore->lock);
>   
> -	if (before)
> +	if (before) {
>   		spin_lock(&uncore->debug->lock);
> -
> -	__unclaimed_reg_debug(uncore, reg, read, before);
> -
> -	if (!before)
> +		__unclaimed_previous_reg_debug(uncore, reg, read);
> +	} else {
> +		__unclaimed_reg_debug(uncore, reg, read);
>   		spin_unlock(&uncore->debug->lock);
> +	}
>   }
>   
>   #define __vgpu_read(x) \


More information about the Intel-gfx mailing list