Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: intel-xe@lists.freedesktop.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH 3/4] drm/xe/svm: Extend MAP range to reduce vma fragmentation
Date: Tue, 23 Sep 2025 19:21:45 -0700	[thread overview]
Message-ID: <aNNVuWBKBTXpmZ0Y@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250922104316.263995-4-himal.prasad.ghimiray@intel.com>

On Mon, Sep 22, 2025 at 04:13:15PM +0530, Himal Prasad Ghimiray wrote:
> When DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR is set during VM_BIND_OP_MAP,
> the mapping logic now checks adjacent cpu_addr_mirror VMAs with default
> attributes and expands the mapping range accordingly. This ensures that
> `bo_unmap` operations ideally target the same area and helps reduce
> fragmentation by coalescing nearby compatible VMAs into a single mapping.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>

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

> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_vm.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 246bff91fa43..198130f71e0f 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2213,6 +2213,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
>  	struct drm_gpuva_ops *ops;
>  	struct drm_gpuva_op *__op;
>  	struct drm_gpuvm_bo *vm_bo;
> +	u64 range_start = addr;
>  	u64 range_end = addr + range;
>  	int err;
>  
> @@ -2225,10 +2226,14 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_vma_ops *vops,
>  
>  	switch (operation) {
>  	case DRM_XE_VM_BIND_OP_MAP:
> +		if (flags & DRM_XE_VM_BIND_FLAG_CPU_ADDR_MIRROR)
> +			xe_vm_find_cpu_addr_mirror_vma_range(vm, &range_start, &range_end);
> +
> +		fallthrough;
>  	case DRM_XE_VM_BIND_OP_MAP_USERPTR: {
>  		struct drm_gpuvm_map_req map_req = {
> -			.map.va.addr = addr,
> -			.map.va.range = range,
> +			.map.va.addr = range_start,
> +			.map.va.range = range_end - range_start,
>  			.map.gem.obj = obj,
>  			.map.gem.offset = bo_offset_or_userptr,
>  		};
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-09-24  2:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 10:43 [PATCH 0/4] Improve VMA merging for CPU-address-mirrored mappings Himal Prasad Ghimiray
2025-09-22 10:43 ` [PATCH 1/4] drm/xe: Add helper to extend CPU-mirrored VMA range for merge Himal Prasad Ghimiray
2025-09-24  2:20   ` Matthew Brost
2025-09-22 10:43 ` [PATCH 2/4] drm/xe: Merge adjacent default-attribute VMAs during garbage collection Himal Prasad Ghimiray
2025-09-22 10:43 ` [PATCH 3/4] drm/xe/svm: Extend MAP range to reduce vma fragmentation Himal Prasad Ghimiray
2025-09-24  2:21   ` Matthew Brost [this message]
2025-09-22 10:43 ` [PATCH 4/4] drm/xe/svm: Enable UNMAP for VMA merging operations Himal Prasad Ghimiray
2025-09-22 11:08 ` ✓ CI.KUnit: success for Improve VMA merging for CPU-address-mirrored mappings Patchwork
2025-09-22 12:31 ` Patchwork
2025-09-22 14:22 ` ✗ Xe.CI.Full: failure " 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=aNNVuWBKBTXpmZ0Y@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox