[Intel-xe] [PATCH] drm/xe/vm: Avoid asid lookup if none allocated

Thomas Hellström thomas.hellstrom at linux.intel.com
Tue Dec 5 15:32:26 UTC 2023


On 12/5/23 16:00, Mika Kuoppala wrote:
> The destroy path can and will get called for incomplete
> vm objects on error paths, where the asid is not yet allocated.
> This leads to lookup fail and assert triggered.
>
> Fix this by not asserting of asid existence if vm never
> got assigned one.
>
> Cc: Ohad Sharabi <osharabi at habana.ai>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>

Reviewed-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>


> ---
>   drivers/gpu/drm/xe/xe_vm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index e09050f16f07..40ee256eb36a 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -1620,7 +1620,7 @@ static void vm_destroy_work_func(struct work_struct *w)
>   	if (!(vm->flags & XE_VM_FLAG_MIGRATION)) {
>   		xe_device_mem_access_put(xe);
>   
> -		if (xe->info.has_asid) {
> +		if (xe->info.has_asid && vm->usm.asid) {
>   			mutex_lock(&xe->usm.lock);
>   			lookup = xa_erase(&xe->usm.asid_to_vm, vm->usm.asid);
>   			xe_assert(xe, lookup == vm);


More information about the Intel-xe mailing list