Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: "Carlos Santa" <carlos.santa@intel.com>,
	"Ryan Neph" <ryanneph@google.com>,
	"Natalie Vock" <nat@pixelcluster.dev>,
	"Arun Pravin" <arunpravin.paneerselvam@amd.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH v6 31/35] drm/xe: Blit src-natural to dst-packed for defrag-IOVA copies
Date: Fri, 4 Dec 2026 15:39:39 +0000	[thread overview]
Message-ID: <af678830-976a-4233-83fe-3ed93d24f8f8@intel.com> (raw)
In-Reply-To: <20261203202352.4153159-32-matthew.brost@intel.com>

On 03/12/2026 20:23, Matthew Brost wrote:
> A defrag move with IOVA enabled only DMA-maps the changed (non-borrowed)
> pages of the new tt, packed contiguously into the front of its IOVA
> reservation (xe_tt_map_iova_copy()). The GPU copy therefore has an
> asymmetric geometry: the source is read from the old tt at its natural
> page offsets (via the old tt's full IOVA), while the destination only
> exposes the changed pages, packed.
> 
> Teach __xe_migrate_copy() about this packed-destination mode:
> 
> - Add a @dst_packed_pages argument. When non-zero the destination tt
>    cursor walks just that many packed pages and the source (not the
>    destination) drives the chunk size, so the smaller packed prefix never
>    clamps the source walk.
> 
> - Size the destination PTE update for each chunk from the changed-page
>    count (xe_migrate_count_changed_pages()) rather than the full chunk.
>    Leading borrowed pages of each chunk are skipped up front
>    (xe_migrate_leading_borrowed_pages()) so every emitted chunk starts
>    on a changed page and has a non-empty packed destination.
> 
> - Extend emit_copy_chunks() with a @pack_dst flag so each emitted run is
>    blitted from its natural source offset into a running packed
>    destination offset that only advances for changed runs, and with a
>    @ccs flag so the same runs can be emitted as indirect -> indirect CCS
>    aux copies.
> 
> Expose this via xe_migrate_copy_defrag_iova(). When the BO has flat-CCS
> state a second pass migrates the aux state of the changed runs through
> their (packed) data mappings with the compression PAT set. The aux
> state follows the physical page, and borrowed pages share the same
> physical page on both sides, so they are skipped in both passes.
> xe_migrate_copy_defrag() becomes a wrapper passing a zero packed page
> count, i.e. a fully mapped destination, and remains the path for the
> non-IOVA fallback.
> 
> No users yet; xe_bo_move() is wired to this path in a later patch.
> 
> v4:
>   - Remove some now dead code (Niranjana)
> 
> Cc: Carlos Santa <carlos.santa@intel.com>
> Cc: Ryan Neph <ryanneph@google.com>
> Cc: Natalie Vock <nat@pixelcluster.dev>
> Cc: Arun Pravin <arunpravin.paneerselvam@amd.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Simona Vetter <simona@ffwll.ch>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_migrate.c | 251 ++++++++++++++++++++++++++++----
>   drivers/gpu/drm/xe/xe_migrate.h |   8 +
>   2 files changed, 230 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 6f88aa210ec3..d6c6ef17d4d9 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -1228,6 +1228,64 @@ static void emit_copy(struct xe_gt *gt, struct xe_bb *bb,
>   		emit_xy_fast_copy(gt, bb, src_ofs, dst_ofs, size, pitch);
>   }
>   
> +/*
> + * xe_migrate_count_changed_pages() - Count non-borrowed pages in a defrag chunk.
> + * @src_tt: Source (old) tt providing the page pointers.
> + * @dst_tt: Destination (new) tt providing the page pointers.
> + * @start_page: Page offset of this L0 chunk within the tt page arrays.
> + * @npages: Number of pages in the L0 chunk.
> + *
> + * A defragmentation move may harvest already beneficial-order chunks from the
> + * old tt, so the new tt references (borrows) some of the same physical pages.
> + * Count the pages that actually differ (src page != dst page) within the chunk.
> + *
> + * Return: The number of non-borrowed (changed) pages.
> + */
> +static u32 xe_migrate_count_changed_pages(struct ttm_tt *src_tt,
> +					  struct ttm_tt *dst_tt,
> +					  pgoff_t start_page, u32 npages)
> +{
> +	u32 i, nchg = 0;
> +
> +	for (i = 0; i < npages; i++)
> +		if (src_tt->pages[start_page + i] !=
> +		    dst_tt->pages[start_page + i])
> +			nchg++;
> +
> +	return nchg;
> +}
> +
> +/*
> + * xe_migrate_leading_borrowed_pages() - Count the run of borrowed pages at the
> + * head of the remaining copy.
> + * @src_tt: Source (old) tt providing the page pointers.
> + * @dst_tt: Destination (new) tt providing the page pointers.
> + * @start_page: Page offset of the next page to copy within the tt page arrays.
> + * @max_pages: Pages left to copy.
> + *
> + * A defragmentation move borrows the already beneficial-order chunks from the
> + * old tt, so the new tt references (borrows) the same physical pages for the
> + * unchanged majority of a large object. Those pages alias on both the source
> + * and destination GPU mappings and need no copy. Count how many consecutive
> + * pages starting at @start_page are borrowed so the caller can advance past the
> + * whole run at once instead of rediscovering it one L0 chunk at a time.
> + *
> + * Return: The number of leading borrowed (src page == dst page) pages, capped
> + * at @max_pages.
> + */
> +static u32 xe_migrate_leading_borrowed_pages(struct ttm_tt *src_tt,
> +					     struct ttm_tt *dst_tt,
> +					     pgoff_t start_page, u32 max_pages)
> +{
> +	u32 n = 0;
> +
> +	while (n < max_pages &&
> +	       src_tt->pages[start_page + n] == dst_tt->pages[start_page + n])
> +		n++;
> +
> +	return n;
> +}
> +
>   /*
>    * emit_copy_chunks() - Emit the data blits for one defrag chunk, skipping
>    * borrowed pages.
> @@ -1239,6 +1297,11 @@ static void emit_copy(struct xe_gt *gt, struct xe_bb *bb,
>    * @src_tt: Source (old) tt providing the page pointers.
>    * @dst_tt: Destination (new) tt providing the page pointers.
>    * @start_page: Page offset of this chunk within the tt page arrays.
> + * @pack_dst: If true the destination only maps the changed pages packed
> + *	      contiguously, so the destination offset advances by changed-page
> + *	      runs instead of tracking the source page index.
> + * @ccs: If true emit indirect -> indirect CCS aux copies instead of data
> + *	 blits. Requires @pack_dst.
>    *
>    * A defragmentation move may harvest already beneficial-order chunks from the
>    * old tt, so the new tt references (borrows) some of the same physical pages.
> @@ -1247,16 +1310,27 @@ static void emit_copy(struct xe_gt *gt, struct xe_bb *bb,
>    * only blit runs of pages that actually differ (src page != dst page),
>    * coalescing contiguous to-copy pages into a single blit.
>    *
> - * Return: The number of blits emitted (or that would be emitted when @bb is
> + * When @pack_dst is set the source pages are read from their natural offsets
> + * (@src_ofs + page index) while the destination pages were packed into a
> + * contiguous prefix, so the destination offset is a running counter that only
> + * advances for emitted (changed) runs.
> + *
> + * When @ccs is set the same runs are used for the packed defrag CCS pass. The
> + * flat-CCS aux state is migrated indirectly through the data-page mappings, so
> + * it follows the physical page regardless of the (packed) GPU VA layout.
> + * Borrowed pages alias the same physical page on both sides, so their aux is
> + * already identical and is skipped as well.
> + *
> + * Return: The number of copies emitted (or that would be emitted when @bb is
>    * NULL).
>    */
>   static u32 emit_copy_chunks(struct xe_gt *gt, struct xe_bb *bb,
>   			    u64 src_ofs, u64 dst_ofs, u32 src_bytes,
>   			    struct ttm_tt *src_tt, struct ttm_tt *dst_tt,
> -			    pgoff_t start_page)
> +			    pgoff_t start_page, bool pack_dst, bool ccs)
>   {
>   	u32 npages = src_bytes >> PAGE_SHIFT;
> -	u32 i = 0, nblits = 0;
> +	u32 i = 0, pack = 0, nblits = 0;
>   
>   	while (i < npages) {
>   		u32 run = 0;
> @@ -1274,11 +1348,18 @@ static u32 emit_copy_chunks(struct xe_gt *gt, struct xe_bb *bb,
>   		       dst_tt->pages[start_page + i + run])
>   			run++;
>   
> -		if (bb)
> +		if (bb && ccs)
> +			emit_copy_ccs(gt, bb,
> +				      dst_ofs + (u64)pack * PAGE_SIZE, true,
> +				      src_ofs + (u64)i * PAGE_SIZE, true,
> +				      run * PAGE_SIZE);
> +		else if (bb)
>   			emit_copy(gt, bb, src_ofs + (u64)i * PAGE_SIZE,
> -				  dst_ofs + (u64)i * PAGE_SIZE,
> +				  dst_ofs +
> +				  (u64)(pack_dst ? pack : i) * PAGE_SIZE,
>   				  run * PAGE_SIZE, XE_PAGE_SIZE);
>   		nblits++;
> +		pack += run;
>   		i += run;
>   	}
>   
> @@ -1388,6 +1469,7 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   					   struct ttm_resource *src,
>   					   struct ttm_resource *dst,
>   					   struct ttm_tt *src_tt,
> +					   pgoff_t dst_packed_pages,
>   					   enum xe_migrate_copy_mode mode,
>   					   bool intr)
>   {
> @@ -1425,6 +1507,23 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   	 */
>   	struct ttm_tt *dst_tt = dst_bo->ttm.ttm;
>   	bool skip_borrowed = defrag_copy;
> +	/*
> +	 * Defrag-IOVA copy: the destination tt only maps the changed
> +	 * (non-borrowed) pages, packed contiguously into the first
> +	 * @dst_packed_pages pages of its IOVA. The source is read from the old
> +	 * tt at natural offsets and each changed run is blitted into the packed
> +	 * destination prefix.
> +	 */
> +	bool pack_dst = dst_packed_pages != 0;
> +	/*
> +	 * Packed defrag CCS pass: migrate the flat-CCS aux state of the changed
> +	 * pages only, from the source at its natural offset to the destination
> +	 * packed prefix. Borrowed pages share the physical page (and thus its
> +	 * aux) on both sides, so they are skipped exactly like the data pass.
> +	 */
> +	bool ccs_pack = defrag_ccs && pack_dst;
> +	/* Per-run, borrowed-skipping defrag emission (data or packed CCS). */
> +	bool defrag_runs = skip_borrowed || ccs_pack;
>   
>   	/*
>   	 * For decompression operation, always use the compression PAT index.
> @@ -1456,7 +1555,9 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   	else
>   		xe_res_first(src, 0, size, &src_it);
>   	if (!dst_is_vram && dst->mem_type != XE_PL_STOLEN)
> -		xe_res_first_tt(dst_bo->ttm.ttm, 0, size, &dst_it);
> +		xe_res_first_tt(dst_bo->ttm.ttm, 0,
> +				pack_dst ? (u64)dst_packed_pages << PAGE_SHIFT :
> +				size, &dst_it);
>   	else
>   		xe_res_first(dst, 0, size, &dst_it);
>   
> @@ -1477,29 +1578,84 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   		u32 pte_flags;
>   		pgoff_t start_page = (xe_bo_size(src_bo) - size) >> PAGE_SHIFT;
>   		u32 ndata_blits = 1;
> +		u32 nchg = 0;
> +		u64 dst_size;
>   
>   		bool usm = xe->info.has_usm;
>   		u32 avail_pts = max_mem_transfer_per_pass(xe) / LEVEL0_PAGE_TABLE_ENCODE_SIZE;

For the pure data copy pass there is no CCS involved so we maybe no need 
to cap this at 4M on lnl+ ?

For __xe_migrate_copy() wondering if it might make sense to split out 
the defrag stuff into its own function? __xe_migrate_copy() is even 
harder to follow now, with all the different flows in there.

Reviewed-by: Matthew Auld <matthew.auld@intel.com>

>   
> +		/*
> +		 * Defrag fast-forward: the new (destination) tt borrows the
> +		 * unchanged beneficial-order chunks from the old tt, so for a
> +		 * large object the bulk of the copy is borrowed pages that alias
> +		 * the same memory on both sides. Skip the entire leading
> +		 * borrowed run in a single cursor stride rather than discovering
> +		 * it one (8 MB) L0 chunk at a time - each such pass would
> +		 * otherwise pay xe_migrate_res_sizes() + pte_update_size() + a
> +		 * full chunk walk only to copy nothing. The non-vram tt cursors
> +		 * are normally advanced by emit_pte(); replicate that with
> +		 * xe_res_next(). In pack_dst mode the destination only maps the
> +		 * changed pages, so its cursor must not advance for borrowed
> +		 * pages.
> +		 */
> +		if (defrag_runs) {
> +			u32 brun = xe_migrate_leading_borrowed_pages(src_tt,
> +								     dst_tt,
> +								     start_page,
> +								     size >> PAGE_SHIFT);
> +
> +			if (brun) {
> +				u64 brun_bytes = (u64)brun << PAGE_SHIFT;
> +
> +				xe_res_next(&src_it, brun_bytes);
> +				if (!pack_dst)
> +					xe_res_next(&dst_it, brun_bytes);
> +				size -= brun_bytes;
> +				continue;
> +			}
> +		}
> +
>   		src_L0 = xe_migrate_res_sizes(m, &src_it);
>   		dst_L0 = xe_migrate_res_sizes(m, &dst_it);
>   
>   		drm_dbg(&xe->drm, "Pass %u, sizes: %llu & %llu\n",
>   			pass++, src_L0, dst_L0);
>   
> -		src_L0 = min(src_L0, dst_L0);
> +		/*
> +		 * In pack_dst mode the destination is the (smaller) packed
> +		 * prefix, so it must not clamp the source chunk size; the
> +		 * source drives the walk and the destination is sized
> +		 * independently from the changed-page count below.
> +		 */
> +		if (!pack_dst)
> +			src_L0 = min(src_L0, dst_L0);
>   
>   		pte_flags = src_is_vram ? PTE_UPDATE_FLAG_IS_VRAM : 0;
>   		pte_flags |= use_comp_pat ? PTE_UPDATE_FLAG_IS_COMP_PTE : 0;
>   		batch_size += pte_update_size(m, pte_flags, src, &src_it, &src_L0,
>   					      &src_L0_ofs, &src_L0_pt, 0, 0,
>   					      avail_pts);
> +		/*
> +		 * The source chunk size may have been clamped above, so derive
> +		 * the packed destination size from the changed-page count of
> +		 * the final chunk.
> +		 */
> +		if (pack_dst) {
> +			nchg = xe_migrate_count_changed_pages(src_tt, dst_tt,
> +							      start_page,
> +							      src_L0 >> PAGE_SHIFT);
> +			/* Leading borrowed pages were skipped above. */
> +			xe_assert(xe, nchg);
> +			dst_size = (u64)nchg << PAGE_SHIFT;
> +		} else {
> +			dst_size = src_L0;
> +		}
>   		if (copy_only_ccs) {
>   			dst_L0_ofs = src_L0_ofs;
>   		} else {
>   			pte_flags = dst_is_vram ? PTE_UPDATE_FLAG_IS_VRAM : 0;
>   			batch_size += pte_update_size(m, pte_flags, dst,
> -						      &dst_it, &src_L0,
> +						      &dst_it, &dst_size,
>   						      &dst_L0_ofs, &dst_L0_pt,
>   						      0, avail_pts, avail_pts);
>   		}
> @@ -1519,26 +1675,18 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   		 * is split into one command per run of non-borrowed pages, so
>   		 * size for the number of runs actually needed.
>   		 */
> -		if (skip_borrowed)
> +		if (defrag_runs) {
>   			ndata_blits = emit_copy_chunks(gt, NULL, 0, 0, src_L0,
> -						       src_tt, dst_tt, start_page);
> -
> -		/*
> -		 * If every page in this chunk was borrowed there is nothing to
> -		 * copy: don't build a batch or issue any GPU commands, just
> -		 * advance the cursors past the chunk. The non-vram tt cursors
> -		 * would otherwise be advanced by emit_pte().
> -		 */
> -		if (skip_borrowed && !ndata_blits) {
> -			xe_res_next(&src_it, src_L0);
> -			xe_res_next(&dst_it, src_L0);
> -			size -= src_L0;
> -			continue;
> +						       src_tt, dst_tt, start_page,
> +						       pack_dst, false);
> +			/* Leading borrowed pages were skipped above. */
> +			xe_assert(xe, ndata_blits);
>   		}
>   
>   		batch_size += ((copy_only_ccs || defrag_ccs) ? 0 :
>   			       ndata_blits * emit_copy_cmd_len(xe)) +
> -			((needs_ccs_emit ? EMIT_COPY_CCS_DW : 0));
> +			(ccs_pack ? ndata_blits * EMIT_COPY_CCS_DW :
> +			 (needs_ccs_emit ? EMIT_COPY_CCS_DW : 0));
>   
>   		bb = __xe_bb_new(gt, batch_size, usm, !fence && intr);
>   		if (IS_ERR(bb)) {
> @@ -1558,7 +1706,7 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   		else if (!copy_only_ccs)
>   			emit_pte(m, bb, dst_L0_pt, dst_is_vram,
>   				 copy_system_ccs || defrag_ccs,
> -				 &dst_it, src_L0, dst);
> +				 &dst_it, dst_size, dst);
>   
>   		if (copy_system_ccs)
>   			emit_pte(m, bb, ccs_pt, false, false, &ccs_it, ccs_size, src);
> @@ -1568,16 +1716,23 @@ static struct dma_fence *__xe_migrate_copy(struct xe_migrate *m,
>   
>   		if (skip_borrowed)
>   			emit_copy_chunks(gt, bb, src_L0_ofs, dst_L0_ofs, src_L0,
> -					 src_tt, dst_tt, start_page);
> +					 src_tt, dst_tt, start_page, pack_dst,
> +					 false);
>   		else if (!copy_only_ccs && !defrag_ccs)
>   			emit_copy(gt, bb, src_L0_ofs, dst_L0_ofs, src_L0, XE_PAGE_SIZE);
>   
> -		if (needs_ccs_emit)
> +		if (ccs_pack) {
> +			if (emit_copy_chunks(gt, bb, src_L0_ofs, dst_L0_ofs,
> +					     src_L0, src_tt, dst_tt,
> +					     start_page, true, true))
> +				flush_flags = MI_FLUSH_DW_CCS;
> +		} else if (needs_ccs_emit) {
>   			flush_flags = xe_migrate_ccs_copy(m, bb, src_L0_ofs,
>   							  IS_DGFX(xe) ? src_is_vram : src_is_pltt,
>   							  dst_L0_ofs,
>   							  IS_DGFX(xe) ? dst_is_vram : dst_is_pltt,
>   							  src_L0, ccs_ofs, copy_ccs);
> +		}
>   
>   		job = xe_bb_create_migration_job(m->q, bb,
>   						 xe_migrate_batch_base(m, usm),
> @@ -1679,7 +1834,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
>   				  bool copy_only_ccs,
>   				  bool intr)
>   {
> -	return __xe_migrate_copy(m, src_bo, dst_bo, src, dst, NULL,
> +	return __xe_migrate_copy(m, src_bo, dst_bo, src, dst, NULL, 0,
>   				 copy_only_ccs ? XE_MIGRATE_COPY_CCS_ONLY :
>   				 XE_MIGRATE_COPY_NORMAL, intr);
>   }
> @@ -1727,15 +1882,53 @@ struct dma_fence *xe_migrate_copy_defrag(struct xe_migrate *m,
>   					 struct ttm_resource *dst,
>   					 struct ttm_tt *src_tt,
>   					 bool need_ccs)
> +{
> +	return xe_migrate_copy_defrag_iova(m, bo, src, dst, src_tt, 0,
> +					   need_ccs);
> +}
> +
> +/**
> + * xe_migrate_copy_defrag_iova() - Copy a defrag move into a packed IOVA dst.
> + * @m: The migration context.
> + * @bo: The buffer object being defragmented.
> + * @src: The source (old) TTM resource.
> + * @dst: The destination (new) TTM resource.
> + * @src_tt: The stashed source (old) tt providing the page pointers, fully
> + *	    IOVA-mapped at natural offsets.
> + * @dst_packed_pages: Number of changed pages packed into the destination tt's
> + *	    IOVA prefix by xe_tt_map_iova_copy(), or 0 if the destination is fully
> + *	    mapped (see xe_migrate_copy_defrag()).
> + * @need_ccs: Whether the BO has flat-CCS aux state that must be migrated too.
> + *
> + * Defrag copy variant for IOVA-mapped BOs where the destination only maps the
> + * changed (non-borrowed) pages, packed contiguously into the first
> + * @dst_packed_pages of its IOVA. The source is read from the old tt at its
> + * natural offsets and each changed run is blitted into the packed destination
> + * prefix. When @need_ccs is set a second pass migrates the flat-CCS aux state
> + * of the same changed pages indirectly through their (packed) data mappings;
> + * borrowed pages share the physical page and its aux, so only the changed runs
> + * are touched.
> + *
> + * Return: Pointer to a dma_fence representing the last copy batch, or an error
> + * pointer on failure.
> + */
> +struct dma_fence *xe_migrate_copy_defrag_iova(struct xe_migrate *m,
> +					      struct xe_bo *bo,
> +					      struct ttm_resource *src,
> +					      struct ttm_resource *dst,
> +					      struct ttm_tt *src_tt,
> +					      pgoff_t dst_packed_pages,
> +					      bool need_ccs)
>   {
>   	struct dma_fence *fence2, *fence =
> -		__xe_migrate_copy(m, bo, bo, src, dst, src_tt,
> +		__xe_migrate_copy(m, bo, bo, src, dst, src_tt, dst_packed_pages,
>   				  XE_MIGRATE_COPY_DEFRAG_DATA, false);
>   
>   	if (IS_ERR(fence) || !need_ccs)
>   		return fence;
>   
>   	fence2 = __xe_migrate_copy(m, bo, bo, src, dst, src_tt,
> +				   dst_packed_pages,
>   				   XE_MIGRATE_COPY_DEFRAG_CCS, false);
>   	if (IS_ERR(fence2))
>   		dma_fence_wait(fence, false);
> @@ -1759,7 +1952,7 @@ struct dma_fence *xe_migrate_resolve(struct xe_migrate *m,
>   				     struct xe_bo *bo,
>   				     struct ttm_resource *res)
>   {
> -	return __xe_migrate_copy(m, bo, bo, res, res, NULL,
> +	return __xe_migrate_copy(m, bo, bo, res, res, NULL, 0,
>   				 XE_MIGRATE_COPY_VRAM_RESOLVE, true);
>   }
>   
> diff --git a/drivers/gpu/drm/xe/xe_migrate.h b/drivers/gpu/drm/xe/xe_migrate.h
> index c410652641f5..3a9e9276e699 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.h
> +++ b/drivers/gpu/drm/xe/xe_migrate.h
> @@ -68,6 +68,14 @@ struct dma_fence *xe_migrate_copy_defrag(struct xe_migrate *m,
>   					 struct ttm_tt *src_tt,
>   					 bool need_ccs);
>   
> +struct dma_fence *xe_migrate_copy_defrag_iova(struct xe_migrate *m,
> +					      struct xe_bo *bo,
> +					      struct ttm_resource *src,
> +					      struct ttm_resource *dst,
> +					      struct ttm_tt *src_tt,
> +					      pgoff_t dst_packed_pages,
> +					      bool need_ccs);
> +
>   struct dma_fence *xe_migrate_resolve(struct xe_migrate *m,
>   				     struct xe_bo *bo,
>   				     struct ttm_resource *res);


  reply	other threads:[~2026-12-04 15:40 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 20:23 [PATCH v6 00/35] drm/ttm, drm/xe: Avoid foreground high-order reclaim and defragment sub-optimally backed BOs Matthew Brost
2026-12-03 20:23 ` [PATCH v6 01/35] drm/ttm/pool: Allow backing off reclaim at the beneficial order Matthew Brost
2026-12-03 20:23 ` [PATCH v6 02/35] drm/ttm/pool: Add ttm_pool_page_order_nodma() helper Matthew Brost
2026-12-04 13:12   ` Natalie Vock
2026-12-04 17:36     ` Matthew Brost
2026-12-03 20:23 ` [PATCH v6 03/35] drm/ttm: Record sub-optimal page order allocations in ttm_tt Matthew Brost
2026-12-04 13:16   ` Natalie Vock
2026-12-03 20:23 ` [PATCH v6 04/35] drm/ttm: Introduce ttm_pool_alloc_iter for __ttm_pool_alloc() Matthew Brost
2026-12-04 13:39   ` Natalie Vock
2026-12-03 20:23 ` [PATCH v6 05/35] drm/ttm: Support defragmentation moves Matthew Brost
2026-12-04 14:04   ` Natalie Vock
2026-12-04 19:17     ` Matthew Brost
2026-12-03 20:23 ` [PATCH v6 06/35] drm/ttm: Add fault injection for beneficial-order allocation failures Matthew Brost
2026-12-03 20:23 ` [PATCH v6 07/35] drm/ttm/pool: Keep chunks self-aligned when resuming an interrupted restore Matthew Brost
2026-12-03 21:00   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 08/35] drm/ttm: Harvest beneficial-order pages on defragmentation moves Matthew Brost
2026-12-03 23:11   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 09/35] drm/ttm: Bound page (re)allocation per defragmentation move Matthew Brost
2026-12-03 20:23 ` [PATCH v6 10/35] drm/ttm: Preallocate beneficial-order defrag pages outside the lock Matthew Brost
2026-12-04  2:37   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 11/35] drm/ttm: Add full out-of-lock preallocation for ttm_pool_alloc() Matthew Brost
2026-12-04  3:39   ` Niranjana Vishwanathapura
2026-12-04  4:20     ` Matthew Brost
2026-12-03 20:23 ` [PATCH v6 12/35] drm/gpusvm: Add a DMA-mapping accounting callback Matthew Brost
2026-12-03 20:23 ` [PATCH v6 13/35] drm/xe: Add debugfs stats for DMA-mapped pages per order Matthew Brost
2026-12-03 20:23 ` [PATCH v6 14/35] drm/xe: Track BOs backed at a sub-optimal page order Matthew Brost
2026-12-04 20:00   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 15/35] drm/xe: Add xe_migrate_copy_defrag() for on-GPU defrag copies Matthew Brost
2026-12-03 20:23 ` [PATCH v6 16/35] drm/xe: Handle defrag moves in xe_bo_move() Matthew Brost
2026-12-04  4:54   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 17/35] drm/xe: Skip self-copies for borrowed pages on defrag moves Matthew Brost
2026-12-04 21:13   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 18/35] drm/xe: Add a page defragmentation worker Matthew Brost
2026-12-04 21:22   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 19/35] drm/xe: Add defrag GT stats Matthew Brost
2026-12-03 20:23 ` [PATCH v6 20/35] drm/xe: Add Kconfig.profile options for BO defrag configuration Matthew Brost
2026-12-03 20:23 ` [PATCH v6 21/35] drm/xe: Defrag using out-of-lock page preallocation Matthew Brost
2026-12-04 21:33   ` Niranjana Vishwanathapura
2026-12-03 20:23 ` [PATCH v6 22/35] drm/xe: Add defrag profiling tracepoints Matthew Brost
2026-12-03 20:23 ` [PATCH v6 23/35] drm/xe: Preallocate system BO backing outside the dma-resv lock Matthew Brost
2026-12-03 20:23 ` [PATCH v6 24/35] drm/xe: Add tracepoint for xe_gem_create_ioctl Matthew Brost
2026-12-03 20:23 ` [PATCH v6 25/35] drm/xe: Add IOVA-based xe_res_cursor variant Matthew Brost
2026-12-03 20:23 ` [PATCH v6 26/35] drm/xe: Don't DMA map tt pages after device unplug Matthew Brost
2026-12-04 12:21   ` Matthew Auld
2026-12-03 20:23 ` [PATCH v6 27/35] drm/xe: Lock the bo in xe_bo_dma_unmap_pinned() Matthew Brost
2026-12-03 20:23 ` [PATCH v6 28/35] drm/xe: Use IOVA-based DMA mapping for eligible tt BOs Matthew Brost
2026-12-04 11:57   ` Matthew Auld
2026-12-03 20:23 ` [PATCH v6 29/35] drm/xe: Add per-device dependency scheduler for IOVA defrag finalize Matthew Brost
2026-12-03 20:23 ` [PATCH v6 30/35] drm/xe: Add packed copy-step IOVA mapping for defrag Matthew Brost
2026-12-03 20:23 ` [PATCH v6 31/35] drm/xe: Blit src-natural to dst-packed for defrag-IOVA copies Matthew Brost
2026-12-04 15:39   ` Matthew Auld [this message]
2026-12-03 20:23 ` [PATCH v6 32/35] drm/xe: Finalize defrag-IOVA moves with post-copy job Matthew Brost
2026-12-03 20:23 ` [PATCH v6 33/35] drm/xe: Grow the USM batch pool to 2M and map it via a single PDE Matthew Brost
2026-12-03 20:23 ` [PATCH v6 34/35] drm/xe: Add bo_defrag debugfs entry Matthew Brost
2026-12-03 20:23 ` [PATCH v6 35/35] drm/xe: Make BO defrag tunables configurable via sysfs Matthew Brost
2026-12-03 21:02 ` ✓ CI.KUnit: success for drm/ttm, drm/xe: Avoid foreground high-order reclaim and defragment sub-optimally backed BOs (rev3) Patchwork
2026-12-03 21:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-12-04 21:42 ` ✗ 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=af678830-976a-4233-83fe-3ed93d24f8f8@intel.com \
    --to=matthew.auld@intel.com \
    --cc=airlied@gmail.com \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=carlos.santa@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=nat@pixelcluster.dev \
    --cc=ryanneph@google.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /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