All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/6] drm/i915: Force the switch to the i915->kernel_context
Date: Thu, 02 Nov 2017 17:40:50 +0200	[thread overview]
Message-ID: <87d150elj1.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20171102124226.30086-2-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> In the next few patches, we will have a hard requirement that we emit a
> context-switch to the perma-pinned i915->kernel_context (so that we can
> save the HW state using that context-switch). As the first context
> itself may be classed as a kernel context, we want to be explicit in our
> comparison. For an extra-layer of finesse, we can check the last
> unretired context on the engine; as well as the last retired context
> when idle.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index ddbe5c9bf45a..c15e288bed02 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1587,8 +1587,20 @@ bool intel_engines_are_idle(struct drm_i915_private *dev_priv)
>  
>  bool intel_engine_has_kernel_context(const struct intel_engine_cs *engine)
>  {
> -	return (!engine->last_retired_context ||
> -		i915_gem_context_is_kernel(engine->last_retired_context));
> +	const struct i915_gem_context *kctx = engine->i915->kernel_context;
> +	struct drm_i915_gem_request *rq;
> +
> +	lockdep_assert_held(&engine->i915->drm.struct_mutex);
> +
> +	/* An unretired request? */
> +	rq = __i915_gem_active_peek(&engine->timeline->last_request);
> +	if (rq)
> +		return rq->ctx == kctx;
> +
> +	if (!engine->last_retired_context)
> +		return true;
> +
> +	return engine->last_retired_context == kctx;


Conside that we would have intel_engine_loaded_context(engine)
{
        rq = __i915_gem_active_peek(&engine->timeline->last_request);
        if (rq)
           return rq->ctx;

        if (engine->last_retired_context)
                return engine->last_retired_context;

        return NULL;        
}

and then have simple intel_engine_has_kernel_context_loaded()

Also further on the patch series we do switch to kernel context
on init, to grab the hw state. So would it be possible to completely
get rid of notion that !engine->last_retired_context means kernel
context? I would rather assert that we have always last retired
context after init and resume.

-Mika

>  }
>  
>  void intel_engines_reset_default_submission(struct drm_i915_private *i915)
> -- 
> 2.15.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 12:42 Context isolation Chris Wilson
2017-11-02 12:42 ` [PATCH 1/6] drm/i915: Force the switch to the i915->kernel_context Chris Wilson
2017-11-02 13:45   ` Joonas Lahtinen
2017-11-02 15:40   ` Mika Kuoppala [this message]
2017-11-02 15:45     ` Chris Wilson
2017-11-02 12:42 ` [PATCH 2/6] drm/i915: Move GT powersaving init to i915_gem_init() Chris Wilson
2017-11-02 13:46   ` Joonas Lahtinen
2017-11-02 14:35   ` Sagar Arun Kamble
2017-11-02 14:55     ` Chris Wilson
2017-11-02 15:38       ` Sagar Arun Kamble
2017-11-02 12:42 ` [PATCH 3/6] drm/i915: Inline intel_modeset_gem_init() Chris Wilson
2017-11-02 13:47   ` Joonas Lahtinen
2017-11-02 12:42 ` [PATCH 4/6] drm/i915: Record the default hw state after reset upon load Chris Wilson
2017-11-02 13:56   ` Mika Kuoppala
2017-11-02 14:10     ` Chris Wilson
2017-11-02 14:23   ` Ville Syrjälä
2017-11-02 14:37     ` Chris Wilson
2017-11-02 14:26   ` Joonas Lahtinen
2017-11-02 12:42 ` [PATCH 5/6] drm/i915: Remove redundant intel_autoenable_gt_powersave() Chris Wilson
2017-11-02 13:36   ` Joonas Lahtinen
2017-11-02 12:42 ` [PATCH 6/6] drm/i915: Stop caching the "golden" renderstate Chris Wilson
2017-11-02 14:43   ` Joonas Lahtinen
2017-11-02 14:54     ` Rodrigo Vivi
2017-11-02 14:56       ` Joonas Lahtinen
2017-11-02 22:36         ` Oscar Mateo
2017-11-02 23:34           ` Rodrigo Vivi
2017-11-02 23:36             ` Chris Wilson
2017-11-03  8:39             ` Joonas Lahtinen
2017-11-03 17:44               ` Rodrigo Vivi
2017-11-02 13:14 ` ✗ Fi.CI.BAT: failure for series starting with [1/6] drm/i915: Force the switch to the i915->kernel_context Patchwork

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=87d150elj1.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.