public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>, intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com, himal.prasad.ghimiray@intel.com,
	 pallavi.mishra@intel.com
Subject: Re: [PATCH v6 11/12] drm/xe/madvise: Enable purgeable buffer object IOCTL support
Date: Tue, 10 Mar 2026 11:23:45 +0100	[thread overview]
Message-ID: <89cb34fc432fa0288e9ebf1e1338a817a31f00c7.camel@linux.intel.com> (raw)
In-Reply-To: <20260303152015.3499248-12-arvind.yadav@intel.com>

On Tue, 2026-03-03 at 20:50 +0530, Arvind Yadav wrote:
> Hook the madvise_purgeable() handler into the madvise IOCTL now that
> all
> supporting infrastructure is complete:
> 
>  - Core purge implementation (patch 3)
>  - BO state tracking and helpers (patches 1-2)
>  - Per-VMA purgeable state tracking (patch 6)
>  - Shrinker integration for memory reclamation (patch 10)
> 
> This final patch enables userspace to use the
> DRM_XE_VMA_ATTR_PURGEABLE_STATE
> madvise type to mark buffers as WILLNEED/DONTNEED and receive the
> retained
> status indicating whether buffers were purged.
> 
> The feature was kept disabled in earlier patches to maintain
> bisectability
> and ensure all components are in place before exposing to userspace.
> 
> Userspace can detect kernel support for purgeable BOs by checking the
> DRM_XE_QUERY_CONFIG_FLAG_HAS_PURGING_SUPPORT flag in the query_config
> response.
> 
> v6:
>   - Add DRM_XE_QUERY_CONFIG_FLAG_HAS_PURGING_SUPPORT for userspace
>     feature detection. (Jose)
> 
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Himal Prasad Ghimiray
> <himal.prasad.ghimiray@intel.com>
> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>

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

> ---
>  drivers/gpu/drm/xe/xe_query.c      |  2 ++
>  drivers/gpu/drm/xe/xe_vm_madvise.c | 22 +++++-----------------
>  2 files changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c
> b/drivers/gpu/drm/xe/xe_query.c
> index 34db266b723f..e535c77405b9 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -340,6 +340,8 @@ static int query_config(struct xe_device *xe,
> struct drm_xe_device_query *query)
>  			DRM_XE_QUERY_CONFIG_FLAG_HAS_NO_COMPRESSION_
> HINT;
>  	config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
>  			DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY;
> +	config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
> +			DRM_XE_QUERY_CONFIG_FLAG_HAS_PURGING_SUPPORT
> ;
>  	config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT] =
>  		xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K
> : SZ_4K;
>  	config->info[DRM_XE_QUERY_CONFIG_VA_BITS] = xe-
> >info.va_bits;
> diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c
> b/drivers/gpu/drm/xe/xe_vm_madvise.c
> index ab83e94980e4..746e9b7b47bb 100644
> --- a/drivers/gpu/drm/xe/xe_vm_madvise.c
> +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
> @@ -337,18 +337,11 @@ void xe_bo_recompute_purgeable_state(struct
> xe_bo *bo)
>   *
>   * Handles DONTNEED/WILLNEED/PURGED states. Tracks if any BO was
> purged
>   * in details->has_purged_bo for later copy to userspace.
> - *
> - * Note: Marked __maybe_unused until hooked into madvise_funcs[] in
> the
> - * final patch to maintain bisectability. The NULL placeholder in
> the
> - * array ensures proper -EINVAL return for userspace until all
> supporting
> - * infrastructure (shrinker, per-VMA tracking) is complete.
>   */
> -static void __maybe_unused madvise_purgeable(struct xe_device *xe,
> -					     struct xe_vm *vm,
> -					     struct xe_vma **vmas,
> -					     int num_vmas,
> -					     struct drm_xe_madvise
> *op,
> -					     struct
> xe_madvise_details *details)
> +static void madvise_purgeable(struct xe_device *xe, struct xe_vm
> *vm,
> +			      struct xe_vma **vmas, int num_vmas,
> +			      struct drm_xe_madvise *op,
> +			      struct xe_madvise_details *details)
>  {
>  	int i;
>  
> @@ -412,12 +405,7 @@ static const madvise_func madvise_funcs[] = {
>  	[DRM_XE_MEM_RANGE_ATTR_PREFERRED_LOC] =
> madvise_preferred_mem_loc,
>  	[DRM_XE_MEM_RANGE_ATTR_ATOMIC] = madvise_atomic,
>  	[DRM_XE_MEM_RANGE_ATTR_PAT] = madvise_pat_index,
> -	/*
> -	 * Purgeable support implemented but not enabled yet to
> maintain
> -	 * bisectability. Will be set to madvise_purgeable() in
> final patch
> -	 * when all infrastructure (shrinker, VMA tracking) is
> complete.
> -	 */
> -	[DRM_XE_VMA_ATTR_PURGEABLE_STATE] = NULL,
> +	[DRM_XE_VMA_ATTR_PURGEABLE_STATE] = madvise_purgeable,
>  };
>  
>  static u8 xe_zap_ptes_in_madvise_range(struct xe_vm *vm, u64 start,
> u64 end)

  reply	other threads:[~2026-03-10 10:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 15:19 [PATCH v6 00/12] drm/xe/madvise: Add support for purgeable buffer objects Arvind Yadav
2026-03-03 15:19 ` [PATCH v6 01/12] drm/xe/uapi: Add UAPI " Arvind Yadav
2026-03-03 15:53   ` Souza, Jose
2026-03-20  4:00     ` Yadav, Arvind
2026-03-10  8:31   ` Thomas Hellström
2026-03-03 15:19 ` [PATCH v6 02/12] drm/xe/bo: Add purgeable bo state tracking and field madv to xe_bo Arvind Yadav
2026-03-03 15:19 ` [PATCH v6 03/12] drm/xe/madvise: Implement purgeable buffer object support Arvind Yadav
2026-03-10  8:41   ` Thomas Hellström
2026-03-03 15:20 ` [PATCH v6 04/12] drm/xe/bo: Block CPU faults to purgeable buffer objects Arvind Yadav
2026-03-05 15:26   ` Thomas Hellström
2026-03-03 15:20 ` [PATCH v6 05/12] drm/xe/vm: Prevent binding of purged " Arvind Yadav
2026-03-05 15:38   ` Thomas Hellström
2026-03-20  2:34     ` Yadav, Arvind
2026-03-03 15:20 ` [PATCH v6 06/12] drm/xe/madvise: Implement per-VMA purgeable state tracking Arvind Yadav
2026-03-10  9:57   ` Thomas Hellström
2026-03-23  6:47     ` Yadav, Arvind
2026-03-03 15:20 ` [PATCH v6 07/12] drm/xe/madvise: Block imported and exported dma-bufs Arvind Yadav
2026-03-03 15:20 ` [PATCH v6 08/12] drm/xe/bo: Block mmap of DONTNEED/purged BOs Arvind Yadav
2026-03-10 10:17   ` Thomas Hellström
2026-03-18 13:03     ` Yadav, Arvind
2026-03-03 15:20 ` [PATCH v6 09/12] drm/xe/dma_buf: Block export " Arvind Yadav
2026-03-10 10:19   ` Thomas Hellström
2026-03-18 13:02     ` Yadav, Arvind
2026-03-03 15:20 ` [PATCH v6 10/12] drm/xe/bo: Add purgeable shrinker state helpers Arvind Yadav
2026-03-10 10:01   ` Thomas Hellström
2026-03-18 12:15     ` Yadav, Arvind
2026-03-03 15:20 ` [PATCH v6 11/12] drm/xe/madvise: Enable purgeable buffer object IOCTL support Arvind Yadav
2026-03-10 10:23   ` Thomas Hellström [this message]
2026-03-03 15:20 ` [PATCH v6 12/12] drm/xe/bo: Skip zero-refcount BOs in shrinker Arvind Yadav
2026-03-05 15:49   ` Thomas Hellström
2026-03-17  5:59     ` Yadav, Arvind
2026-03-03 16:12 ` ✗ CI.checkpatch: warning for drm/xe/madvise: Add support for purgeable buffer objects (rev7) Patchwork
2026-03-03 16:14 ` ✓ CI.KUnit: success " Patchwork
2026-03-03 16:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-03 22:05 ` [PATCH v6 00/12] drm/xe/madvise: Add support for purgeable buffer objects Souza, Jose
2026-03-03 22:49   ` Matthew Brost
2026-03-04 13:29     ` Souza, Jose
2026-03-23  6:37       ` Yadav, Arvind
2026-03-04  4:01 ` ✗ Xe.CI.FULL: failure for drm/xe/madvise: Add support for purgeable buffer objects (rev7) 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=89cb34fc432fa0288e9ebf1e1338a817a31f00c7.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=pallavi.mishra@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