[PATCH 4/5] drm/xe: Take a ref to xe file when user creates a VM

Matthew Brost matthew.brost at intel.com
Mon Jul 8 21:32:16 UTC 2024


On Mon, Jul 08, 2024 at 01:21:02PM -0700, Umesh Nerlige Ramappa wrote:
> Take a reference to xef when user creates the VM and put the reference
> when user destroys the VM.
> 

Oh you do take a ref in the VM. The idea is right idea but my comment
about xe_file_close calling xe_vm_close_and_put still stands. 

This patch LGTM to though, with that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 0c764647a552..67b4c2467b78 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -1611,6 +1611,9 @@ static void vm_destroy_work_func(struct work_struct *w)
>  		XE_WARN_ON(vm->pt_root[id]);
>  
>  	trace_xe_vm_free(vm);
> +
> +	if (vm->xef)
> +		xe_file_put(vm->xef);
>  	kfree(vm);
>  }
>  
> @@ -1926,7 +1929,7 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,
>  	}
>  
>  	args->vm_id = id;
> -	vm->xef = xef;
> +	vm->xef = xe_file_get(xef);
>  
>  	/* Record BO memory for VM pagetable created against client */
>  	for_each_tile(tile, xe, id)
> -- 
> 2.38.1
> 


More information about the Intel-xe mailing list