From: "Summers, Stuart" <stuart.summers@intel.com>
To: "Brost, Matthew" <matthew.brost@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Skip media GT TLB invalidation when VM has no queues mapped
Date: Mon, 23 Mar 2026 16:26:36 +0000 [thread overview]
Message-ID: <64af464463c20f4fa78deb75fdf341373331a04b.camel@intel.com> (raw)
In-Reply-To: <acFnkD6HZV4r/8o6@lstrano-desk.jf.intel.com>
On Mon, 2026-03-23 at 09:17 -0700, Matthew Brost wrote:
> On Mon, Mar 23, 2026 at 10:13:28AM -0600, Summers, Stuart wrote:
> > On Wed, 2026-03-04 at 15:37 -0800, Matthew Brost wrote:
> > > If no exec queues from a VM are mapped on the media GT, issuing a
> > > PPGTT TLB invalidation for that GT requires an rc6 wake which is
> > > expensive.
> > >
> > > Skip the media GT TLB invalidation when the VM has no exec queues
> > > mapped on it. If TLB invalidations are already in-flight on that
> > > GT
> > > we can't break fence ordering, so issue a dummy GGTT invalidation
> > > instead to maintain seqno ordering.
> > >
> > > This optimization is particularly impactful for SVM workloads
> > > which
> > > may or may not use the media GT. Average TLB invalidation time
> > > drops
> > > from ~75us to ~18us in such benchmarks.
> >
> > So.. what if the user creates the VM, binds it, and only then
> > creates
> > an exec queue and submits?
> >
>
> I would think the TLBs would be empty but something is clearly wrong
> in
> patch per CI and perhaps this is the problem. Need to dig into
> failures
> this week.
I kind of agree with Thomas here that whatever we decide here should
work on both GTs. And I'd expect when we do the context switch that the
TLB would be implicitly flushed, so I agree it should be empty. Maybe
we add an explicit flush on exec queue creation if we skipped it on the
bind to cover a corner case there? But yeah seems like it might need
debug...
-Stuart
>
> Matt
>
> > -Stuart
> >
> > >
> > > Assisted-by: GitHub Copilot:claude-sonnet-4.6 # Documentation
> > > only.
> > > Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> > > ---
> > > drivers/gpu/drm/xe/xe_guc_tlb_inval.c | 43
> > > +++++++++++++++++++++++++--
> > > 1 file changed, 41 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> > > b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> > > index ced58f46f846..20c34469d9a5 100644
> > > --- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> > > +++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> > > @@ -205,14 +205,53 @@ static int send_tlb_inval_asid_ppgtt(struct
> > > xe_tlb_inval *tlb_inval, u32 seqno,
> > > struct drm_suballoc *prl_sa)
> > > {
> > > struct xe_guc *guc = tlb_inval->private;
> > > + struct xe_device *xe = guc_to_xe(guc);
> > > + struct xe_gt *gt = guc_to_gt(guc);
> > > + struct xe_vm *vm;
> > > + int err = 0, id = guc_to_gt(guc)->info.id;
> > >
> > > lockdep_assert_held(&tlb_inval->seqno_lock);
> > >
> > > if (guc_to_xe(guc)->info.force_execlist)
> > > return -ECANCELED;
> > >
> > > - return send_tlb_inval_ppgtt(guc, seqno, start, end, asid,
> > > -
> > > XE_GUC_TLB_INVAL_PAGE_SELECTIVE,
> > > prl_sa);
> > > + if (!xe_gt_is_media_type(gt))
> > > + return send_tlb_inval_ppgtt(guc, seqno, start,
> > > end,
> > > asid,
> > > +
> > > XE_GUC_TLB_INVAL_PAGE_SELECTIVE,
> > > + prl_sa);
> > > +
> > > + /* Try to skip media GT TLB invalidations */
> > > +
> > > + vm = xe_device_asid_to_vm(xe, asid);
> > > + if (IS_ERR(vm))
> > > + return PTR_ERR(vm);
> > > +
> > > + down_read(&vm->exec_queues.lock);
> > > +
> > > + if (!vm->exec_queues.count[id]) {
> > > + /*
> > > + * We can't break fence ordering for TLB
> > > invalidation
> > > jobs, if
> > > + * TLB invalidations are inflight issue a dummy
> > > invalidation to
> > > + * maintain ordering. Nor can we move safely the
> > > seqno_recv when
> > > + * returning -ECANCELED if TLB invalidations are
> > > in
> > > flight. Use
> > > + * GGTT invalidation as dummy invalidation given
> > > ASID
> > > + * invalidations are unsupported here.
> > > + */
> > > + if (xe_tlb_inval_idle(tlb_inval))
> > > + err = -ECANCELED;
> > > + else
> > > + err = send_tlb_inval_ggtt(tlb_inval,
> > > seqno);
> > > + goto err_unlock;
> > > + }
> > > +
> > > + err = send_tlb_inval_ppgtt(guc, seqno, start, end, asid,
> > > +
> > > XE_GUC_TLB_INVAL_PAGE_SELECTIVE,
> > > prl_sa);
> > > +
> > > +err_unlock:
> > > + up_read(&vm->exec_queues.lock);
> > > + xe_vm_put(vm);
> > > +
> > > + return err;
> > > }
> > >
> > > static int send_tlb_inval_ctx_ppgtt(struct xe_tlb_inval
> > > *tlb_inval,
> > > u32 seqno,
> >
prev parent reply other threads:[~2026-03-23 16:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 23:37 [PATCH] drm/xe: Skip media GT TLB invalidation when VM has no queues mapped Matthew Brost
2026-03-05 22:47 ` ✗ CI.checkpatch: warning for " Patchwork
2026-03-05 22:48 ` ✓ CI.KUnit: success " Patchwork
2026-03-06 0:19 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-06 18:07 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-20 13:06 ` [PATCH] " Thomas Hellström
2026-03-23 7:00 ` Matthew Brost
2026-03-23 16:13 ` Summers, Stuart
2026-03-23 16:17 ` Matthew Brost
2026-03-23 16:26 ` Summers, Stuart [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=64af464463c20f4fa78deb75fdf341373331a04b.camel@intel.com \
--to=stuart.summers@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox