Re: [PATCH 46/51] drm/i915/selftest: Fix MOCS selftest for GuC submission

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 16, 2021 at 01:17:19PM -0700, Matthew Brost wrote:
> From: Rahul Kumar Singh <rahul.kumar.singh@xxxxxxxxx>
> 
> When GuC submission is enabled, the GuC controls engine resets. Rather
> than explicitly triggering a reset, the driver must submit a hanging
> context to GuC and wait for the reset to occur.
> 
> Signed-off-by: Rahul Kumar Singh <rahul.kumar.singh@xxxxxxxxx>
> Signed-off-by: John Harrison <John.C.Harrison@xxxxxxxxx>
> Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@xxxxxxxxx>
> Cc: Matthew Brost <matthew.brost@xxxxxxxxx>

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

> ---
>  drivers/gpu/drm/i915/gt/selftest_mocs.c | 49 ++++++++++++++++++-------
>  1 file changed, 35 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/selftest_mocs.c b/drivers/gpu/drm/i915/gt/selftest_mocs.c
> index 8763bbeca0f7..b7314739ee40 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_mocs.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_mocs.c
> @@ -10,6 +10,7 @@
>  #include "gem/selftests/mock_context.h"
>  #include "selftests/igt_reset.h"
>  #include "selftests/igt_spinner.h"
> +#include "selftests/intel_scheduler_helpers.h"
>  
>  struct live_mocs {
>  	struct drm_i915_mocs_table table;
> @@ -318,7 +319,8 @@ static int live_mocs_clean(void *arg)
>  }
>  
>  static int active_engine_reset(struct intel_context *ce,
> -			       const char *reason)
> +			       const char *reason,
> +			       bool using_guc)
>  {
>  	struct igt_spinner spin;
>  	struct i915_request *rq;
> @@ -335,9 +337,13 @@ static int active_engine_reset(struct intel_context *ce,
>  	}
>  
>  	err = request_add_spin(rq, &spin);
> -	if (err == 0)
> +	if (err == 0 && !using_guc)
>  		err = intel_engine_reset(ce->engine, reason);
>  
> +	/* Ensure the reset happens and kills the engine */
> +	if (err == 0)
> +		err = intel_selftest_wait_for_rq(rq);
> +
>  	igt_spinner_end(&spin);
>  	igt_spinner_fini(&spin);
>  
> @@ -345,21 +351,23 @@ static int active_engine_reset(struct intel_context *ce,
>  }
>  
>  static int __live_mocs_reset(struct live_mocs *mocs,
> -			     struct intel_context *ce)
> +			     struct intel_context *ce, bool using_guc)
>  {
>  	struct intel_gt *gt = ce->engine->gt;
>  	int err;
>  
>  	if (intel_has_reset_engine(gt)) {
> -		err = intel_engine_reset(ce->engine, "mocs");
> -		if (err)
> -			return err;
> -
> -		err = check_mocs_engine(mocs, ce);
> -		if (err)
> -			return err;
> +		if (!using_guc) {
> +			err = intel_engine_reset(ce->engine, "mocs");
> +			if (err)
> +				return err;
> +
> +			err = check_mocs_engine(mocs, ce);
> +			if (err)
> +				return err;
> +		}
>  
> -		err = active_engine_reset(ce, "mocs");
> +		err = active_engine_reset(ce, "mocs", using_guc);
>  		if (err)
>  			return err;
>  
> @@ -395,19 +403,32 @@ static int live_mocs_reset(void *arg)
>  
>  	igt_global_reset_lock(gt);
>  	for_each_engine(engine, gt, id) {
> +		bool using_guc = intel_engine_uses_guc(engine);
> +		struct intel_selftest_saved_policy saved;
>  		struct intel_context *ce;
> +		int err2;
> +
> +		err = intel_selftest_modify_policy(engine, &saved);
> +		if (err)
> +			break;
>  
>  		ce = mocs_context_create(engine);
>  		if (IS_ERR(ce)) {
>  			err = PTR_ERR(ce);
> -			break;
> +			goto restore;
>  		}
>  
>  		intel_engine_pm_get(engine);
> -		err = __live_mocs_reset(&mocs, ce);
> -		intel_engine_pm_put(engine);
>  
> +		err = __live_mocs_reset(&mocs, ce, using_guc);
> +
> +		intel_engine_pm_put(engine);
>  		intel_context_put(ce);
> +
> +restore:
> +		err2 = intel_selftest_restore_policy(engine, &saved);
> +		if (err == 0)
> +			err = err2;
>  		if (err)
>  			break;
>  	}
> -- 
> 2.28.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux