Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/xe/vm: make PREFETCH to TT sticky
Date: Fri, 2 Oct 2026 14:32:06 +0100	[thread overview]
Message-ID: <04c348e7-2fed-4fe9-a151-860b05433a75@intel.com> (raw)
In-Reply-To: <92619c231f212306eb1c0c274b69c47687696159.camel@linux.intel.com>

On 02/10/2026 13:43, Thomas Hellström wrote:
> On Mon, 2026-09-28 at 17:48 +0100, Matthew Auld wrote:
>> When userspace explicitly requests DRM_XE_VM_BIND_OP_PREFETCH to
>> system
>> memory (XE_PL_TT), xe_bo_migrate() moves the buffer object to TT.
>> However, because XE_PL_TT is marked with TTM_PL_FLAG_FALLBACK in the
>> buffer's default placement (introduced in commit 5c87fee3c96c
>> ("drm/xe:
>> Attempt to bring bos back to VRAM after eviction")), any subsequent
>> validation during exec immediately migrates the buffer back to VRAM,
>> completely undoing the userspace prefetch request.
>>
>> Use xe_bo_migrate_tt_sticky() when prefetching to XE_PL_TT so that
>> the
>> buffer remains resident in system memory across subsequent
>> validations.
>>
>> Assisted-by: LLM
>> Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Fixes: 5c87fee3c96c ("drm/xe: Attempt to bring bos back to VRAM after
>> eviction")
>> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Cc: <stable@vger.kernel.org> # v6.12+
> 
> I think we need somewhere to clear this stickiness. Perhaps if
> xe_bo_migrate() is called with another destination than the sticky one,
> we'd clear it?

In the other patch in bo_migrate() there is:

+	ret = ttm_bo_validate(&bo->ttm, &placement, tctx);
+	if (!ret)
+		xe_bo_reset_sticky_placement(bo);
+	return ret;
+}

So if something successfully uses a non-sticky migrate(), it will reset. 
Is this enough?

> 
> Thanks,
> Thomas
> 
> 
> 
> 
>> ---
>>   drivers/gpu/drm/xe/xe_vm.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
>> index 425c678f4480..2068e0cf50ff 100644
>> --- a/drivers/gpu/drm/xe/xe_vm.c
>> +++ b/drivers/gpu/drm/xe/xe_vm.c
>> @@ -3406,7 +3406,10 @@ static int op_lock_and_prep(struct drm_exec
>> *exec, struct xe_vm *vm,
>>   				mem_type =
>> region_to_mem_type[region];
>>   			}
>>   
>> -			err = xe_bo_migrate(bo, mem_type, NULL,
>> exec);
>> +			if (mem_type == XE_PL_TT)
>> +				err = xe_bo_migrate_tt_sticky(bo,
>> NULL, exec);
>> +			else
>> +				err = xe_bo_migrate(bo, mem_type,
>> NULL, exec);
>>   		}
>>   		break;
>>   	}


  reply	other threads:[~2026-10-02 13:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 16:48 [PATCH 0/2] sticky TT Matthew Auld
2026-09-28 16:48 ` [PATCH 1/2] drm/xe/dma-buf: keep non-p2p imported buffers in system memory Matthew Auld
2026-09-28 22:01   ` Matthew Brost
2026-09-29  7:56     ` Thomas Hellström
2026-09-29 16:11       ` Matthew Brost
2026-10-02 12:40   ` Thomas Hellström
2026-09-28 16:48 ` [PATCH 2/2] drm/xe/vm: make PREFETCH to TT sticky Matthew Auld
2026-10-02 12:43   ` Thomas Hellström
2026-10-02 13:32     ` Matthew Auld [this message]
2026-09-28 17:30 ` ✗ CI.checkpatch: warning for sticky TT Patchwork
2026-09-28 17:32 ` ✓ CI.KUnit: success " Patchwork
2026-09-28 18:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-28 23:28 ` ✗ 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=04c348e7-2fed-4fe9-a151-860b05433a75@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=stable@vger.kernel.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