From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: <francois.dugast@intel.com>, <thomas.hellstrom@linux.intel.com>,
<himal.prasad.ghimiray@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Opportunistically skip TLB invalidaion on unbind
Date: Sat, 14 Jun 2025 20:56:45 -0700 [thread overview]
Message-ID: <aE5EfR6LkVsZCf28@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250613210242.718441-3-matthew.brost@intel.com>
On Fri, Jun 13, 2025 at 02:02:42PM -0700, Matthew Brost wrote:
> If a range or VMA is invalidated and scratch page is disabled, there
> is no reason to issue a TLB invalidation on unbind, skip TLB
> innvalidation is this condition is true. This is an opportunistic check
> as it is done without the notifier lock, thus it possible for the range
> or VMA to be invalidated after this check is performed.
>
> This should improve performance of the SVM garbage collector, for
> example, xe_exec_system_allocator --r many-stride-new-prefetch, went
> ~20s to ~9.5s on a BMG.
>
> v2:
> - Use helper for valid check (Thomas)
>
This patch doesn't quite work either - I'm a roll here of posting
things that don't work [1]...
If we are removing PTEs are higher level than the size of the VMA /
range, those will not have been invalidated and could still be in GPU
TLBs. We need a helper to check the walk results against the size of the
VMA / range too.
Matt
[1] https://patchwork.freedesktop.org/patch/658370/?series=150188&rev=1#comment_1206030
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>>
> ---
> drivers/gpu/drm/xe/xe_pt.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index 59496c1a1e77..39947fd5c3a2 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -1988,7 +1988,9 @@ static int unbind_op_prepare(struct xe_tile *tile,
> xe_vma_end(vma));
> ++pt_update_ops->current_op;
> pt_update_ops->needs_userptr_lock |= xe_vma_is_userptr(vma);
> - pt_update_ops->needs_invalidation = true;
> + pt_update_ops->needs_invalidation |= xe_vm_has_scratch(xe_vma_vm(vma)) ||
> + xe_vm_has_valid_gpu_pages(tile, vma->tile_present,
> + vma->tile_invalidated);
>
> xe_pt_commit_prepare_unbind(vma, pt_op->entries, pt_op->num_entries);
>
> @@ -2023,7 +2025,9 @@ static int unbind_range_prepare(struct xe_vm *vm,
> range->base.itree.last + 1);
> ++pt_update_ops->current_op;
> pt_update_ops->needs_svm_lock = true;
> - pt_update_ops->needs_invalidation = true;
> + pt_update_ops->needs_invalidation |= xe_vm_has_scratch(vm) ||
> + xe_vm_has_valid_gpu_pages(tile, range->tile_present,
> + range->tile_invalidated);
>
> xe_pt_commit_prepare_unbind(XE_INVALID_VMA, pt_op->entries,
> pt_op->num_entries);
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-06-15 3:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 21:02 [PATCH v2 0/2] Opportunistically skip TLB invalidaion on unbind Matthew Brost
2025-06-13 21:02 ` [PATCH v2 1/2] drm/xe: Add xe_vm_has_valid_gpu_pages helper Matthew Brost
2025-06-13 21:02 ` [PATCH v2 2/2] drm/xe: Opportunistically skip TLB invalidaion on unbind Matthew Brost
2025-06-15 3:56 ` Matthew Brost [this message]
2025-06-13 23:22 ` ✗ CI.checkpatch: warning for " Patchwork
2025-06-13 23:23 ` ✓ CI.KUnit: success " Patchwork
2025-06-14 0:13 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-16 0:15 ` ✗ 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=aE5EfR6LkVsZCf28@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.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