diff mbox series

drm/i915/perf: Invalidate OA TLB on when closing perf stream

Message ID 20200309211057.38575-1-umesh.nerlige.ramappa@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/perf: Invalidate OA TLB on when closing perf stream | expand

Commit Message

Umesh Nerlige Ramappa March 9, 2020, 9:10 p.m. UTC
On running several back to back perf capture sessions involving closing
and opening the perf stream, invalid OA reports are seen in the
beginning of the OA buffer in some sessions. Fix this by invalidating OA
TLB when the perf stream is closed or disabled on gen12.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 8 ++++++++
 drivers/gpu/drm/i915/i915_reg.h  | 2 ++
 2 files changed, 10 insertions(+)

Comments

Chris Wilson March 9, 2020, 10:45 p.m. UTC | #1
Quoting Umesh Nerlige Ramappa (2020-03-09 21:10:57)
> On running several back to back perf capture sessions involving closing
> and opening the perf stream, invalid OA reports are seen in the
> beginning of the OA buffer in some sessions. Fix this by invalidating OA
> TLB when the perf stream is closed or disabled on gen12.
> 
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

Testcase?
-Chris
Umesh Nerlige Ramappa March 10, 2020, 3:11 a.m. UTC | #2
On Mon, Mar 09, 2020 at 10:45:47PM +0000, Chris Wilson wrote:
>Quoting Umesh Nerlige Ramappa (2020-03-09 21:10:57)
>> On running several back to back perf capture sessions involving closing
>> and opening the perf stream, invalid OA reports are seen in the
>> beginning of the OA buffer in some sessions. Fix this by invalidating OA
>> TLB when the perf stream is closed or disabled on gen12.
>>
>> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>
>Testcase?

Issue occurs if all perf tests are run on TGL, but I guess a single 
subtest should do it too. Here it is -
https://patchwork.freedesktop.org/patch/356973/

Thanks,
Umesh

>-Chris
Lionel Landwerlin March 10, 2020, 9:03 a.m. UTC | #3
On 09/03/2020 23:10, Umesh Nerlige Ramappa wrote:
> On running several back to back perf capture sessions involving closing
> and opening the perf stream, invalid OA reports are seen in the
> beginning of the OA buffer in some sessions. Fix this by invalidating OA
> TLB when the perf stream is closed or disabled on gen12.
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 8 ++++++++
>   drivers/gpu/drm/i915/i915_reg.h  | 2 ++
>   2 files changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 1b074bb4a7fe..551be589d6f4 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2700,6 +2700,14 @@ static void gen12_oa_disable(struct i915_perf_stream *stream)
>   				    50))
>   		drm_err(&stream->perf->i915->drm,
>   			"wait for OA to be disabled timed out\n");
> +
> +	intel_uncore_write(uncore, GEN12_OA_TLB_INV_CR, 1);
> +	if (intel_wait_for_register(uncore,
> +				    GEN12_OA_TLB_INV_CR,
> +				    1, 0,
> +				    50))
> +		drm_err(&stream->perf->i915->drm,
> +			"wait for OA tlb invalidate timed out\n");
>   }
>   
>   /**
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 79ae9654dac9..95725e61d9f1 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -693,6 +693,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>   #define OABUFFER_SIZE_8M    (6 << 3)
>   #define OABUFFER_SIZE_16M   (7 << 3)
>   
> +#define GEN12_OA_TLB_INV_CR _MMIO(0xceec)
> +
>   /* Gen12 OAR unit */
>   #define GEN12_OAR_OACONTROL _MMIO(0x2960)
>   #define  GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT 1
Lionel Landwerlin March 12, 2020, 1:36 p.m. UTC | #4
On 10/03/2020 11:03, Lionel Landwerlin wrote:
> On 09/03/2020 23:10, Umesh Nerlige Ramappa wrote:
>> On running several back to back perf capture sessions involving closing
>> and opening the perf stream, invalid OA reports are seen in the
>> beginning of the OA buffer in some sessions. Fix this by invalidating OA
>> TLB when the perf stream is closed or disabled on gen12.
>>
>> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>


We want this to be with the tag :


Fixes: 00a7f0d7155c ("drm/i915/tgl: Add perf support on TGL")


-Lionel


>> ---
>>   drivers/gpu/drm/i915/i915_perf.c | 8 ++++++++
>>   drivers/gpu/drm/i915/i915_reg.h  | 2 ++
>>   2 files changed, 10 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
>> b/drivers/gpu/drm/i915/i915_perf.c
>> index 1b074bb4a7fe..551be589d6f4 100644
>> --- a/drivers/gpu/drm/i915/i915_perf.c
>> +++ b/drivers/gpu/drm/i915/i915_perf.c
>> @@ -2700,6 +2700,14 @@ static void gen12_oa_disable(struct 
>> i915_perf_stream *stream)
>>                       50))
>>           drm_err(&stream->perf->i915->drm,
>>               "wait for OA to be disabled timed out\n");
>> +
>> +    intel_uncore_write(uncore, GEN12_OA_TLB_INV_CR, 1);
>> +    if (intel_wait_for_register(uncore,
>> +                    GEN12_OA_TLB_INV_CR,
>> +                    1, 0,
>> +                    50))
>> +        drm_err(&stream->perf->i915->drm,
>> +            "wait for OA tlb invalidate timed out\n");
>>   }
>>     /**
>> diff --git a/drivers/gpu/drm/i915/i915_reg.h 
>> b/drivers/gpu/drm/i915/i915_reg.h
>> index 79ae9654dac9..95725e61d9f1 100644
>> --- a/drivers/gpu/drm/i915/i915_reg.h
>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>> @@ -693,6 +693,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t 
>> reg)
>>   #define OABUFFER_SIZE_8M    (6 << 3)
>>   #define OABUFFER_SIZE_16M   (7 << 3)
>>   +#define GEN12_OA_TLB_INV_CR _MMIO(0xceec)
>> +
>>   /* Gen12 OAR unit */
>>   #define GEN12_OAR_OACONTROL _MMIO(0x2960)
>>   #define  GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT 1
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 1b074bb4a7fe..551be589d6f4 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2700,6 +2700,14 @@  static void gen12_oa_disable(struct i915_perf_stream *stream)
 				    50))
 		drm_err(&stream->perf->i915->drm,
 			"wait for OA to be disabled timed out\n");
+
+	intel_uncore_write(uncore, GEN12_OA_TLB_INV_CR, 1);
+	if (intel_wait_for_register(uncore,
+				    GEN12_OA_TLB_INV_CR,
+				    1, 0,
+				    50))
+		drm_err(&stream->perf->i915->drm,
+			"wait for OA tlb invalidate timed out\n");
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 79ae9654dac9..95725e61d9f1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -693,6 +693,8 @@  static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define OABUFFER_SIZE_8M    (6 << 3)
 #define OABUFFER_SIZE_16M   (7 << 3)
 
+#define GEN12_OA_TLB_INV_CR _MMIO(0xceec)
+
 /* Gen12 OAR unit */
 #define GEN12_OAR_OACONTROL _MMIO(0x2960)
 #define  GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT 1