[PATCH] drm/xe: Do not run GPU page fault handler on a closed VM

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Wed Sep 11 06:25:43 UTC 2024



On 11-09-2024 06:48, Matthew Brost wrote:
> Closing a VM removes page table memory thus we shouldn't touch page
> tables when a VM is closed. Do not run the GPU page fault handler once
> the VM is closed to avoid touching page tables.
> 
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gt_pagefault.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> index 730eec07795e..00af059a8971 100644
> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> @@ -212,6 +212,12 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
>   	 * TODO: Change to read lock? Using write lock for simplicity.
>   	 */
>   	down_write(&vm->lock);
> +
> +	if (xe_vm_is_closed(vm)) {
> +		err = -ENOENT;
> +		goto unlock_vm;
> +	}


LGTM.
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>


> +
>   	vma = lookup_vma(vm, pf->page_addr);
>   	if (!vma) {
>   		err = -EINVAL;


More information about the Intel-xe mailing list