diff mbox series

drm/i915/selftests: Wait until we start timeslicing after a submit

Message ID 20200403190209.21818-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Wait until we start timeslicing after a submit | expand

Commit Message

Chris Wilson April 3, 2020, 7:02 p.m. UTC
If we submit, we do not start timeslicnig until we process the CS event
that marks the start of the context running on HW. So in the selftest,
be sure to wait until we have processed the pending events before
asserting that timeslicing has begun.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Ruhl, Michael J April 3, 2020, 8:31 p.m. UTC | #1
>-----Original Message-----
>From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Chris
>Wilson
>Sent: Friday, April 3, 2020 3:02 PM
>To: intel-gfx@lists.freedesktop.org
>Cc: Chris Wilson <chris@chris-wilson.co.uk>
>Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Wait until we start timeslicing
>after a submit
>
>If we submit, we do not start timeslicnig until we process the CS event

s/timeslicnig/timeslicing/

>that marks the start of the context running on HW. So in the selftest,
>be sure to wait until we have processed the pending events before
>asserting that timeslicing has begun.
>
>Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>---
> drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c
>b/drivers/gpu/drm/i915/gt/selftest_lrc.c
>index 985d4041d929..9e02917695b1 100644
>--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
>+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
>@@ -1244,7 +1244,11 @@ static int live_timeslice_queue(void *arg)
> 		if (err)
> 			goto err_rq;
>
>-		intel_engine_flush_submission(engine);
>+		/* Wait until we ack the release_queue and start timeslicing
>*/
>+		do {
>+			intel_engine_flush_submission(engine);
>+		} while (READ_ONCE(engine->execlists.pending[0]));

Is this guaranteed to clear?  Or should there be a count to protect against
the endless loop?

Or am I too paranoid? 
Chris Wilson April 3, 2020, 8:34 p.m. UTC | #2
Quoting Ruhl, Michael J (2020-04-03 21:31:42)
> >-----Original Message-----
> >From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Chris
> >Wilson
> >Sent: Friday, April 3, 2020 3:02 PM
> >To: intel-gfx@lists.freedesktop.org
> >Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Wait until we start timeslicing
> >after a submit
> >
> >If we submit, we do not start timeslicnig until we process the CS event
> 
> s/timeslicnig/timeslicing/
> 
> >that marks the start of the context running on HW. So in the selftest,
> >be sure to wait until we have processed the pending events before
> >asserting that timeslicing has begun.
> >
> >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >---
> > drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c
> >b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> >index 985d4041d929..9e02917695b1 100644
> >--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
> >+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
> >@@ -1244,7 +1244,11 @@ static int live_timeslice_queue(void *arg)
> >               if (err)
> >                       goto err_rq;
> >
> >-              intel_engine_flush_submission(engine);
> >+              /* Wait until we ack the release_queue and start timeslicing
> >*/
> >+              do {
> >+                      intel_engine_flush_submission(engine);
> >+              } while (READ_ONCE(engine->execlists.pending[0]));
> 
> Is this guaranteed to clear?  Or should there be a count to protect against
> the endless loop?

Yes. If the HW stops, we reset it and clear the submission queue.
-Chris
Ruhl, Michael J April 3, 2020, 8:36 p.m. UTC | #3
>-----Original Message-----
>From: Chris Wilson <chris@chris-wilson.co.uk>
>Sent: Friday, April 3, 2020 4:34 PM
>To: Ruhl, Michael J <michael.j.ruhl@intel.com>; intel-
>gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftests: Wait until we start
>timeslicing after a submit
>
>Quoting Ruhl, Michael J (2020-04-03 21:31:42)
>> >-----Original Message-----
>> >From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of
>Chris
>> >Wilson
>> >Sent: Friday, April 3, 2020 3:02 PM
>> >To: intel-gfx@lists.freedesktop.org
>> >Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> >Subject: [Intel-gfx] [PATCH] drm/i915/selftests: Wait until we start
>timeslicing
>> >after a submit
>> >
>> >If we submit, we do not start timeslicnig until we process the CS event
>>
>> s/timeslicnig/timeslicing/
>>
>> >that marks the start of the context running on HW. So in the selftest,
>> >be sure to wait until we have processed the pending events before
>> >asserting that timeslicing has begun.
>> >
>> >Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> >---
>> > drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +++++-
>> > 1 file changed, 5 insertions(+), 1 deletion(-)
>> >
>> >diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c
>> >b/drivers/gpu/drm/i915/gt/selftest_lrc.c
>> >index 985d4041d929..9e02917695b1 100644
>> >--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
>> >+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
>> >@@ -1244,7 +1244,11 @@ static int live_timeslice_queue(void *arg)
>> >               if (err)
>> >                       goto err_rq;
>> >
>> >-              intel_engine_flush_submission(engine);
>> >+              /* Wait until we ack the release_queue and start timeslicing
>> >*/
>> >+              do {
>> >+                      intel_engine_flush_submission(engine);
>> >+              } while (READ_ONCE(engine->execlists.pending[0]));
>>
>> Is this guaranteed to clear?  Or should there be a count to protect against
>> the endless loop?
>
>Yes. If the HW stops, we reset it and clear the submission queue.

In that case:

Acked-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

M

>-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 985d4041d929..9e02917695b1 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -1244,7 +1244,11 @@  static int live_timeslice_queue(void *arg)
 		if (err)
 			goto err_rq;
 
-		intel_engine_flush_submission(engine);
+		/* Wait until we ack the release_queue and start timeslicing */
+		do {
+			intel_engine_flush_submission(engine);
+		} while (READ_ONCE(engine->execlists.pending[0]));
+
 		if (!READ_ONCE(engine->execlists.timer.expires) &&
 		    !i915_request_completed(rq)) {
 			struct drm_printer p =