All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH 5/6] drm/xe/migrate: plumb interruptible wait flag to clear and copy
Date: Fri, 30 Oct 2026 16:28:32 +0100	[thread overview]
Message-ID: <60bbc8e80a642d8b1f5d42a9e2a14209f5e5124f.camel@linux.intel.com> (raw)
In-Reply-To: <20261030-migrate-bb-optimise-v1-5-b8d01649cfe9@intel.com>

On Fri, 2026-10-30 at 11:49 +0000, Matthew Auld wrote:
> Plumb a bool intr parameter into xe_migrate_clear() and
> xe_migrate_copy() and pass it to __xe_bb_new(), forwarding
> ctx->interruptible from xe_bo_move() and false from non-interruptible
> kernel callers so suballocator waits respect the caller's context.
> 
> Assisted-by: LLM
> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9644
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>

Should this and the previous one have a -fixes?

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

> ---
>  drivers/gpu/drm/xe/tests/xe_bo.c           |  2 +-
>  drivers/gpu/drm/xe/tests/xe_migrate.c      | 12 ++++++------
>  drivers/gpu/drm/xe/xe_bo.c                 |  9 +++++----
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c |  3 ++-
>  drivers/gpu/drm/xe/xe_migrate.c            | 19 ++++++++++++-------
>  drivers/gpu/drm/xe/xe_migrate.h            |  6 ++++--
>  drivers/gpu/drm/xe/xe_vram.c               |  2 +-
>  7 files changed, 31 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c
> b/drivers/gpu/drm/xe/tests/xe_bo.c
> index 6a17e13d58cf..22a2e8f8143a 100644
> --- a/drivers/gpu/drm/xe/tests/xe_bo.c
> +++ b/drivers/gpu/drm/xe/tests/xe_bo.c
> @@ -270,7 +270,7 @@ static int ccs_test_migrate(struct xe_tile *tile,
> struct xe_bo *bo,
>  	/* Optionally clear bo *and* CCS data in VRAM. */
>  	if (clear) {
>  		fence = xe_migrate_clear(tile->migrate, bo, bo-
> >ttm.resource,
> -					
> XE_MIGRATE_CLEAR_FLAG_FULL);
> +					 XE_MIGRATE_CLEAR_FLAG_FULL,
> false);
>  		if (IS_ERR(fence)) {
>  			KUNIT_FAIL(test, "Failed to submit bo
> clear.\n");
>  			return PTR_ERR(fence);
> diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c
> b/drivers/gpu/drm/xe/tests/xe_migrate.c
> index a9ef8f2dcebb..162532412426 100644
> --- a/drivers/gpu/drm/xe/tests/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
> @@ -112,7 +112,7 @@ static void test_copy(struct xe_migrate *m,
> struct xe_bo *bo,
>  
>  	xe_map_memset(xe, &remote->vmap, 0, 0xd0,
> xe_bo_size(remote));
>  	fence = xe_migrate_clear(m, remote, remote->ttm.resource,
> -				 XE_MIGRATE_CLEAR_FLAG_FULL);
> +				 XE_MIGRATE_CLEAR_FLAG_FULL, false);
>  	if (!sanity_fence_failed(xe, fence, big ? "Clearing remote
> big bo" :
>  				 "Clearing remote small bo", test))
> {
>  		retval = xe_map_rd(xe, &remote->vmap, 0, u64);
> @@ -130,7 +130,7 @@ static void test_copy(struct xe_migrate *m,
> struct xe_bo *bo,
>  
>  	expected = 0xc0c0c0c0c0c0c0c0;
>  	fence = xe_migrate_copy(m, remote, bo, remote->ttm.resource,
> -				bo->ttm.resource, false);
> +				bo->ttm.resource, false, false);
>  	if (!sanity_fence_failed(xe, fence, big ? "Copying big bo
> remote -> vram" :
>  				 "Copying small bo remote -> vram",
> test)) {
>  		retval = xe_map_rd(xe, &bo->vmap, 0, u64);
> @@ -147,7 +147,7 @@ static void test_copy(struct xe_migrate *m,
> struct xe_bo *bo,
>  	xe_map_memset(xe, &bo->vmap, 0, 0xc0, xe_bo_size(bo));
>  
>  	fence = xe_migrate_copy(m, bo, remote, bo->ttm.resource,
> -				remote->ttm.resource, false);
> +				remote->ttm.resource, false, false);
>  	if (!sanity_fence_failed(xe, fence, big ? "Copying big bo
> vram -> remote" :
>  				 "Copying small bo vram -> remote",
> test)) {
>  		retval = xe_map_rd(xe, &remote->vmap, 0, u64);
> @@ -287,7 +287,7 @@ static void xe_migrate_sanity_test(struct
> xe_migrate *m, struct kunit *test,
>  	xe_map_memset(xe, &tiny->vmap, 0, 0x22, xe_bo_size(tiny));
>  	expected = 0;
>  	fence = xe_migrate_clear(m, tiny, tiny->ttm.resource,
> -				 XE_MIGRATE_CLEAR_FLAG_FULL);
> +				 XE_MIGRATE_CLEAR_FLAG_FULL, false);
>  	if (sanity_fence_failed(xe, fence, "Clearing small bo",
> test))
>  		goto out;
>  
> @@ -309,7 +309,7 @@ static void xe_migrate_sanity_test(struct
> xe_migrate *m, struct kunit *test,
>  	xe_map_memset(xe, &big->vmap, 0, 0x11, xe_bo_size(big));
>  	expected = 0;
>  	fence = xe_migrate_clear(m, big, big->ttm.resource,
> -				 XE_MIGRATE_CLEAR_FLAG_FULL);
> +				 XE_MIGRATE_CLEAR_FLAG_FULL, false);
>  	if (sanity_fence_failed(xe, fence, "Clearing big bo", test))
>  		goto out;
>  
> @@ -611,7 +611,7 @@ static void test_clear(struct xe_device *xe,
> struct xe_tile *tile,
>  	kunit_info(test, "Clear vram buffer object\n");
>  	expected = 0x0000000000000000;
>  	fence = xe_migrate_clear(tile->migrate, vram_bo, vram_bo-
> >ttm.resource,
> -				 XE_MIGRATE_CLEAR_FLAG_FULL);
> +				 XE_MIGRATE_CLEAR_FLAG_FULL, false);
>  	if (sanity_fence_failed(xe, fence, "Clear vram_bo", test))
>  		return;
>  	dma_fence_put(fence);
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 42a6aa1a2e4a..e01143c0ccd7 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -1298,10 +1298,11 @@ static int xe_bo_move(struct
> ttm_buffer_object *ttm_bo, bool evict,
>  		else if (handle_system_ccs)
>  			flags |= XE_MIGRATE_CLEAR_FLAG_CCS_DATA;
>  
> -		fence = xe_migrate_clear(migrate, bo, new_mem,
> flags);
> +		fence = xe_migrate_clear(migrate, bo, new_mem,
> flags,
> +					 ctx->interruptible);
>  	} else {
>  		fence = xe_migrate_copy(migrate, bo, bo, old_mem,
> new_mem,
> -					handle_system_ccs);
> +					handle_system_ccs, ctx-
> >interruptible);
>  	}
>  	if (IS_ERR(fence)) {
>  		ret = PTR_ERR(fence);
> @@ -1594,7 +1595,7 @@ static int xe_bo_evict_pinned_copy(struct xe_bo
> *bo, struct xe_bo *backup)
>  			goto out_backup;
>  
>  		fence = xe_migrate_copy(migrate, bo, backup, bo-
> >ttm.resource,
> -					backup->ttm.resource,
> false);
> +					backup->ttm.resource, false,
> false);
>  		if (IS_ERR(fence)) {
>  			ret = PTR_ERR(fence);
>  			goto out_backup;
> @@ -1744,7 +1745,7 @@ int xe_bo_restore_pinned(struct xe_bo *bo)
>  
>  		fence = xe_migrate_copy(migrate, backup, bo,
>  					backup->ttm.resource, bo-
> >ttm.resource,
> -					false);
> +					false, ctx.interruptible);
>  		if (IS_ERR(fence)) {
>  			ret = PTR_ERR(fence);
>  			goto out_unlock_bo;
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index 0a47458e5bf2..c410a8e86cd9 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -3019,7 +3019,8 @@ static int pf_sanitize_lmem(struct xe_tile
> *tile, struct xe_bo *bo, long timeout
>  		return 0;
>  
>  	xe_bo_lock(bo, false);
> -	fence = xe_migrate_clear(m, bo, bo->ttm.resource,
> XE_MIGRATE_CLEAR_FLAG_FULL);
> +	fence = xe_migrate_clear(m, bo, bo->ttm.resource,
> +				 XE_MIGRATE_CLEAR_FLAG_FULL, false);
>  	if (IS_ERR(fence)) {
>  		err = PTR_ERR(fence);
>  	} else if (!fence) {
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c
> b/drivers/gpu/drm/xe/xe_migrate.c
> index 1a216fb12d2b..dd326bcd12b1 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -1213,7 +1213,8 @@ static struct dma_fence
> *__xe_migrate_copy(struct xe_migrate *m,
>  					   struct ttm_resource *src,
>  					   struct ttm_resource *dst,
>  					   bool copy_only_ccs,
> -					   bool is_vram_resolve)
> +					   bool is_vram_resolve,
> +					   bool intr)
>  {
>  	struct xe_gt *gt = m->tile->primary_gt;
>  	struct xe_device *xe = gt_to_xe(gt);
> @@ -1315,7 +1316,7 @@ static struct dma_fence
> *__xe_migrate_copy(struct xe_migrate *m,
>  		batch_size += ((copy_only_ccs) ? 0 :
> emit_copy_cmd_len(xe)) +
>  			((needs_ccs_emit ? EMIT_COPY_CCS_DW : 0));
>  
> -		bb = xe_bb_new(gt, batch_size, usm);
> +		bb = __xe_bb_new(gt, batch_size, usm, intr);
>  		if (IS_ERR(bb)) {
>  			err = PTR_ERR(bb);
>  			goto err_sync;
> @@ -1409,6 +1410,7 @@ static struct dma_fence
> *__xe_migrate_copy(struct xe_migrate *m,
>   * @src: The source TTM resource.
>   * @dst: The dst TTM resource.
>   * @copy_only_ccs: If true copy only CCS metadata
> + * @intr: Whether to perform any wait interruptibly
>   *
>   * Copies the contents of @src to @dst: On flat CCS devices,
>   * the CCS metadata is copied as well if needed, or if not present,
> @@ -1423,9 +1425,10 @@ struct dma_fence *xe_migrate_copy(struct
> xe_migrate *m,
>  				  struct xe_bo *dst_bo,
>  				  struct ttm_resource *src,
>  				  struct ttm_resource *dst,
> -				  bool copy_only_ccs)
> +				  bool copy_only_ccs,
> +				  bool intr)
>  {
> -	return __xe_migrate_copy(m, src_bo, dst_bo, src, dst,
> copy_only_ccs, false);
> +	return __xe_migrate_copy(m, src_bo, dst_bo, src, dst,
> copy_only_ccs, false, intr);
>  }
>  
>  /**
> @@ -1443,7 +1446,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, false, true);
> +	return __xe_migrate_copy(m, bo, bo, res, res, false, true,
> true);
>  }
>  
>  /**
> @@ -1913,6 +1916,7 @@ static void emit_clear(struct xe_gt *gt, struct
> xe_bb *bb, u64 src_ofs,
>   * @bo: The buffer object @dst is currently bound to.
>   * @dst: The dst TTM resource to be cleared.
>   * @clear_flags: flags to specify which data to clear: CCS, BO, or
> both.
> + * @intr: Whether to perform any wait interruptibly.
>   *
>   * Clear the contents of @dst to zero when
> XE_MIGRATE_CLEAR_FLAG_BO_DATA is set.
>   * On flat CCS devices, the CCS metadata is cleared to zero with
> XE_MIGRATE_CLEAR_FLAG_CCS_DATA.
> @@ -1926,7 +1930,8 @@ static void emit_clear(struct xe_gt *gt, struct
> xe_bb *bb, u64 src_ofs,
>  struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
>  				   struct xe_bo *bo,
>  				   struct ttm_resource *dst,
> -				   u32 clear_flags)
> +				   u32 clear_flags,
> +				   bool intr)
>  {
>  	bool clear_vram = mem_type_is_vram(dst->mem_type);
>  	bool clear_bo_data = XE_MIGRATE_CLEAR_FLAG_BO_DATA &
> clear_flags;
> @@ -1987,7 +1992,7 @@ struct dma_fence *xe_migrate_clear(struct
> xe_migrate *m,
>  		if (WARN_ON_ONCE(!clear_L0))
>  			break;
>  
> -		bb = xe_bb_new(gt, batch_size, usm);
> +		bb = __xe_bb_new(gt, batch_size, usm, intr);
>  		if (IS_ERR(bb)) {
>  			err = PTR_ERR(bb);
>  			goto err_sync;
> diff --git a/drivers/gpu/drm/xe/xe_migrate.h
> b/drivers/gpu/drm/xe/xe_migrate.h
> index 2e8be10fdb71..30fb236ea520 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.h
> +++ b/drivers/gpu/drm/xe/xe_migrate.h
> @@ -54,7 +54,8 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate
> *m,
>  				  struct xe_bo *dst_bo,
>  				  struct ttm_resource *src,
>  				  struct ttm_resource *dst,
> -				  bool copy_only_ccs);
> +				  bool copy_only_ccs,
> +				  bool intr);
>  
>  struct dma_fence *xe_migrate_resolve(struct xe_migrate *m,
>  				     struct xe_bo *bo,
> @@ -85,7 +86,8 @@ int xe_migrate_access_memory(struct xe_migrate *m,
> struct xe_bo *bo,
>  struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
>  				   struct xe_bo *bo,
>  				   struct ttm_resource *dst,
> -				   u32 clear_flags);
> +				   u32 clear_flags,
> +				   bool intr);
>  
>  struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
>  
> diff --git a/drivers/gpu/drm/xe/xe_vram.c
> b/drivers/gpu/drm/xe/xe_vram.c
> index 1c02889ba29b..946970236208 100644
> --- a/drivers/gpu/drm/xe/xe_vram.c
> +++ b/drivers/gpu/drm/xe/xe_vram.c
> @@ -526,7 +526,7 @@ int xe_vram_memtest(struct xe_device *xe)
>  		xe_bo_lock(last_page_bo, false);
>  		fence = xe_migrate_clear(tile->migrate,
> last_page_bo,
>  					 last_page_bo->ttm.resource,
> -					
> XE_MIGRATE_CLEAR_FLAG_BO_DATA);
> +					
> XE_MIGRATE_CLEAR_FLAG_BO_DATA, false);
>  		xe_bo_unlock(last_page_bo);
>  
>  		if (!IS_ERR(fence)) {

  reply	other threads:[~2026-10-30 15:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 11:49 [PATCH 0/6] Interruptible bb wait + related bits Matthew Auld
2026-10-30 11:49 ` [PATCH 1/6] drm/xe/migrate: allow larger chunk sizes for identity VRAM clears Matthew Auld
2026-10-30 15:20   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 2/6] drm/xe/bb: drop per-batch prefetch padding Matthew Auld
2026-10-30 15:21   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 3/6] drm/xe/sa: remove unused shadow BO and two-step bb helpers Matthew Auld
2026-10-30 15:23   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 4/6] drm/xe/sa: allow callers to specify interruptible suballocator waits Matthew Auld
2026-10-30 15:25   ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 5/6] drm/xe/migrate: plumb interruptible wait flag to clear and copy Matthew Auld
2026-10-30 15:28   ` Thomas Hellström [this message]
2026-10-30 11:49 ` [PATCH 6/6] drm/xe/migrate: avoid interruptible waits once passes are in flight Matthew Auld
2026-10-30 15:32   ` Thomas Hellström
2026-10-30 12:33 ` ✓ CI.KUnit: success for Interruptible bb wait + related bits Patchwork
2026-10-30 13:16 ` ✓ Xe.CI.BAT: " 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=60bbc8e80a642d8b1f5d42a9e2a14209f5e5124f.camel@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@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.