[igt-dev] [PATCH i-g-t 07/15] gem_wsim: Infinite batch support

Chris Wilson chris at chris-wilson.co.uk
Thu May 23 14:09:55 UTC 2019


Quoting Chris Wilson (2019-05-23 15:05:05)
> Quoting Tvrtko Ursulin (2019-05-22 16:57:12)
> > -static void
> > +static unsigned int
> >  terminate_bb(struct w_step *w, unsigned int flags)
> >  {
> >         const uint32_t bbe = 0xa << 23;
> >         unsigned long mmap_start, mmap_len;
> >         unsigned long batch_start = w->bb_sz;
> > +       unsigned int r = 0;
> >         uint32_t *ptr, *cs;
> >  
> >         igt_assert(((flags & RT) && (flags & SEQNO)) || !(flags & RT));
> > @@ -838,6 +854,9 @@ terminate_bb(struct w_step *w, unsigned int flags)
> >         if (flags & RT)
> >                 batch_start -= 12 * sizeof(uint32_t);
> >  
> > +       if (w->unbound_duration)
> > +               batch_start -= 4 * sizeof(uint32_t); /* MI_ARB_CHK + MI_BATCH_BUFFER_START */
> > +
> >         mmap_start = rounddown(batch_start, PAGE_SIZE);
> >         mmap_len = ALIGN(w->bb_sz - mmap_start, PAGE_SIZE);
> >  
> > @@ -847,8 +866,19 @@ terminate_bb(struct w_step *w, unsigned int flags)
> >         ptr = gem_mmap__wc(fd, w->bb_handle, mmap_start, mmap_len, PROT_WRITE);
> >         cs = (uint32_t *)((char *)ptr + batch_start - mmap_start);
> >  
> > +       if (w->unbound_duration) {
> > +               w->reloc[r++].offset = batch_start + 2 * sizeof(uint32_t);
> > +               batch_start += 4 * sizeof(uint32_t);
> > +
> > +               *cs++ = w->preempt_us ? 0x5 << 23 /* MI_ARB_CHK; */ : MI_NOOP;
> > +               w->recursive_bb_start = cs;
> > +               *cs++ = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> > +               *cs++ = 0;
> > +               *cs++ = 0;
> 
> delta is zero, and mmap_len is consistent, so yup this gives a page of
> nops before looping.

Waitasec... Only emitting ARB_CHK if preempt_us is set. You want an
unbounded unpreemptible batch?

I suppose it's not without use (although I plan for it to be killed
quickly and reset), but I would not advise for preempt_us to be 0 by
default then.
-Chris


More information about the igt-dev mailing list