[Intel-gfx] [PATCH 10/40] drm/i915/selftests: Basic stress test for rapid context switching

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 20 10:46:39 UTC 2018


Quoting Mika Kuoppala (2018-09-20 11:38:08)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> > +             end_time = jiffies + i915_selftest.timeout_jiffies;
> > +             for_each_prime_number_from(prime, 2, 8192) {
> > +                     times[1] = ktime_get_raw();
> > +
> > +                     for (n = 0; n < prime; n++) {
> > +                             rq = i915_request_alloc(engine, ctx[n % nctx]);
> > +                             if (IS_ERR(rq)) {
> > +                                     err = PTR_ERR(rq);
> > +                                     goto out_unlock;
> > +                             }
> > +
> > +                             /*
> > +                              * This space is left intentionally blank.
> > +                              *
> > +                              * We do not actually want to perform any
> > +                              * action with this request, we just want
> > +                              * to measure the latency in allocation
> > +                              * and submission of our breadcrumbs -
> > +                              * ensuring that the bare request is sufficient
> > +                              * for the system to work (i.e. proper HEAD
> > +                              * tracking of the rings, interrupt handling,
> > +                              * etc). It also gives us the lowest bounds
> > +                              * for latency.
> > +                              */
> > +
> > +                             i915_request_add(rq);
> 
> We get the breadcrumbs in place, with the wa_tails and so on so this
> should work without any nops nor bb ends.

Right, not one batch.
 
> > +                     }
> > +                     i915_request_wait(rq,
> > +                                       I915_WAIT_LOCKED,
> > +                                       MAX_SCHEDULE_TIMEOUT);

Fwiw, a lesson learnt from buggy code is never to use
MAX_SCHEDULE_TIMEOUT in tests :)
-Chris


More information about the Intel-gfx mailing list