[Intel-gfx] [PATCH] drm/i915/gt: Make timeslice duration configurable

Chris Wilson chris at chris-wilson.co.uk
Tue Oct 29 16:17:03 UTC 2019


Quoting Mika Kuoppala (2019-10-29 16:11:58)
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > Execlists uses a scheduling quantum (a timeslice) to alternate execution
> > between ready-to-run contexts of equal priority. This ensures that all
> > users (though only if they of equal importance) have the opportunity to
> > run and prevents livelocks where contexts may have implicit ordering due
> > to userspace semaphores. However, not all workloads necessarily benefit
> > from timeslicing and in the extreme some sysadmin may want to disable or
> > reduce the timeslicing granularity.
> >
> > The timeslicing mechanism can be compiled out with
> 
> s/compiled/disabled

Behold the power of DCE :)
 
> > diff --git a/drivers/gpu/drm/i915/gt/intel_engine.h b/drivers/gpu/drm/i915/gt/intel_engine.h
> > index c6895938b626..0597b77f5818 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_engine.h
> > +++ b/drivers/gpu/drm/i915/gt/intel_engine.h
> > @@ -335,4 +335,13 @@ intel_engine_has_preempt_reset(const struct intel_engine_cs *engine)
> >       return intel_engine_has_preemption(engine);
> >  }
> >  
> > +static inline bool
> > +intel_engine_has_timeslices(const struct intel_engine_cs *engine)
> > +{
> > +     if (!CONFIG_DRM_I915_TIMESLICE_DURATION)
> > +             return 0;
> s/0/false;

True.

> > -static bool
> > -enable_timeslice(const struct intel_engine_execlists *execlists)
> > +static inline unsigned long
> > +timeslice(const struct intel_engine_cs *engine)
> 
> could be timeslice_duration, but not insisting

I was counting the characters iirc...

> >  static void record_preemption(struct intel_engine_execlists *execlists)
> > @@ -1667,8 +1684,9 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
> >                                */
> >                               if (!execlists->timer.expires &&
> >                                   need_timeslice(engine, last))
> > -                                     mod_timer(&execlists->timer,
> > -                                               jiffies + 1);
> > +                                     set_timer_ms(&execlists->timer,
> > +                                                  timeslice(engine));

to fit it there                                       -^

> 
> 
> I tripped into the hidden cancellation in here. Not that it
> would happen. Still upset I am of this set_timer_ms(timer, 0)

Heh, I thought I had saved some trouble by centralising all the
del_timer, msecs_to_jiffies, mod_timer etc :)
-Chris


More information about the Intel-gfx mailing list