All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff McGee <jeff.mcgee@intel.com>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: Dave Gordon <david.s.gordon@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/10] drm/i915/guc: Add a second client, to be used for preemption
Date: Thu, 5 Oct 2017 07:58:51 -0700	[thread overview]
Message-ID: <20171005145851.GB2868@jeffdesk> (raw)
In-Reply-To: <20171005091349.9315-4-michal.winiarski@intel.com>

On Thu, Oct 05, 2017 at 11:13:43AM +0200, Michał Winiarski wrote:
> From: Dave Gordon <david.s.gordon@intel.com>
> 
> This second client is created with priority KMD_HIGH, and marked
> as preemptive. This will allow us to request preemption using GuC actions.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jeff Mcgee <jeff.mcgee@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Oscar Mateo <oscar.mateo@intel.com>
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c        |  4 ++++
>  drivers/gpu/drm/i915/i915_guc_submission.c | 32 ++++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_uc.h            |  1 +
>  3 files changed, 33 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index b4a6ac60e7c6..1a963c13cab8 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2488,6 +2488,10 @@ static int i915_guc_info(struct seq_file *m, void *data)
>  
>  	seq_printf(m, "\nGuC execbuf client @ %p:\n", guc->execbuf_client);
>  	i915_guc_client_info(m, dev_priv, guc->execbuf_client);
> +	if (guc->preempt_client) {
> +		seq_printf(m, "\nGuC preempt client\n");
> +		i915_guc_client_info(m, dev_priv, guc->preempt_client);
> +	}
>  
>  	i915_guc_log_info(m, dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c
> index 374501a67274..e8052e86426d 100644
> --- a/drivers/gpu/drm/i915/i915_guc_submission.c
> +++ b/drivers/gpu/drm/i915/i915_guc_submission.c
> @@ -331,6 +331,8 @@ static void guc_stage_desc_init(struct intel_guc *guc,
>  	memset(desc, 0, sizeof(*desc));
>  
>  	desc->attribute = GUC_STAGE_DESC_ATTR_ACTIVE | GUC_STAGE_DESC_ATTR_KERNEL;
> +	if (client->priority <= GUC_CLIENT_PRIORITY_HIGH)
> +		desc->attribute |= GUC_STAGE_DESC_ATTR_PREEMPT;
>  	desc->stage_id = client->stage_id;
>  	desc->priority = client->priority;
>  	desc->db_id = client->doorbell_id;
> @@ -1154,7 +1156,7 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
>  		     sizeof(struct guc_wq_item) *
>  		     I915_NUM_ENGINES > GUC_WQ_SIZE);
>  
I think that client is still being initialized above to guc->execbuf_client.
If so, can it be removed?

> -	if (!client) {
> +	if (!guc->execbuf_client) {
>  		client = guc_client_alloc(dev_priv,
>  					  INTEL_INFO(dev_priv)->ring_mask,
>  					  GUC_CLIENT_PRIORITY_KMD_NORMAL,
> @@ -1167,15 +1169,29 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
>  		guc->execbuf_client = client;
>  	}
>  
> +	if (!guc->preempt_client) {
> +		client = guc_client_alloc(dev_priv,
> +					  INTEL_INFO(dev_priv)->ring_mask,
> +					  GUC_CLIENT_PRIORITY_KMD_HIGH,
> +					  dev_priv->preempt_context);
> +		if (IS_ERR(client)) {
> +			DRM_ERROR("Failed to create GuC client for preemption!\n");
> +			err = PTR_ERR(client);
> +			goto err_free_clients;
> +		}
> +
> +		guc->preempt_client = client;
> +	}
> +
>  	err = intel_guc_sample_forcewake(guc);
>  	if (err)
> -		goto err_execbuf_client;
> +		goto err_free_clients;
>  
>  	guc_reset_wq(client);
>  
>  	err = guc_init_doorbell_hw(guc);
>  	if (err)
> -		goto err_execbuf_client;
> +		goto err_free_clients;
>  
>  	/* Take over from manual control of ELSP (execlists) */
>  	guc_interrupts_capture(dev_priv);
> @@ -1187,7 +1203,11 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
>  
>  	return 0;
>  
> -err_execbuf_client:
> +err_free_clients:
> +	if (guc->preempt_client) {
> +		guc_client_free(guc->preempt_client);
> +		guc->preempt_client = NULL;
> +	}
>  	guc_client_free(guc->execbuf_client);
>  	guc->execbuf_client = NULL;
>  	return err;
> @@ -1202,6 +1222,10 @@ void i915_guc_submission_disable(struct drm_i915_private *dev_priv)
>  	/* Revert back to manual ELSP submission */
>  	intel_engines_reset_default_submission(dev_priv);
>  
> +	if (guc->preempt_client) {
Do we need this check? It seems that execbuf_client and preempt_client are
both required for GuC submission to be enabled.
> +		guc_client_free(guc->preempt_client);
> +		guc->preempt_client = NULL;
> +	}
>  	guc_client_free(guc->execbuf_client);
>  	guc->execbuf_client = NULL;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
> index 10e8f0ed02e4..c6c6f8513bbf 100644
> --- a/drivers/gpu/drm/i915/intel_uc.h
> +++ b/drivers/gpu/drm/i915/intel_uc.h
> @@ -107,6 +107,7 @@ struct intel_guc {
>  	struct ida stage_ids;
>  
>  	struct i915_guc_client *execbuf_client;
> +	struct i915_guc_client *preempt_client;
>  
>  	DECLARE_BITMAP(doorbell_bitmap, GUC_NUM_DOORBELLS);
>  	uint32_t db_cacheline;		/* Cyclic counter mod pagesize	*/
> -- 
> 2.13.5
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-10-05 15:04 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  9:13 [PATCH 01/10] drm/i915/guc: Precompute GuC shared data offset Michał Winiarski
2017-10-05  9:13 ` [PATCH 02/10] drm/i915/guc: Initialize GuC before restarting engines Michał Winiarski
2017-10-05  9:36   ` Chris Wilson
2017-10-05 11:55     ` Michał Winiarski
2017-10-05  9:13 ` [PATCH 03/10] drm/i915/guc: Add preemption action to GuC firmware interface Michał Winiarski
2017-10-05 14:25   ` Jeff McGee
2017-10-05  9:13 ` [PATCH 04/10] drm/i915/guc: Add a second client, to be used for preemption Michał Winiarski
2017-10-05  9:39   ` Chris Wilson
2017-10-05 13:59   ` Michal Wajdeczko
2017-10-05 14:58   ` Jeff McGee [this message]
2017-10-05 15:22   ` Daniele Ceraolo Spurio
2017-10-05 16:00     ` Michał Winiarski
2017-10-05 16:35       ` Daniele Ceraolo Spurio
2017-10-05 18:20         ` Michał Winiarski
2017-10-05  9:13 ` [PATCH 05/10] drm/i915/guc: Split guc_wq_item_append Michał Winiarski
2017-10-05  9:45   ` Chris Wilson
2017-10-05 20:37   ` Jeff McGee
2017-10-05  9:20 ` [PATCH 06/10] drm/i915: Extract "emit write" part of emit breadcrumb functions Michał Winiarski
2017-10-05  9:20   ` [PATCH 07/10] drm/i915: Add information needed to track engine preempt state Michał Winiarski
2017-10-05  9:49     ` Chris Wilson
2017-10-05 20:42     ` Jeff McGee
2017-10-05  9:20   ` [PATCH 08/10] drm/i915/guc: Keep request->priority for its lifetime Michał Winiarski
2017-10-05  9:50     ` Chris Wilson
2017-10-05  9:20   ` [PATCH 09/10] drm/i915/guc: Preemption! With GuC Michał Winiarski
2017-10-05 10:04     ` Chris Wilson
2017-10-05 10:31     ` Chris Wilson
2017-10-05 18:38       ` Michał Winiarski
2017-10-05 15:00     ` Michal Wajdeczko
2017-10-05 15:42       ` Michał Winiarski
2017-10-05  9:20   ` [PATCH 10/10] HAX Enable GuC Submission for CI Michał Winiarski
2017-10-05  9:47   ` [PATCH 06/10] drm/i915: Extract "emit write" part of emit breadcrumb functions Chris Wilson
2017-10-05  9:33 ` [PATCH 01/10] drm/i915/guc: Precompute GuC shared data offset Chris Wilson
2017-10-05 17:02   ` Daniele Ceraolo Spurio
2017-10-06 12:35     ` Michał Winiarski
2017-10-06 16:24       ` Daniele Ceraolo Spurio
2017-10-05 11:30 ` Michal Wajdeczko
2017-10-26 21:22 ` ✗ Fi.CI.BAT: failure for series starting with [01/10] " 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=20171005145851.GB2868@jeffdesk \
    --to=jeff.mcgee@intel.com \
    --cc=david.s.gordon@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michal.winiarski@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 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.