From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 33/43] drm/i915/bdw: Help out the ctx switch interrupt handler Date: Thu, 14 Aug 2014 22:43:15 +0200 Message-ID: <20140814204315.GL10500@phenom.ffwll.local> References: <1406217891-8912-1-git-send-email-thomas.daniel@intel.com> <1406217891-8912-34-git-send-email-thomas.daniel@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 30A536E74B for ; Thu, 14 Aug 2014 13:43:04 -0700 (PDT) Received: by mail-wi0-f177.google.com with SMTP id ho1so23594wib.16 for ; Thu, 14 Aug 2014 13:43:03 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1406217891-8912-34-git-send-email-thomas.daniel@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Thomas Daniel Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, Jul 24, 2014 at 05:04:41PM +0100, Thomas Daniel wrote: > From: Oscar Mateo > > If we receive a storm of requests for the same context (see gem_storedw_loop_*) > we might end up iterating over too many elements in interrupt time, looking for > contexts to squash together. Instead, share the burden by giving more > intelligence to the queue function. At most, the interrupt will iterate over > three elements. > > Signed-off-by: Oscar Mateo I'll continue merging after this patch tomorrow. -Daniel > --- > drivers/gpu/drm/i915/intel_lrc.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c > index 895dbfc..829b15d 100644 > --- a/drivers/gpu/drm/i915/intel_lrc.c > +++ b/drivers/gpu/drm/i915/intel_lrc.c > @@ -384,9 +384,10 @@ static int execlists_context_queue(struct intel_engine_cs *ring, > struct intel_context *to, > u32 tail) > { > - struct intel_ctx_submit_request *req = NULL; > + struct drm_i915_private *dev_priv = ring->dev->dev_private; > + struct intel_ctx_submit_request *req = NULL, *cursor; > unsigned long flags; > - bool was_empty; > + int num_elements = 0; > > req = kzalloc(sizeof(*req), GFP_KERNEL); > if (req == NULL) > @@ -400,9 +401,26 @@ static int execlists_context_queue(struct intel_engine_cs *ring, > > spin_lock_irqsave(&ring->execlist_lock, flags); > > - was_empty = list_empty(&ring->execlist_queue); > + list_for_each_entry(cursor, &ring->execlist_queue, execlist_link) > + if (++num_elements > 2) > + break; > + > + if (num_elements > 2) { > + struct intel_ctx_submit_request *tail_req; > + > + tail_req = list_last_entry(&ring->execlist_queue, > + struct intel_ctx_submit_request, > + execlist_link); > + if (to == tail_req->ctx) { > + WARN(tail_req->elsp_submitted != 0, > + "More than 2 already-submitted reqs queued\n"); > + list_del(&tail_req->execlist_link); > + queue_work(dev_priv->wq, &tail_req->work); > + } > + } > + > list_add_tail(&req->execlist_link, &ring->execlist_queue); > - if (was_empty) > + if (num_elements == 0) > execlists_context_unqueue(ring); > > spin_unlock_irqrestore(&ring->execlist_lock, flags); > -- > 1.7.9.5 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch