Skip to contentSkip to conversation

drm/radeon: don't evict if not initialized

PATCH Applied Tong Zhang 3 participants 3 messages Mar 21, 2021 – Mar 23, 2021

Subsystems (2)
lore
Share & tools
lore

Tong Zhang

author
#0 lore raw

PATCH v2 1/1 drm/radeon: don't evict if not initialized

TTM_PL_VRAM may not initialized at all when calling radeon_bo_evict_vram(). We need to check before doing eviction.

[    2.160837] BUG: kernel NULL pointer dereference, address: 0000000000000020
[    2.161212] #PF: supervisor read access in kernel mode
[    2.161490] #PF: error_code(0x0000) - not-present page
[    2.161767] PGD 0 P4D 0
[    2.163088] RIP: 0010:ttm_resource_manager_evict_all+0x70/0x1c0 [ttm]
[    2.168506] Call Trace:
[    2.168641]  radeon_bo_evict_vram+0x1c/0x20 [radeon]
[    2.168936]  radeon_device_fini+0x28/0xf9 [radeon]
[    2.169224]  radeon_driver_unload_kms+0x44/0xa0 [radeon]
[    2.169534]  radeon_driver_load_kms+0x174/0x210 [radeon]
[    2.169843]  drm_dev_register+0xd9/0x1c0 [drm]
[    2.170104]  radeon_pci_probe+0x117/0x1a0 [radeon]

---
v2: coding style fix

 drivers/gpu/drm/radeon/radeon_object.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +2 -0
index 9b81786782de..499ce55e34cc 100644
@@ -384,6 +384,8 @@ int radeon_bo_evict_vram(struct radeon_device *rdev)
 	}
 #endif
 	man = ttm_manager_type(bdev, TTM_PL_VRAM);
+	if (!man)
+		return 0;
 	return ttm_resource_manager_evict_all(bdev, man);
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v2 1/1
#1 lore raw

Am 21.03.21 um 16:19 schrieb Tong Zhang:

Quoted 16 lines

TTM_PL_VRAM may not initialized at all when calling radeon_bo_evict_vram(). We need to check before doing eviction.

[    2.160837] BUG: kernel NULL pointer dereference, address: 0000000000000020
[    2.161212] #PF: supervisor read access in kernel mode
[    2.161490] #PF: error_code(0x0000) - not-present page
[    2.161767] PGD 0 P4D 0
[    2.163088] RIP: 0010:ttm_resource_manager_evict_all+0x70/0x1c0 [ttm]
[    2.168506] Call Trace:
[    2.168641]  radeon_bo_evict_vram+0x1c/0x20 [radeon]
[    2.168936]  radeon_device_fini+0x28/0xf9 [radeon]
[    2.169224]  radeon_driver_unload_kms+0x44/0xa0 [radeon]
[    2.169534]  radeon_driver_load_kms+0x174/0x210 [radeon]
[    2.169843]  drm_dev_register+0xd9/0x1c0 [drm]
[    2.170104]  radeon_pci_probe+0x117/0x1a0 [radeon]
Quoted 2 lines
Quoted 11 lines

---
v2: coding style fix

  drivers/gpu/drm/radeon/radeon_object.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +0 -0
index 9b81786782de..499ce55e34cc 100644

drivers/gpu/drm/radeon/radeon_object.c int radeon_bo_evict_vram(struct radeon_device *rdev) · line 391

Quoted 8 lines
drivers/gpu/drm/radeon/radeon_object.c +2 -0
@@ -384,6 +384,8 @@ int radeon_bo_evict_vram(struct radeon_device *rdev)
  	}
  #endif
  	man = ttm_manager_type(bdev, TTM_PL_VRAM);
+	if (!man)
+		return 0;
  	return ttm_resource_manager_evict_all(bdev, man);
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Applied
#2 lore raw

Applied. Thanks!

Alex

Quoted 39 lines · Christian König

Am 21.03.21 um 16:19 schrieb Tong Zhang:

Quoted 16 lines

TTM_PL_VRAM may not initialized at all when calling radeon_bo_evict_vram(). We need to check before doing eviction.

[    2.160837] BUG: kernel NULL pointer dereference, address: 0000000000000020
[    2.161212] #PF: supervisor read access in kernel mode
[    2.161490] #PF: error_code(0x0000) - not-present page
[    2.161767] PGD 0 P4D 0
[    2.163088] RIP: 0010:ttm_resource_manager_evict_all+0x70/0x1c0 [ttm]
[    2.168506] Call Trace:
[    2.168641]  radeon_bo_evict_vram+0x1c/0x20 [radeon]
[    2.168936]  radeon_device_fini+0x28/0xf9 [radeon]
[    2.169224]  radeon_driver_unload_kms+0x44/0xa0 [radeon]
[    2.169534]  radeon_driver_load_kms+0x174/0x210 [radeon]
[    2.169843]  drm_dev_register+0xd9/0x1c0 [drm]
[    2.170104]  radeon_pci_probe+0x117/0x1a0 [radeon]
Quoted 2 lines
Quoted 16 lines

---
v2: coding style fix

  drivers/gpu/drm/radeon/radeon_object.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +2 -0
index 9b81786782de..499ce55e34cc 100644
@@ -384,6 +384,8 @@ int radeon_bo_evict_vram(struct radeon_device *rdev)
      }
  #endif
      man = ttm_manager_type(bdev, TTM_PL_VRAM);
+     if (!man)
+             return 0;
Quoted 8 lines

drivers/gpu/drm/radeon/radeon_object.c int radeon_bo_evict_vram(struct radeon_device *rdev) · line 391

Quoted 3 lines
drivers/gpu/drm/radeon/radeon_object.c +0 -0
      return ttm_resource_manager_evict_all(bdev, man);
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx