[Intel-gfx] [PATCH 02/23] drm/i915/gem: Split the context's obj:vma lut into its own mutex

Andi Shyti andi at etezian.org
Thu Jul 2 22:09:44 UTC 2020


Hi Chris,

> @@ -1312,11 +1314,11 @@ static int set_ppgtt(struct drm_i915_file_private *file_priv,
>  	if (vm == rcu_access_pointer(ctx->vm))
>  		goto unlock;
>  
> +	old = __set_ppgtt(ctx, vm);
> +
>  	/* Teardown the existing obj:vma cache, it will have to be rebuilt. */
>  	lut_close(ctx);
>  
> -	old = __set_ppgtt(ctx, vm);
> -
>  	/*
>  	 * We need to flush any requests using the current ppgtt before
>  	 * we release it as the requests do not hold a reference themselves,
> @@ -1330,6 +1332,7 @@ static int set_ppgtt(struct drm_i915_file_private *file_priv,
>  	if (err) {
>  		i915_vm_close(__set_ppgtt(ctx, old));
>  		i915_vm_close(old);
> +		lut_close(ctx); /* rebuild the old obj:vma cache */

I don't really understand this but it doesn't hurt

> diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.c b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> index aa0d06cf1903..51b5a3421b40 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.c
> @@ -23,6 +23,8 @@ mock_context(struct drm_i915_private *i915,
>  	INIT_LIST_HEAD(&ctx->link);
>  	ctx->i915 = i915;
>  
> +	mutex_init(&ctx->mutex);
> +
>  	spin_lock_init(&ctx->stale.lock);
>  	INIT_LIST_HEAD(&ctx->stale.engines);
>  
> @@ -35,7 +37,7 @@ mock_context(struct drm_i915_private *i915,
>  	RCU_INIT_POINTER(ctx->engines, e);
>  
>  	INIT_RADIX_TREE(&ctx->handles_vma, GFP_KERNEL);
> -	mutex_init(&ctx->mutex);
> +	mutex_init(&ctx->lut_mutex);

...and I don't really understand why moved the first
init(&ctx->mutex) above, is it just aesthetic?

Reviewed-by: Andi Shyti <andi.shyti at intel.com>

Andi


More information about the Intel-gfx mailing list