All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: <matthew.brost@intel.com>, <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v2] drm/xe/madvise: Skip invalidation for purgeable state updates
Date: Tue, 9 Jun 2026 15:58:34 +0530	[thread overview]
Message-ID: <9f9ce7e0-e5ab-42d9-84dd-e2e33eae5b8a@intel.com> (raw)
In-Reply-To: <20260526135447.2973029-1-arvind.yadav@intel.com>



On 26-05-2026 19:24, Arvind Yadav wrote:
> Purgeable state updates only change VMA/BO metadata. They do not zap
> PTEs when switching between DONTNEED and WILLNEED. PTEs are zapped
> later if the BO is actually purged.
> 
> xe_vm_invalidate_madvise_range() waits on the VM dma-resv before checking
> vma->skip_invalidation. Since purgeable madvise marks all affected VMAs to
> skip invalidation, this wait is unnecessary and can stall on unrelated
> in-flight work.
> 
> Skip the invalidate path entirely for purgeable state updates.
> 
> v2:
>    - Replace inline 'args->type != DRM_XE_VMA_ATTR_PURGEABLE_STATE'
>      check with a small helper madvise_range_needs_invalidation().
>      (Himal)
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>


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


> ---
>   drivers/gpu/drm/xe/xe_vm_madvise.c | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
> index c4fb29004195..9e343f9aa44d 100644
> --- a/drivers/gpu/drm/xe/xe_vm_madvise.c
> +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
> @@ -332,6 +332,20 @@ static int xe_vm_invalidate_madvise_range(struct xe_vm *vm, u64 start, u64 end)
>   	return err;
>   }
>   
> +/**
> + * madvise_range_needs_invalidation() - Check whether madvise needs invalidation
> + * @args: madvise ioctl arguments
> + *
> + * Purgeable state updates only touch VMA/BO metadata. PTEs stay valid and are
> + * zapped only if the BO is later purged.
> + *
> + * Return: true when the update needs PTE invalidation.
> + */
> +static bool madvise_range_needs_invalidation(const struct drm_xe_madvise *args)
> +{
> +	return args->type != DRM_XE_VMA_ATTR_PURGEABLE_STATE;
> +}
> +
>   static bool madvise_args_are_sane(struct xe_device *xe, const struct drm_xe_madvise *args)
>   {
>   	if (XE_IOCTL_DBG(xe, !args))
> @@ -708,8 +722,9 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
>   	madvise_funcs[attr_type](xe, vm, madvise_range.vmas, madvise_range.num_vmas, args,
>   				 &details);
>   
> -	err = xe_vm_invalidate_madvise_range(vm, madvise_range.addr,
> -					     madvise_range.addr + args->range);
> +	if (madvise_range_needs_invalidation(args))
> +		err = xe_vm_invalidate_madvise_range(vm, madvise_range.addr,
> +						     madvise_range.addr + args->range);
>   
>   	if (madvise_range.has_svm_userptr_vmas)
>   		xe_svm_notifier_unlock(vm);


      parent reply	other threads:[~2026-06-09 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 13:54 [PATCH v2] drm/xe/madvise: Skip invalidation for purgeable state updates Arvind Yadav
2026-05-26 14:23 ` ✓ CI.KUnit: success for drm/xe/madvise: Skip invalidation for purgeable state updates (rev2) Patchwork
2026-05-26 15:00 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-26 17:38 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-06-09 10:28 ` Ghimiray, Himal Prasad [this message]

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=9f9ce7e0-e5ab-42d9-84dd-e2e33eae5b8a@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=thomas.hellstrom@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.