diff mbox series

[2/8] drm/i915/selftests: Prevent the timeslice expiring during suppression tests

Message ID 20190812091045.29587-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [1/8] drm/i915/execlists: Avoid sync calls during park | expand

Commit Message

Chris Wilson Aug. 12, 2019, 9:10 a.m. UTC
When testing whether we prevent suppressing preemption, it helps to
avoid a time slice expiring prematurely.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111108
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Mika Kuoppala Aug. 12, 2019, 9:39 a.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> When testing whether we prevent suppressing preemption, it helps to
> avoid a time slice expiring prematurely.
>

I did look the test and it does call schedule on it's own.

So what we want to do is to postpone the defacto schedule tick
provided by driver not to mess our own schedule? (which we
use to check that no preemption does occur with equal
priorities?)

Just trying to figure out if I got the test framework right :O
-Mika


> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111108
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/selftest_lrc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> index 91f1c9012489..b797be1627e9 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> @@ -913,6 +913,8 @@ static int live_suppress_self_preempt(void *arg)
>  			goto err_wedged;
>  		}
>  
> +		/* Keep postponing the timer to avoid premature slicing */
> +		mod_timer(&engine->execlists.timer, jiffies + HZ);
>  		for (depth = 0; depth < 8; depth++) {
>  			rq_b = spinner_create_request(&b.spin,
>  						      b.ctx, engine,
> @@ -938,7 +940,8 @@ static int live_suppress_self_preempt(void *arg)
>  		igt_spinner_end(&a.spin);
>  
>  		if (engine->execlists.preempt_hang.count) {
> -			pr_err("Preemption recorded x%d, depth %d; should have been suppressed!\n",
> +			pr_err("Preemption on %s recorded x%d, depth %d; should have been suppressed!\n",
> +			       engine->name,
>  			       engine->execlists.preempt_hang.count,
>  			       depth);
>  			err = -EINVAL;
> -- 
> 2.23.0.rc1
Chris Wilson Aug. 12, 2019, 9:58 a.m. UTC | #2
Quoting Mika Kuoppala (2019-08-12 10:39:01)
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > When testing whether we prevent suppressing preemption, it helps to
> > avoid a time slice expiring prematurely.
> >
> 
> I did look the test and it does call schedule on it's own.
> 
> So what we want to do is to postpone the defacto schedule tick
> provided by driver not to mess our own schedule? (which we
> use to check that no preemption does occur with equal
> priorities?)

The test is trying to look at our mechanics to ensure that we don't
cause preemptions where we simply put back the same request. As such, we
have a marker in the preemption code that we are trying to avoid, and
must control the scheduling to exclude all other events than the one we
are injecting.

The timeslice could expire and reverse A,B (to B,A) such that our
promotion of A does (correctly) cause a preemption that we expect never
to need.
-Chris
Mika Kuoppala Aug. 12, 2019, 10:28 a.m. UTC | #3
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Quoting Mika Kuoppala (2019-08-12 10:39:01)
>> Chris Wilson <chris@chris-wilson.co.uk> writes:
>> 
>> > When testing whether we prevent suppressing preemption, it helps to
>> > avoid a time slice expiring prematurely.
>> >
>> 
>> I did look the test and it does call schedule on it's own.
>> 
>> So what we want to do is to postpone the defacto schedule tick
>> provided by driver not to mess our own schedule? (which we
>> use to check that no preemption does occur with equal
>> priorities?)
>
> The test is trying to look at our mechanics to ensure that we don't
> cause preemptions where we simply put back the same request. As such, we
> have a marker in the preemption code that we are trying to avoid, and
> must control the scheduling to exclude all other events than the one we
> are injecting.
>
> The timeslice could expire and reverse A,B (to B,A) such that our
> promotion of A does (correctly) cause a preemption that we expect never
> to need.

If there will be more users, then we can consider
disable|enable_reschedule_timer or similar.

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> -Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 91f1c9012489..b797be1627e9 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -913,6 +913,8 @@  static int live_suppress_self_preempt(void *arg)
 			goto err_wedged;
 		}
 
+		/* Keep postponing the timer to avoid premature slicing */
+		mod_timer(&engine->execlists.timer, jiffies + HZ);
 		for (depth = 0; depth < 8; depth++) {
 			rq_b = spinner_create_request(&b.spin,
 						      b.ctx, engine,
@@ -938,7 +940,8 @@  static int live_suppress_self_preempt(void *arg)
 		igt_spinner_end(&a.spin);
 
 		if (engine->execlists.preempt_hang.count) {
-			pr_err("Preemption recorded x%d, depth %d; should have been suppressed!\n",
+			pr_err("Preemption on %s recorded x%d, depth %d; should have been suppressed!\n",
+			       engine->name,
 			       engine->execlists.preempt_hang.count,
 			       depth);
 			err = -EINVAL;