dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/guc: Check for wedged before doing stuff
@ 2021-12-15 22:45 John.C.Harrison
  2021-12-16  1:05 ` [Intel-gfx] " Matthew Brost
  2021-12-16  8:47 ` Tvrtko Ursulin
  0 siblings, 2 replies; 5+ messages in thread
From: John.C.Harrison @ 2021-12-15 22:45 UTC (permalink / raw)
  To: Intel-GFX; +Cc: John Harrison, DRI-Devel

From: John Harrison <John.C.Harrison@Intel.com>

A fault injection probe test hit a BUG_ON in a GuC error path. It
showed that the GuC code could potentially attempt to do many things
when the device is actually wedged. So, add a check in to prevent that.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 97311119da6f..88f002c4d41b 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -1350,7 +1350,8 @@ submission_disabled(struct intel_guc *guc)
 	struct i915_sched_engine * const sched_engine = guc->sched_engine;
 
 	return unlikely(!sched_engine ||
-			!__tasklet_is_enabled(&sched_engine->tasklet));
+			!__tasklet_is_enabled(&sched_engine->tasklet) ||
+			test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags));
 }
 
 static void disable_submission(struct intel_guc *guc)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/guc: Check for wedged before doing stuff
  2021-12-15 22:45 [PATCH] drm/i915/guc: Check for wedged before doing stuff John.C.Harrison
@ 2021-12-16  1:05 ` Matthew Brost
  2021-12-16  8:47 ` Tvrtko Ursulin
  1 sibling, 0 replies; 5+ messages in thread
From: Matthew Brost @ 2021-12-16  1:05 UTC (permalink / raw)
  To: John.C.Harrison; +Cc: Intel-GFX, DRI-Devel

On Wed, Dec 15, 2021 at 02:45:56PM -0800, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> A fault injection probe test hit a BUG_ON in a GuC error path. It
> showed that the GuC code could potentially attempt to do many things
> when the device is actually wedged. So, add a check in to prevent that.
> 
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> index 97311119da6f..88f002c4d41b 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> @@ -1350,7 +1350,8 @@ submission_disabled(struct intel_guc *guc)
>  	struct i915_sched_engine * const sched_engine = guc->sched_engine;
>  
>  	return unlikely(!sched_engine ||
> -			!__tasklet_is_enabled(&sched_engine->tasklet));
> +			!__tasklet_is_enabled(&sched_engine->tasklet) ||
> +			test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags));
>  }
>  
>  static void disable_submission(struct intel_guc *guc)
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/guc: Check for wedged before doing stuff
  2021-12-15 22:45 [PATCH] drm/i915/guc: Check for wedged before doing stuff John.C.Harrison
  2021-12-16  1:05 ` [Intel-gfx] " Matthew Brost
@ 2021-12-16  8:47 ` Tvrtko Ursulin
  2021-12-16 20:30   ` John Harrison
  1 sibling, 1 reply; 5+ messages in thread
From: Tvrtko Ursulin @ 2021-12-16  8:47 UTC (permalink / raw)
  To: John.C.Harrison, Intel-GFX; +Cc: DRI-Devel



On 15/12/2021 22:45, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
> 
> A fault injection probe test hit a BUG_ON in a GuC error path. It
> showed that the GuC code could potentially attempt to do many things
> when the device is actually wedged. So, add a check in to prevent that.
> 
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> index 97311119da6f..88f002c4d41b 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
> @@ -1350,7 +1350,8 @@ submission_disabled(struct intel_guc *guc)
>   	struct i915_sched_engine * const sched_engine = guc->sched_engine;
>   
>   	return unlikely(!sched_engine ||
> -			!__tasklet_is_enabled(&sched_engine->tasklet));
> +			!__tasklet_is_enabled(&sched_engine->tasklet) ||
> +			test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags));

Or intel_gt_is_wedged ?

Regards,

Tvrtko

>   }
>   
>   static void disable_submission(struct intel_guc *guc)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/guc: Check for wedged before doing stuff
  2021-12-16  8:47 ` Tvrtko Ursulin
@ 2021-12-16 20:30   ` John Harrison
  2021-12-17  9:10     ` Tvrtko Ursulin
  0 siblings, 1 reply; 5+ messages in thread
From: John Harrison @ 2021-12-16 20:30 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-GFX; +Cc: DRI-Devel

On 12/16/2021 00:47, Tvrtko Ursulin wrote:
> On 15/12/2021 22:45, John.C.Harrison@Intel.com wrote:
>> From: John Harrison <John.C.Harrison@Intel.com>
>>
>> A fault injection probe test hit a BUG_ON in a GuC error path. It
>> showed that the GuC code could potentially attempt to do many things
>> when the device is actually wedged. So, add a check in to prevent that.
>>
>> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
>> ---
>>   drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 
>> b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> index 97311119da6f..88f002c4d41b 100644
>> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>> @@ -1350,7 +1350,8 @@ submission_disabled(struct intel_guc *guc)
>>       struct i915_sched_engine * const sched_engine = guc->sched_engine;
>>         return unlikely(!sched_engine ||
>> - !__tasklet_is_enabled(&sched_engine->tasklet));
>> + !__tasklet_is_enabled(&sched_engine->tasklet) ||
>> +            test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags));
>
> Or intel_gt_is_wedged ?
Hmm. I just copied the test from somewhere else. Is there any particular 
reason why other bits of code would be doing the explicit test_bit 
rather than calling the helper? I see the helper has a BUG_ON. Can that 
fire if called at the wrong time in the reset path?

John.

>
> Regards,
>
> Tvrtko
>
>>   }
>>     static void disable_submission(struct intel_guc *guc)
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/guc: Check for wedged before doing stuff
  2021-12-16 20:30   ` John Harrison
@ 2021-12-17  9:10     ` Tvrtko Ursulin
  0 siblings, 0 replies; 5+ messages in thread
From: Tvrtko Ursulin @ 2021-12-17  9:10 UTC (permalink / raw)
  To: John Harrison, Intel-GFX; +Cc: DRI-Devel


On 16/12/2021 20:30, John Harrison wrote:
> On 12/16/2021 00:47, Tvrtko Ursulin wrote:
>> On 15/12/2021 22:45, John.C.Harrison@Intel.com wrote:
>>> From: John Harrison <John.C.Harrison@Intel.com>
>>>
>>> A fault injection probe test hit a BUG_ON in a GuC error path. It
>>> showed that the GuC code could potentially attempt to do many things
>>> when the device is actually wedged. So, add a check in to prevent that.
>>>
>>> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 
>>> b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>>> index 97311119da6f..88f002c4d41b 100644
>>> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
>>> @@ -1350,7 +1350,8 @@ submission_disabled(struct intel_guc *guc)
>>>       struct i915_sched_engine * const sched_engine = guc->sched_engine;
>>>         return unlikely(!sched_engine ||
>>> - !__tasklet_is_enabled(&sched_engine->tasklet));
>>> + !__tasklet_is_enabled(&sched_engine->tasklet) ||
>>> +            test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags));
>>
>> Or intel_gt_is_wedged ?
> Hmm. I just copied the test from somewhere else. Is there any particular 
> reason why other bits of code would be doing the explicit test_bit 

Lets see:

$ grep intel_gt_is_wedged . -r | wc -l
55

$ grep test_bit.*I915_WEDGED, . -r
./gt/intel_gt.h:                   !test_bit(I915_WEDGED, &gt->reset.flags));
./gt/intel_gt.h:        return unlikely(test_bit(I915_WEDGED, &gt->reset.flags));
./gt/intel_reset.c:     if (test_bit(I915_WEDGED, &gt->reset.flags))
./gt/intel_reset.c:     if (test_bit(I915_WEDGED, &gt->reset.flags))
./gt/intel_reset.c:     if (!test_bit(I915_WEDGED, &gt->reset.flags))
./gt/intel_reset.c:     if (!test_bit(I915_WEDGED, &gt->reset.flags))
./gt/uc/intel_guc_submission.c:              test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags))) {

So outside the components which own the flag only GuC goes direct therefore you might know better if there is a special reason for that.

The code there looks like this:

	/* Reset called during driver load or during wedge? */
	if (unlikely(!guc_submission_initialized(guc) ||
		     test_bit(I915_WEDGED, &guc_to_gt(guc)->reset.flags)))
		return;

Perhaps that check and then one you are adding could even be partly the same?

> rather than calling the helper? I see the helper has a BUG_ON. Can that 
> fire if called at the wrong time in the reset path?

The grep above suggests it should be safe. And looking at the assert it seems to check if someone set the fatal wedge bit without setting the "normal" wedge eg. setting it directly bypassing the helper. So should be fine.

Regards,

Tvrtko

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-17  9:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 22:45 [PATCH] drm/i915/guc: Check for wedged before doing stuff John.C.Harrison
2021-12-16  1:05 ` [Intel-gfx] " Matthew Brost
2021-12-16  8:47 ` Tvrtko Ursulin
2021-12-16 20:30   ` John Harrison
2021-12-17  9:10     ` Tvrtko Ursulin

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).