public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: mika.kuoppala@intel.com
Subject: Re: [PATCH 15/22] drm/i915: Provide an i915_active.acquire callback
Date: Mon, 17 Jun 2019 19:58:49 +0100	[thread overview]
Message-ID: <8ca0a031-350b-5639-c376-e9eb84ad7190@intel.com> (raw)
In-Reply-To: <20190617071912.20256-15-chris@chris-wilson.co.uk>

On 17/06/2019 08:19, Chris Wilson wrote:
> If we introduce a callback for i915_active that is only called the first
> time we use the i915_active and is symmetrically paired with the
> i915_active.retire callback, we can replace the open-coded and
> non-atomic implementations -- which will be very fragile (i.e. broken)
> upon removing the struct_mutex serialisation.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_context.c  |   8 +-
>   drivers/gpu/drm/i915/gt/intel_context.c      |  82 ++++---
>   drivers/gpu/drm/i915/gt/intel_context.h      |  14 +-
>   drivers/gpu/drm/i915/gt/intel_lrc.c          |   6 +-
>   drivers/gpu/drm/i915/gt/intel_ringbuffer.c   |   2 +-
>   drivers/gpu/drm/i915/gt/mock_engine.c        |   2 +-
>   drivers/gpu/drm/i915/i915_active.c           | 217 ++++++++++---------
>   drivers/gpu/drm/i915/i915_active.h           |  25 ++-
>   drivers/gpu/drm/i915/i915_active_types.h     |  10 +-
>   drivers/gpu/drm/i915/i915_gem_gtt.c          |   2 +-
>   drivers/gpu/drm/i915/i915_timeline.c         |  16 +-
>   drivers/gpu/drm/i915/i915_vma.c              |  22 +-
>   drivers/gpu/drm/i915/selftests/i915_active.c |  12 +-
>   13 files changed, 225 insertions(+), 193 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index 1ce122f4ed25..9262a1d4f763 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -923,8 +923,12 @@ static int context_barrier_task(struct i915_gem_context *ctx,
>   	if (!cb)
>   		return -ENOMEM;
>   
> -	i915_active_init(i915, &cb->base, cb_retire);
> -	i915_active_acquire(&cb->base);
> +	i915_active_init(i915, &cb->base, NULL, cb_retire);
> +	err = i915_active_acquire(&cb->base);
> +	if (err) {
> +		kfree(cb);
> +		return err;
> +	}
>   
>   	for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
>   		struct i915_request *rq;
> diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
> index 2c454f227c2e..b19aa823a51a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_context.c
> +++ b/drivers/gpu/drm/i915/gt/intel_context.c
> @@ -95,11 +95,14 @@ void intel_context_unpin(struct intel_context *ce)
>   	intel_context_put(ce);
>   }
>   
> -static int __context_pin_state(struct i915_vma *vma, unsigned long flags)
> +static int __context_pin_state(struct i915_vma *vma)
>   {
> +	u64 flags;
>   	int err;
>   
> -	err = i915_vma_pin(vma, 0, 0, flags | PIN_GLOBAL);
> +	flags = PIN_HIGH | PIN_GLOBAL;
> +	flags |= i915_vm_to_ggtt(vma->vm)->pin_bias | PIN_OFFSET_BIAS;

i915_ggtt_pin_bias(vma) | PIN_OFFSET_BIAS;

Fwiw,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-17 18:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17  7:18 [PATCH 01/22] drm/i915: Restore -Wunused-but-set-variable Chris Wilson
2019-06-17  7:18 ` [PATCH 02/22] drm/i915/gtt: Serialise both updates to PDE and our shadow Chris Wilson
2019-06-17 10:36   ` Matthew Auld
2019-06-17 10:40     ` Chris Wilson
2019-06-17  7:18 ` [PATCH 03/22] drm/i915: Skip shrinking already freed pages Chris Wilson
2019-06-17  7:18 ` [PATCH 04/22] drm/i915: Stop passing I915_WAIT_LOCKED to i915_request_wait() Chris Wilson
2019-06-17  7:18 ` [PATCH 05/22] drm/i915: Flush the execution-callbacks on retiring Chris Wilson
2019-06-17  7:18 ` [PATCH 06/22] drm/i915/execlists: Preempt-to-busy Chris Wilson
2019-06-17  7:18 ` [PATCH 07/22] drm/i915/execlists: Minimalistic timeslicing Chris Wilson
2019-06-17  7:18 ` [PATCH 08/22] drm/i915/execlists: Force preemption Chris Wilson
2019-06-17  7:18 ` [PATCH 09/22] drm/i915: Make the semaphore saturation mask global Chris Wilson
2019-06-17  7:19 ` [PATCH 10/22] dma-fence: Propagate errors to dma-fence-array container Chris Wilson
2019-06-17  7:19 ` [PATCH 11/22] dma-fence: Report the composite sync_file status Chris Wilson
2019-06-17  7:19 ` [PATCH 12/22] dma-fence: Refactor signaling for manual invocation Chris Wilson
2019-06-17  7:19 ` [PATCH 13/22] dma-fence: Always execute signal callbacks Chris Wilson
2019-06-17  7:19 ` [PATCH 14/22] drm/i915: Throw away the active object retirement complexity Chris Wilson
2019-06-17 13:43   ` Matthew Auld
2019-06-17 13:49     ` Chris Wilson
2019-06-17  7:19 ` [PATCH 15/22] drm/i915: Provide an i915_active.acquire callback Chris Wilson
2019-06-17 18:58   ` Matthew Auld [this message]
2019-06-17  7:19 ` [PATCH 16/22] drm/i915: Push the i915_active.retire into a worker Chris Wilson
2019-06-17 19:25   ` Matthew Auld
2019-06-17  7:19 ` [PATCH 17/22] drm/i915/overlay: Switch to using i915_active tracking Chris Wilson
2019-06-17  7:19 ` [PATCH 18/22] drm/i915: Forgo last_fence active request tracking Chris Wilson
2019-06-17 19:34   ` Matthew Auld
2019-06-17  7:19 ` [PATCH 19/22] drm/i915: Extract intel_frontbuffer active tracking Chris Wilson
2019-06-17  7:19 ` [PATCH 20/22] drm/i915: Coordinate i915_active with its own mutex Chris Wilson
2019-06-17  7:19 ` [PATCH 21/22] drm/i915: Replace struct_mutex for batch pool serialisation Chris Wilson
2019-06-17  7:19 ` [PATCH 22/22] drm/i915: Move idle barrier cleanup into engine-pm Chris Wilson
2019-06-17  7:56 ` [PATCH 01/22] drm/i915: Restore -Wunused-but-set-variable Chris Wilson
2019-06-17  8:02 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/22] " Patchwork
2019-06-17  8:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-17 13:05 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-06-17 13:18   ` Chris Wilson
2019-06-18  7:54 ` [PATCH 01/22] " Jani Nikula

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=8ca0a031-350b-5639-c376-e9eb84ad7190@intel.com \
    --to=matthew.auld@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@intel.com \
    /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