All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: clear the entire mapping when partially unmapping
@ 2026-11-11 18:28 Thadeu Lima de Souza Cascardo
  2026-11-12  9:24 ` Christian König
  2026-11-12 14:15 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2026-11-11 18:28 UTC (permalink / raw)
  To: Alex Deucher, Christian König; +Cc: amd-gfx, Thadeu Lima de Souza Cascardo

When we partially clear a BO mapping, we only add the partially unmapped
region to the freed list. That will update the page table to clear that
mapping and leave the other endpoints mapped.

However, we move the endpoints to the invalids list. When later closing
that BO, it will simply free the mapping and not clear the GPU page
tables.

Drop the optimization and clear the entire mapping from the page tables.
As the endpoints are already in the invalids list, when that BO mapping
needs to be accessed, the page tables will be updated.

Though that may clear, then write page table entries and even lead to
new page table allocations in certain situations, those would already
happen in the clear path.

When measuring a given workload, it was noticed an extra allocation in
less than 10% of the cases, but no noticeable extra latency. In any
case, correctness is more important and this fixes the scenario
described.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index a99c2ef14be9..808b77083a5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2108,12 +2108,6 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev,
 	list_for_each_entry_safe(tmp, next, &removed, list) {
 		amdgpu_vm_it_remove(tmp, &vm->va);
 		list_del(&tmp->list);
-
-		if (tmp->start < saddr)
-		    tmp->start = saddr;
-		if (tmp->last > eaddr)
-		    tmp->last = eaddr;
-
 		tmp->bo_va = NULL;
 		list_add(&tmp->list, &vm->freed);
 		trace_amdgpu_vm_bo_unmap(NULL, tmp);

---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: 20261111-amdgpu_partial_mappings_fix-c48d729ef590

Best regards,
--  
Thadeu Lima de Souza Cascardo <cascardo@igalia.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-12 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 18:28 [PATCH] drm/amdgpu: clear the entire mapping when partially unmapping Thadeu Lima de Souza Cascardo
2026-11-12  9:24 ` Christian König
2026-11-12 14:15 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.