Re: [Intel-gfx] [PATCH 50/51] drm/i915/guc: Implement GuC priority management

Matthew Brost
2021-07-22T21:55:08Z

On Thu, Jul 22, 2021 at 02:50:24PM -0700, Daniele Ceraolo Spurio wrote:
>
> <snip>
>
> > > > @@ -1756,15 +1796,119 @@ static int guc_context_alloc(struct intel_context *ce)
> > > > return lrc_alloc(ce, ce->engine);
> > > > }
> > > > +static void guc_context_set_prio(struct intel_guc *guc,
> > > > + struct intel_context *ce,
> > > > + u8 prio)
> > > > +{
> > > > + u32 action[] = {
> > > > + INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY,
> > > > + ce->guc_id,
> > > > + prio,
> > > > + };
> > > > +
> > > > + GEM_BUG_ON(prio < GUC_CLIENT_PRIORITY_KMD_HIGH ||
> > > > + prio > GUC_CLIENT_PRIORITY_NORMAL);
> > > > +
> > > > + if (ce->guc_prio == prio || submission_disabled(guc) ||
> > > > + !context_registered(ce))
> > > > + return;
> > > > +
> > > > + guc_submission_send_busy_loop(guc, action, ARRAY_SIZE(action), 0, true);
> > > > +
> > > > + ce->guc_prio = prio;
> > > > + trace_intel_context_set_prio(ce);
> > > > +}
> > > > +
> > > > +static inline u8 map_i915_prio_to_guc_prio(int prio)
> > > > +{
> > > > + if (prio == I915_PRIORITY_NORMAL)
> > > > + return GUC_CLIENT_PRIORITY_KMD_NORMAL;
> > > > + else if (prio < I915_PRIORITY_NORMAL)
> > > > + return GUC_CLIENT_PRIORITY_NORMAL;
> > > > + else if (prio != I915_PRIORITY_BARRIER)
> > > Shouldn't this be I915_PRIORITY_UNPREEMPTABLE?
> > >
> > No, I915_PRIORITY_UNPREEMPTABLE is an execlists only concept.
>
> then we need a
>
> /* we don't expect umpreemptable submissions with the GuC */
> GEM_BUG_ON(prio == I915_PRIORITY_UNPREEMPTABLE)
>

Actually this probably should < I915_PRIORITY_DISPLAY as we really want
pageflips to be high than any user context.

Matt

> or something, because that prio level would be assigned incorrectly
> otherwise.
>
> Daniele