From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 389E3C10F00 for ; Fri, 6 Mar 2020 14:07:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A4FD206CC for ; Fri, 6 Mar 2020 14:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgCFOHt (ORCPT ); Fri, 6 Mar 2020 09:07:49 -0500 Received: from mga09.intel.com ([134.134.136.24]:49735 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbgCFOHt (ORCPT ); Fri, 6 Mar 2020 09:07:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 06:07:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,522,1574150400"; d="scan'208";a="244622655" Received: from gaia.fi.intel.com ([10.237.72.192]) by orsmga006.jf.intel.com with ESMTP; 06 Mar 2020 06:07:42 -0800 Received: by gaia.fi.intel.com (Postfix, from userid 1000) id 8D12A5C1DD1; Fri, 6 Mar 2020 16:06:24 +0200 (EET) From: Mika Kuoppala To: Chris Wilson , intel-gfx@lists.freedesktop.org Cc: tvrtko.ursulin@intel.com, Chris Wilson , stable@vger.kernel.org Subject: Re: [PATCH 1/3] drm/i915/execlists: Enable timeslice on partial virtual engine dequeue In-Reply-To: <20200306113012.3184606-1-chris@chris-wilson.co.uk> References: <20200306113012.3184606-1-chris@chris-wilson.co.uk> Date: Fri, 06 Mar 2020 16:06:24 +0200 Message-ID: <877dzx4ly7.fsf@gaia.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Chris Wilson writes: > If we stop filling the ELSP due to an incompatible virtual engine > request, check if we should enable the timeslice on behalf of the queue. > > This fixes the case where we are inspecting the last->next element when > we know that the last element is the last request in the execution queue, > and so decided we did not need to enable timeslicing despite the intent > to do so! > > Fixes: 8ee36e048c98 ("drm/i915/execlists: Minimalistic timeslicing") > Signed-off-by: Chris Wilson > Cc: Mika Kuoppala > Cc: Tvrtko Ursulin > Cc: # v5.4+ Reviewed-by: Mika Kuoppala > --- > drivers/gpu/drm/i915/gt/intel_lrc.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c > index 13941d1c0a4a..a1d268880cfe 100644 > --- a/drivers/gpu/drm/i915/gt/intel_lrc.c > +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c > @@ -1757,11 +1757,9 @@ need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq) > if (!intel_engine_has_timeslices(engine)) > return false; > > - if (list_is_last(&rq->sched.link, &engine->active.requests)) > - return false; > - > - hint = max(rq_prio(list_next_entry(rq, sched.link)), > - engine->execlists.queue_priority_hint); > + hint = engine->execlists.queue_priority_hint; > + if (!list_is_last(&rq->sched.link, &engine->active.requests)) > + hint = max(hint, rq_prio(list_next_entry(rq, sched.link))); > > return hint >= effective_prio(rq); > } > @@ -1803,6 +1801,18 @@ static void set_timeslice(struct intel_engine_cs *engine) > set_timer_ms(&engine->execlists.timer, active_timeslice(engine)); > } > > +static void start_timeslice(struct intel_engine_cs *engine) > +{ > + struct intel_engine_execlists *execlists = &engine->execlists; > + > + execlists->switch_priority_hint = execlists->queue_priority_hint; > + > + if (timer_pending(&execlists->timer)) > + return; > + > + set_timer_ms(&execlists->timer, timeslice(engine)); > +} > + > static void record_preemption(struct intel_engine_execlists *execlists) > { > (void)I915_SELFTEST_ONLY(execlists->preempt_hang.count++); > @@ -1966,11 +1976,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) > * Even if ELSP[1] is occupied and not worthy > * of timeslices, our queue might be. > */ > - if (!execlists->timer.expires && > - need_timeslice(engine, last)) > - set_timer_ms(&execlists->timer, > - timeslice(engine)); > - > + start_timeslice(engine); > return; > } > } > @@ -2005,7 +2011,8 @@ static void execlists_dequeue(struct intel_engine_cs *engine) > > if (last && !can_merge_rq(last, rq)) { > spin_unlock(&ve->base.active.lock); > - return; /* leave this for another */ > + start_timeslice(engine); > + return; /* leave this for another sibling */ > } > > ENGINE_TRACE(engine, > -- > 2.25.1