diff mbox series

[37/38] drm/i915/selftests: Check preemption support on each engine

Message ID 20190301140404.26690-37-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/38] drm/i915/execlists: Suppress redundant preemption | expand

Commit Message

Chris Wilson March 1, 2019, 2:04 p.m. UTC
Check that we have setup on preemption for the engine before testing,
instead warn if it is not enabled on supported HW.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/intel_lrc.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Tvrtko Ursulin March 6, 2019, 11:29 a.m. UTC | #1
On 01/03/2019 14:04, Chris Wilson wrote:
> Check that we have setup on preemption for the engine before testing,
> instead warn if it is not enabled on supported HW.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/selftests/intel_lrc.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> index b6329280a59f..a7de7a8fc24a 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
> @@ -90,6 +90,9 @@ static int live_preempt(void *arg)
>   	if (!HAS_LOGICAL_RING_PREEMPTION(i915))
>   		return 0;
>   
> +	if (!(i915->caps.scheduler & I915_SCHEDULER_CAP_PREEMPTION))
> +		pr_err("Logical preemption supported, but not exposed\n");
> +
>   	mutex_lock(&i915->drm.struct_mutex);
>   	wakeref = intel_runtime_pm_get(i915);
>   
> @@ -114,6 +117,9 @@ static int live_preempt(void *arg)
>   	for_each_engine(engine, i915, id) {
>   		struct i915_request *rq;
>   
> +		if (!intel_engine_has_preemption(engine))
> +			continue;
> +
>   		rq = igt_spinner_create_request(&spin_lo, ctx_lo, engine,
>   						MI_ARB_CHECK);
>   		if (IS_ERR(rq)) {
> @@ -205,6 +211,9 @@ static int live_late_preempt(void *arg)
>   	for_each_engine(engine, i915, id) {
>   		struct i915_request *rq;
>   
> +		if (!intel_engine_has_preemption(engine))
> +			continue;
> +
>   		rq = igt_spinner_create_request(&spin_lo, ctx_lo, engine,
>   						MI_ARB_CHECK);
>   		if (IS_ERR(rq)) {
> @@ -337,6 +346,9 @@ static int live_suppress_self_preempt(void *arg)
>   		struct i915_request *rq_a, *rq_b;
>   		int depth;
>   
> +		if (!intel_engine_has_preemption(engine))
> +			continue;
> +
>   		engine->execlists.preempt_hang.count = 0;
>   
>   		rq_a = igt_spinner_create_request(&a.spin,
> @@ -483,6 +495,9 @@ static int live_suppress_wait_preempt(void *arg)
>   	for_each_engine(engine, i915, id) {
>   		int depth;
>   
> +		if (!intel_engine_has_preemption(engine))
> +			continue;
> +
>   		if (!engine->emit_init_breadcrumb)
>   			continue;
>   
> @@ -604,6 +619,9 @@ static int live_chain_preempt(void *arg)
>   		};
>   		int count, i;
>   
> +		if (!intel_engine_has_preemption(engine))
> +			continue;
> +
>   		for_each_prime_number_from(count, 1, 32) { /* must fit ring! */
>   			struct i915_request *rq;
>   
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/selftests/intel_lrc.c b/drivers/gpu/drm/i915/selftests/intel_lrc.c
index b6329280a59f..a7de7a8fc24a 100644
--- a/drivers/gpu/drm/i915/selftests/intel_lrc.c
+++ b/drivers/gpu/drm/i915/selftests/intel_lrc.c
@@ -90,6 +90,9 @@  static int live_preempt(void *arg)
 	if (!HAS_LOGICAL_RING_PREEMPTION(i915))
 		return 0;
 
+	if (!(i915->caps.scheduler & I915_SCHEDULER_CAP_PREEMPTION))
+		pr_err("Logical preemption supported, but not exposed\n");
+
 	mutex_lock(&i915->drm.struct_mutex);
 	wakeref = intel_runtime_pm_get(i915);
 
@@ -114,6 +117,9 @@  static int live_preempt(void *arg)
 	for_each_engine(engine, i915, id) {
 		struct i915_request *rq;
 
+		if (!intel_engine_has_preemption(engine))
+			continue;
+
 		rq = igt_spinner_create_request(&spin_lo, ctx_lo, engine,
 						MI_ARB_CHECK);
 		if (IS_ERR(rq)) {
@@ -205,6 +211,9 @@  static int live_late_preempt(void *arg)
 	for_each_engine(engine, i915, id) {
 		struct i915_request *rq;
 
+		if (!intel_engine_has_preemption(engine))
+			continue;
+
 		rq = igt_spinner_create_request(&spin_lo, ctx_lo, engine,
 						MI_ARB_CHECK);
 		if (IS_ERR(rq)) {
@@ -337,6 +346,9 @@  static int live_suppress_self_preempt(void *arg)
 		struct i915_request *rq_a, *rq_b;
 		int depth;
 
+		if (!intel_engine_has_preemption(engine))
+			continue;
+
 		engine->execlists.preempt_hang.count = 0;
 
 		rq_a = igt_spinner_create_request(&a.spin,
@@ -483,6 +495,9 @@  static int live_suppress_wait_preempt(void *arg)
 	for_each_engine(engine, i915, id) {
 		int depth;
 
+		if (!intel_engine_has_preemption(engine))
+			continue;
+
 		if (!engine->emit_init_breadcrumb)
 			continue;
 
@@ -604,6 +619,9 @@  static int live_chain_preempt(void *arg)
 		};
 		int count, i;
 
+		if (!intel_engine_has_preemption(engine))
+			continue;
+
 		for_each_prime_number_from(count, 1, 32) { /* must fit ring! */
 			struct i915_request *rq;