Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Matthew Auld <matthew.auld@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/xe/vm: move xe_svm_init() earlier
Date: Wed, 14 May 2025 17:08:28 -0700	[thread overview]
Message-ID: <aCUwfHsm5ssOV0KB@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250514152424.149591-4-matthew.auld@intel.com>

On Wed, May 14, 2025 at 04:24:26PM +0100, Matthew Auld wrote:
> In xe_vm_close_and_put() we need to be able to call xe_svm_fini(),
> however during vm creation we can call this on the error path, before
> having actually initialised the svm state, leading to various splats
> followed by a fatal NPD.
> 
> Fixes: 6fd979c2f331 ("drm/xe: Add SVM init / close / fini to faulting VMs")
> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4967
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_vm.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 168756fb140b..7140d8856bad 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -1709,10 +1709,16 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
>  		xe_pm_runtime_get_noresume(xe);
>  	}
>  
> +	if (flags & XE_VM_FLAG_FAULT_MODE) {
> +		err = xe_svm_init(vm);
> +		if (err)
> +			goto err_no_resv;
> +	}
> +
>  	vm_resv_obj = drm_gpuvm_resv_object_alloc(&xe->drm);
>  	if (!vm_resv_obj) {
>  		err = -ENOMEM;
> -		goto err_no_resv;
> +		goto err_svm_fini;
>  	}
>  
>  	drm_gpuvm_init(&vm->gpuvm, "Xe VM", DRM_GPUVM_RESV_PROTECTED, &xe->drm,
> @@ -1783,12 +1789,6 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
>  		}
>  	}
>  
> -	if (flags & XE_VM_FLAG_FAULT_MODE) {
> -		err = xe_svm_init(vm);
> -		if (err)
> -			goto err_close;
> -	}
> -
>  	if (number_tiles > 1)
>  		vm->composite_fence_ctx = dma_fence_context_alloc(1);
>  
> @@ -1802,6 +1802,11 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
>  	xe_vm_close_and_put(vm);
>  	return ERR_PTR(err);
>  
> +err_svm_fini:
> +	if (flags & XE_VM_FLAG_FAULT_MODE) {
> +		vm->size = 0; /* close the vm */
> +		xe_svm_fini(vm);
> +	}
>  err_no_resv:
>  	mutex_destroy(&vm->snap_mutex);
>  	for_each_tile(tile, xe, id)
> -- 
> 2.49.0
> 

  reply	other threads:[~2025-05-15  0:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 15:24 [PATCH 1/2] drm/xe/vm: move rebind_work init earlier Matthew Auld
2025-05-14 15:24 ` [PATCH 2/2] drm/xe/vm: move xe_svm_init() earlier Matthew Auld
2025-05-15  0:08   ` Matthew Brost [this message]
2025-05-14 23:46 ` ✓ CI.Patch_applied: success for series starting with [1/2] drm/xe/vm: move rebind_work init earlier Patchwork
2025-05-14 23:46 ` ✓ CI.checkpatch: " Patchwork
2025-05-14 23:47 ` ✓ CI.KUnit: " Patchwork
2025-05-14 23:58 ` ✓ CI.Build: " Patchwork
2025-05-15  0:00 ` ✓ CI.Hooks: " Patchwork
2025-05-15  0:01 ` [PATCH 1/2] " Matthew Brost
2025-05-15  0:02 ` ✓ CI.checksparse: success for series starting with [1/2] " Patchwork
2025-05-15  0:24 ` ✓ Xe.CI.BAT: " Patchwork
2025-05-15  9:23 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-27  1:16 ` ✓ CI.Patch_applied: success " Patchwork
2025-05-27  1:16 ` ✓ CI.checkpatch: " Patchwork
2025-05-27  1:17 ` ✓ CI.KUnit: " Patchwork
2025-05-27  1:28 ` ✓ CI.Build: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aCUwfHsm5ssOV0KB@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox