[Intel-gfx] [PATCH] drm/i915: Only allocate preempt context when required

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Tue Jan 30 00:24:04 UTC 2018


<snip>

> @@ -979,17 +979,19 @@ static int guc_clients_create(struct intel_guc *guc)
>   	}
>   	guc->execbuf_client = 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");
> -		guc_client_free(guc->execbuf_client);
> -		guc->execbuf_client = NULL;
> -		return PTR_ERR(client);
> +	if (dev_priv->preempt_context) {
> +		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");
> +			guc_client_free(guc->execbuf_client);
> +			guc->execbuf_client = NULL;
> +			return PTR_ERR(client);
> +		}
> +		guc->preempt_client = client;
>   	}

I was having another look at this patch while rebasing my patches on top 
of it and I noticed that although guc->preempt_client is now not always 
created other code still assumes that it is always there. All platforms 
with GuC also have preemption, so i think the only case in which we can 
have issues is when we fail to create the preempt context and keep going 
with the driver loading assuming preemption disabled.

Daniele


More information about the Intel-gfx mailing list