public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/14] drm/i915: Keep a global seqno per-engine
Date: Tue, 14 Feb 2017 13:13:58 +0200	[thread overview]
Message-ID: <1487070838.3057.8.camel@linux.intel.com> (raw)
In-Reply-To: <20170202151312.31406-1-chris@chris-wilson.co.uk>

On to, 2017-02-02 at 15:12 +0000, Chris Wilson wrote:
> Replace the global device seqno with one for each engine, and account
> for in-flight seqno on each separately. This is consistent with
> dma-fence as each timeline has separate fence-contexts for each engine
> and a seqno is only ordered within a fence-context (i.e.  seqno do not
> need to be ordered wrt to other engines, just ordered within a single
> engine). This is required to enable request rewinding for preemption on
> individual engines (we have to rewind the global seqno to avoid
> overflow, and we do not have to rewind all engines just to preempt one.)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

<SNIP>

> @@ -213,7 +213,9 @@ static void i915_gem_request_retire(struct drm_i915_gem_request *request)
>  	GEM_BUG_ON(!i915_sw_fence_signaled(&request->submit));
>  	GEM_BUG_ON(!i915_sw_fence_signaled(&request->execute));
>  	GEM_BUG_ON(!i915_gem_request_completed(request));
> +
>  	GEM_BUG_ON(!request->i915->gt.active_requests);
> +	GEM_BUG_ON(!request->engine->timeline->active_seqno);

active_seqnos to indicate it's a count.
 
> -static int reserve_global_seqno(struct drm_i915_private *i915)
> +static int reserve_global_seqno(struct intel_engine_cs *engine)
>  {
> -	u32 active_requests = ++i915->gt.active_requests;
> -	u32 seqno = atomic_read(&i915->gt.global_timeline.seqno);
> +	u32 active = ++engine->timeline->active_seqno;
> +	u32 seqno = engine->timeline->seqno;
>  	int ret;
>  
>  	/* Reservation is fine until we need to wrap around */
> -	if (likely(seqno + active_requests > seqno))
> +	if (likely(seqno + active > seqno))
>  		return 0;
> 

Make a comment here that we don't currently track the semaphores
waiting on specific engine, so we instead choose to wrap all of them.
 
> -	ret = i915_gem_init_global_seqno(i915, 0);
> +	ret = i915_gem_init_global_seqno(engine->i915, 0);

Also, we don't have a global seqno anymore, so the function name needs
updating. Maybe "init_{all_}global_seqnos" to make it clear.

>  	if (ret) {
> -		i915->gt.active_requests--;
> +		engine->timeline->active_seqno--;
>  		return ret;
>  	}
>  
>  	return 0;
>  }

<SNIP>

> @@ -889,16 +887,14 @@ void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches)
>  	list_add_tail(&request->link, &timeline->requests);
>  	spin_unlock_irq(&timeline->lock);
>  
> -	GEM_BUG_ON(i915_seqno_passed(timeline->last_submitted_seqno,
> -				     request->fence.seqno));
> -
> -	timeline->last_submitted_seqno = request->fence.seqno;
> +	GEM_BUG_ON(timeline->seqno != request->fence.seqno);
>  	i915_gem_active_set(&timeline->last_request, request);
>  
>  	list_add_tail(&request->ring_link, &ring->request_list);
>  	request->emitted_jiffies = jiffies;
>  
> -	i915_gem_mark_busy(engine);
> +	if (!request->i915->gt.active_requests++)
> +		i915_gem_mark_busy(engine);

This kinda hides the increment, I'd prefer to have it better in sight.

With the comment added and function renamed;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-02-14 11:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 15:12 [PATCH 01/14] drm/i915: Keep a global seqno per-engine Chris Wilson
2017-02-02 15:13 ` [PATCH 02/14] drm/i915: Use a local to shorten req->i915->gpu_error.wait_queue Chris Wilson
2017-02-14 11:17   ` Joonas Lahtinen
2017-02-02 15:13 ` [PATCH 03/14] drm/i915: Add ourselves to the gpu error waitqueue for the entire wait Chris Wilson
2017-02-14 11:25   ` Joonas Lahtinen
2017-02-02 15:13 ` [PATCH 04/14] drm/i915: Inline __i915_gem_request_wait_for_execute() Chris Wilson
2017-02-14 11:32   ` Joonas Lahtinen
2017-02-14 11:55     ` Chris Wilson
2017-02-02 15:13 ` [PATCH 05/14] drm/i915: Deconstruct execute fence Chris Wilson
2017-02-02 15:13 ` [PATCH 06/14] drm/i915: Protect the request->global_seqno with the engine->timeline lock Chris Wilson
2017-02-02 15:13 ` [PATCH 07/14] drm/i915: Take a reference whilst processing the signaler request Chris Wilson
2017-02-02 15:13 ` [PATCH 08/14] drm/i915: Allow an request to be cancelled Chris Wilson
2017-02-02 15:13 ` [PATCH 09/14] drm/i915: Remove the preempted request from the execution queue Chris Wilson
2017-02-02 15:13 ` [PATCH 10/14] drm/i915: Exercise request cancellation using a mock selftest Chris Wilson
2017-02-02 15:13 ` [PATCH 11/14] drm/i915: Replace reset_wait_queue with default_wake_function Chris Wilson
2017-02-02 15:13 ` [PATCH 12/14] drm/i915: Refactor direct GPU reset from request waiters Chris Wilson
2017-02-02 15:13 ` [PATCH 13/14] drm/i915: Immediately process a reset before starting waiting Chris Wilson
2017-02-02 15:13 ` [PATCH 14/14] drm/i915: Remove one level of indention from wait-for-execute Chris Wilson
2017-02-14 11:13 ` Joonas Lahtinen [this message]
2017-02-14 11:57   ` [PATCH 01/14] drm/i915: Keep a global seqno per-engine Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487070838.3057.8.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox