From: Matthew Brost <matthew.brost@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v6 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem()
Date: Wed, 30 Apr 2025 07:50:06 -0700 [thread overview]
Message-ID: <aBI4nl6mNcXxMsQ6@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250430121912.337601-17-himal.prasad.ghimiray@intel.com>
On Wed, Apr 30, 2025 at 05:49:08PM +0530, Himal Prasad Ghimiray wrote:
> The xe_svm_range_validate() function checks if a range is
> valid and located in the desired memory region.
>
> xe_svm_range_migrate_to_smem() checks if range have pages in devmem and
> migrate them to smem.
>
> v2
> - Fix function stub in xe_svm.h
> - Fix doc
>
> v3 (Matthew Brost)
> - Remove extra new line
> - s/range->base.flags.has_devmem_pages/xe_svm_range_in_vram
>
> v4 (Matthew Brost)
> - s/xe_svm_range_in_vram/range->base.flags.has_devmem_pages
> - Move eviction logic to separate function
>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_svm.c | 41 +++++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_svm.h | 19 +++++++++++++++++
> 2 files changed, 60 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index cb4a849c018b..fff3a279e232 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -643,6 +643,47 @@ static bool xe_svm_range_is_valid(struct xe_svm_range *range,
> (!devmem_only || xe_svm_range_in_vram(range));
> }
>
> +/** xe_svm_range_migrate_to_smem() - Move range pages from VRAM to SMEM
> + * @vm: xe_vm pointer
> + * @range: Pointer to the SVM range structure
> + *
> + * The xe_svm_range_migrate_to_smem() checks range has pages in VRAM
> + * and migrates them to SMEM
> + */
> +void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range)
> +{
> + if (xe_svm_range_in_vram(range))
> + drm_gpusvm_range_evict(&vm->svm.gpusvm, &range->base);
> +}
> +
> +/**
> + * xe_svm_range_validate() - Check if the SVM range is valid
> + * @vm: xe_vm pointer
> + * @range: Pointer to the SVM range structure
> + * @tile_mask: Mask representing the tiles to be checked
> + * @devmem_preferred : if true range needs to be in devmem
> + *
> + * The xe_svm_range_validate() function checks if a range is
> + * valid and located in the desired memory region.
> + *
> + * Return: true if the range is valid, false otherwise
> + */
> +bool xe_svm_range_validate(struct xe_vm *vm,
> + struct xe_svm_range *range,
> + u8 tile_mask, bool devmem_preferred)
> +{
> + bool ret;
> +
> + xe_svm_notifier_lock(vm);
> +
> + ret = (range->tile_present & ~range->tile_invalidated & tile_mask) == tile_mask &&
> + (devmem_preferred == range->base.flags.has_devmem_pages);
> +
> + xe_svm_notifier_unlock(vm);
> +
> + return ret;
> +}
> +
> #if IS_ENABLED(CONFIG_DRM_XE_DEVMEM_MIRROR)
> static struct xe_vram_region *tile_to_vr(struct xe_tile *tile)
> {
> diff --git a/drivers/gpu/drm/xe/xe_svm.h b/drivers/gpu/drm/xe/xe_svm.h
> index 9be7bb25725c..3f8c82f9c363 100644
> --- a/drivers/gpu/drm/xe/xe_svm.h
> +++ b/drivers/gpu/drm/xe/xe_svm.h
> @@ -83,6 +83,12 @@ int xe_svm_range_get_pages(struct xe_vm *vm, struct xe_svm_range *range,
> bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vma *vma,
> bool preferred_region_is_vram);
>
> +void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range);
> +
> +bool xe_svm_range_validate(struct xe_vm *vm,
> + struct xe_svm_range *range,
> + u8 tile_mask, bool devmem_preferred);
> +
> /**
> * xe_svm_range_has_dma_mapping() - SVM range has DMA mapping
> * @range: SVM range
> @@ -276,6 +282,19 @@ bool xe_svm_range_needs_migrate_to_vram(struct xe_svm_range *range, struct xe_vm
> return false;
> }
>
> +static inline
> +void xe_svm_range_migrate_to_smem(struct xe_vm *vm, struct xe_svm_range *range)
> +{
> +}
> +
> +static inline
> +bool xe_svm_range_validate(struct xe_vm *vm,
> + struct xe_svm_range *range,
> + u8 tile_mask, bool devmem_preferred)
> +{
> + return false;
> +}
> +
> #define xe_svm_assert_in_notifier(...) do {} while (0)
> #define xe_svm_range_has_dma_mapping(...) false
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-04-30 14:48 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 12:18 [PATCH v6 00/20] Prefetch Support for svm ranges Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 01/20] drm/gpusvm: Introduce devmem_only flag for allocation Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 02/20] drm/xe: Strict migration policy for atomic SVM faults Himal Prasad Ghimiray
2025-05-05 15:20 ` Thomas Hellström
2025-05-05 20:18 ` Matthew Brost
2025-05-06 10:13 ` Thomas Hellström
2025-05-06 14:59 ` Matthew Brost
2025-04-30 12:18 ` [PATCH v6 03/20] drm/gpusvm: Add timeslicing support to GPU SVM Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 04/20] drm/xe: Timeslice GPU on atomic SVM fault Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 05/20] drm/xe: Add atomic_svm_timeslice_ms debugfs entry Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 06/20] drm/xe: Introduce xe_vma_op_prefetch_range struct for prefetch of ranges Himal Prasad Ghimiray
2025-04-30 12:18 ` [PATCH v6 07/20] drm/xe: Make xe_svm_alloc_vram public Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 08/20] drm/xe/svm: Helper to add tile masks to svm ranges Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 09/20] drm/xe/svm: Make to_xe_range a public function Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 10/20] drm/xe/svm: Make xe_svm_range_* end/start/size public Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 11/20] drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 12/20] drm/xe/vm: Add an identifier in xe_vma_ops for svm prefetch Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 13/20] drm/xe: Rename lookup_vma function to xe_find_vma_by_addr Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 14/20] drm/xe/svm: Refactor usage of drm_gpusvm* function in xe_svm Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 15/20] drm/xe/svm: Make xe_svm_range_needs_migrate_to_vram() public Himal Prasad Ghimiray
2025-04-30 12:19 ` [PATCH v6 16/20] drm/xe/svm: Add xe_svm_range_validate() and xe_svm_range_migrate_to_smem() Himal Prasad Ghimiray
2025-04-30 14:50 ` Matthew Brost [this message]
2025-04-30 12:19 ` [PATCH v6 17/20] drm/gpusvm: Introduce drm_gpusvm_find_vma_start() function Himal Prasad Ghimiray
2025-04-30 15:03 ` Matthew Brost
2025-04-30 12:19 ` [PATCH v6 18/20] drm/xe/svm: Add xe_svm_find_vma_start() helper Himal Prasad Ghimiray
2025-04-30 16:35 ` Matthew Brost
2025-04-30 12:19 ` [PATCH v6 19/20] drm/xe/svm: Implement prefetch support for SVM ranges Himal Prasad Ghimiray
2025-05-02 13:42 ` Thomas Hellström
2025-05-02 14:35 ` Ghimiray, Himal Prasad
2025-05-02 14:39 ` Thomas Hellström
2025-05-02 16:11 ` Ghimiray, Himal Prasad
2025-05-07 11:39 ` Thomas Hellström
2025-05-12 12:48 ` Matthew Brost
2025-05-12 12:56 ` Ghimiray, Himal Prasad
2025-04-30 12:19 ` [PATCH v6 20/20] drm/xe/vm: Add debug prints for SVM range prefetch Himal Prasad Ghimiray
2025-04-30 12:45 ` ✓ CI.Patch_applied: success for Prefetch Support for svm ranges (rev5) Patchwork
2025-04-30 12:45 ` ✓ CI.checkpatch: " Patchwork
2025-04-30 12:46 ` ✓ CI.KUnit: " Patchwork
2025-04-30 13:06 ` ✓ CI.Build: " Patchwork
2025-04-30 13:08 ` ✓ CI.Hooks: " Patchwork
2025-04-30 13:10 ` ✓ CI.checksparse: " Patchwork
2025-04-30 20:06 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-06 7:55 ` ✓ Xe.CI.BAT: success " 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=aBI4nl6mNcXxMsQ6@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--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.