Skip to contentSkip to conversation

drm/amdgpu: fix list add issue in vram reserve

PATCH In review Tao Zhou 2 participants 2 messages Jan 30, 2022

Subsystems (2)
lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix list add issue in vram reserve

The parameter order in the list_add_tail is incorrect, it causes the reuse of ras reserved page.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -1
index 7a2b487db57c..6c99ef700cc8 100644
@@ -281,7 +281,7 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
 	rsv->mm_node.size = size >> PAGE_SHIFT;
 
 	spin_lock(&mgr->lock);
-	list_add_tail(&mgr->reservations_pending, &rsv->node);
+	list_add_tail(&rsv->node, &mgr->reservations_pending);
 	amdgpu_vram_mgr_do_reserve(&mgr->manager);
 	spin_unlock(&mgr->lock);
 
Signature · 1 line
2.17.1
#1 lore raw

Am 30.01.22 um 08:37 schrieb Tao Zhou:

Quoted 4 lines

The parameter order in the list_add_tail is incorrect, it causes the reuse of ras reserved page.

Good catch, Reviewed-by: Christian König <[email protected]>

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +1 -1
index 7a2b487db57c..6c99ef700cc8 100644
@@ -281,7 +281,7 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
  	rsv->mm_node.size = size >> PAGE_SHIFT;
 
  	spin_lock(&mgr->lock);
-	list_add_tail(&mgr->reservations_pending, &rsv->node);
+	list_add_tail(&rsv->node, &mgr->reservations_pending);
  	amdgpu_vram_mgr_do_reserve(&mgr->manager);
  	spin_unlock(&mgr->lock);