Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 7.3,6.18,6.12,6.6,6.1] drm/amdgpu: clear the entire mapping when partially unmapping
@ 2026-12-03 21:03 Thadeu Lima de Souza Cascardo
  2026-12-04 19:49 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2026-12-03 21:03 UTC (permalink / raw)
  To: stable
  Cc: Christian König, Alex Deucher, amd-gfx,
	Thadeu Lima de Souza Cascardo

commit 8b899b15cb3f210f476e044760f0208f3182f9a5 upstream.

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.

Fixes: 387f49e54672 ("drm/amdgpu: fix clear_all and replace handling in the VM (v2)")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 3940c19c6371c54a2a503431a4ad736c75cc56ac)
Cc: stable@vger.kernel.org
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 e9170cd475f0..b00f1dfc53b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2118,12 +2118,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);
-- 
2.47.3


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

* Re: [PATCH 7.3,6.18,6.12,6.6,6.1] drm/amdgpu: clear the entire mapping when partially unmapping
  2026-12-03 21:03 [PATCH 7.3,6.18,6.12,6.6,6.1] drm/amdgpu: clear the entire mapping when partially unmapping Thadeu Lima de Souza Cascardo
@ 2026-12-04 19:49 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-12-04 19:49 UTC (permalink / raw)
  To: stable
  Cc: Sasha Levin, Christian König, Alex Deucher, amd-gfx,
	Thadeu Lima de Souza Cascardo

> commit 8b899b15cb3f210f476e044760f0208f3182f9a5 upstream.
>
> When we partially clear a BO mapping, we only add the partially unmapped
> region to the freed list.

Queued for 7.3, 6.18, 6.12, 6.6 and 6.1, thanks.

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-12-04 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 21:03 [PATCH 7.3,6.18,6.12,6.6,6.1] drm/amdgpu: clear the entire mapping when partially unmapping Thadeu Lima de Souza Cascardo
2026-12-04 19:49 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox