drm/xe: Opportunistically skip TLB invalidaion on unbind
authorMatthew Brost <matthew.brost@intel.com>
Mon, 16 Jun 2025 06:30:24 +0000 (23:30 -0700)
committerMatthew Brost <matthew.brost@intel.com>
Tue, 17 Jun 2025 22:38:14 +0000 (15:38 -0700)
commitbcc287203ca777721fecfe47f3f9fa9aa7d5993d
tree124ca0e82faf795b7b60f3688a1ac1f97c3f6125
parentfab76ce56538fdeb9baaf1bfc06f34532e04f9d7
drm/xe: Opportunistically skip TLB invalidaion on unbind

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
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)
v3:
 - Avoid skipping TLB invalidation if PTEs are removed at a higher
   level than the range
 - Never skip TLB invalidations for VMA
 - Drop Himal's RB

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://lore.kernel.org/r/20250616063024.2059829-3-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_pt.c