[Intel-gfx] [PATCH 15/25] drm/i915/selftests: Perform some basic cycle counting of MI ops

Matthew Auld matthew.william.auld at gmail.com
Mon Nov 11 17:20:32 UTC 2019


On Mon, 11 Nov 2019 at 17:16, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>
> Quoting Matthew Auld (2019-11-11 17:10:37)
> > On Sun, 10 Nov 2019 at 18:58, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > > +static struct i915_vma *create_empty_batch(struct intel_context *ce)
> > > +{
> > > +       struct drm_i915_gem_object *obj;
> > > +       struct i915_vma *vma;
> > > +       u32 *cs;
> > > +       int err;
> > > +
> > > +       obj = i915_gem_object_create_internal(ce->engine->i915, PAGE_SIZE);
> > > +       if (IS_ERR(obj))
> > > +               return ERR_CAST(obj);
> > > +
> > > +       cs = i915_gem_object_pin_map(obj, I915_MAP_WB);
> > > +       if (IS_ERR(cs)) {
> > > +               i915_gem_object_put(obj);
> > > +               return ERR_CAST(cs);
> > > +       }
> > > +
> > > +       cs[0] = MI_BATCH_BUFFER_END;
> > > +
> > > +       i915_gem_object_flush_map(obj);
> > > +       i915_gem_object_unpin_map(obj);
> > > +
> > > +       vma = i915_vma_instance(obj, ce->vm, NULL);
> > > +       if (IS_ERR(vma)) {
> > > +               i915_gem_object_put(obj);
> > > +               return vma;
> > > +       }
> > > +
> > > +       err = i915_vma_pin(vma, 0, 0, PIN_USER);
> > > +       if (err) {
> > > +               i915_gem_object_put(obj);
> > > +               return ERR_PTR(err);
> > > +       }
> >
> > Living dangerously? Object is volatile, below also.
>
> What's a shrinker? :)
>
> > > +               for (i = 0; i < ARRAY_SIZE(cycles); i++) {
> > > +                       struct i915_request *rq;
> > > +
> > > +                       rq = i915_request_create(ce);
> > > +                       if (IS_ERR(rq)) {
> > > +                               err = PTR_ERR(rq);
> > > +                               break;
> > > +                       }
> > > +
> > > +                       err = write_timestamp(rq, 2);
> > > +                       if (err)
> > > +                               goto out;
> > > +
> > > +                       err = rq->engine->emit_bb_start(rq,
> > > +                                                       base->node.start, 8,
> > > +                                                       0);
> > > +                       if (err)
> > > +                               goto out;
> > > +
> > > +                       err = write_timestamp(rq, 3);
> > > +                       if (err)
> > > +                               goto out;
> > > +
> > > +                       err = rq->engine->emit_bb_start(rq,
> > > +                                                       nop->node.start, 4096,
> >
> > That should be 64K? Can't we just make these node.size?
>
> Not like the test can run on gen2 anyway :)
>
> > Also why do we measure both empty + nop here?
>
> So the test is standalone; we subtract the overhead of the MI_BB_START
> from the measurement, otherwise the overhead would dominate.

Ah ofc, makes sense.
Reviewed-by: Matthew Auld <matthew.auld at intel.com>


More information about the Intel-gfx mailing list