Linux kernel -stable discussions
 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>, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/xe/vm: make PREFETCH to TT sticky
Date: Mon, 05 Oct 2026 16:17:27 +0200	[thread overview]
Message-ID: <8ba544fe1a920392ee9449b398fbd0f3a5ede2a8.camel@linux.intel.com> (raw)
In-Reply-To: <04c348e7-2fed-4fe9-a151-860b05433a75@intel.com>

On Fri, 2026-10-02 at 14:32 +0100, Matthew Auld wrote:
> 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?

Yes, I missed that. That should be enough IMO.

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


> 
> > 
> > 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-05 14:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260928164820.1237049-4-matthew.auld@intel.com>
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
2026-10-05 14:17       ` Thomas Hellström [this message]

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=8ba544fe1a920392ee9449b398fbd0f3a5ede2a8.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 \
    --cc=stable@vger.kernel.org \
    /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