Skip to contentSkip to conversation

drm/amdgpu: Fixed bug on error when uninstalling amdgpu

PATCH In review YiPeng Chai 2 participants 3 messages Dec 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fixed bug on error when uninstalling amdgpu

Fixed bug on error when uninstalling amdgpu.
The error message is as follows:

[  304.852489] kernel BUG at drivers/gpu/drm/drm_buddy.c:278!
[  304.852503] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[  304.852510] CPU: 2 PID: 4192 Comm: modprobe Tainted: G        W IOE     5.19.0-thomas #1
[  304.852519] Hardware name: ASUS System Product Name/PRIME Z390-A, BIOS 2004 11/02/2021
[  304.852526] RIP: 0010:drm_buddy_free_block+0x26/0x30 [drm_buddy]
[  304.852535] Code: 00 00 00 90 0f 1f 44 00 00 48 8b 0e 89 c8 25 00 0c 00 00 3d 00 04 00 00 75 10 48 8b 47 18 48 d3 e0 48 01 47 28 e9 fa fe ff ff <0f> 0b 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 55 48 89 f5 53
[  304.852549] RSP: 0018:ffff9afac17bbcb8 EFLAGS: 00010287
[  304.852556] RAX: 0000000000000000 RBX: ffff8dacd37fd778 RCX: 0000000000000000
[  304.852563] RDX: ffff8dacd37fd7a0 RSI: ffff8dacd37fd3b8 RDI: ffff8dac672a5f80
[  304.852570] RBP: ffff8dacd37fd3a0 R08: 0000000000000001 R09: 0000000000000000
[  304.852577] R10: ffff8dac68185500 R11: ffff9afac17bbd00 R12: ffff8dac672a5f80
[  304.852584] R13: ffff8dac672a5fe0 R14: ffff8dacd37fd380 R15: ffff8dac672a5f80
[  304.852590] FS:  00007f0fa9b30c40(0000) GS:ffff8dadb6480000(0000) knlGS:0000000000000000
[  304.852598] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  304.852604] CR2: 00007f4bf1a1ba50 CR3: 0000000108c58004 CR4: 00000000003706e0
[  304.852611] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  304.852618] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  304.852625] Call Trace:
[  304.852629]  <TASK>
[  304.852632]  drm_buddy_free_list+0x2a/0x60 [drm_buddy]
[  304.852639]  amdgpu_vram_mgr_fini+0xea/0x180 [amdgpu]
[  304.852827]  amdgpu_ttm_fini+0x1f9/0x280 [amdgpu]
[  304.852925]  amdgpu_bo_fini+0x22/0x90 [amdgpu]
[  304.853022]  gmc_v11_0_sw_fini+0x26/0x30 [amdgpu]
[  304.853132]  amdgpu_device_fini_sw+0xc5/0x3b0 [amdgpu]
[  304.853229]  amdgpu_driver_release_kms+0x12/0x30 [amdgpu]
[  304.853327]  drm_dev_release+0x20/0x40 [drm]
[  304.853352]  release_nodes+0x35/0xb0
[  304.853359]  devres_release_all+0x8b/0xc0
[  304.853364]  device_unbind_cleanup+0xe/0x70
[  304.853370]  device_release_driver_internal+0xee/0x160
[  304.853377]  driver_detach+0x44/0x90
[  304.853382]  bus_remove_driver+0x55/0xe0
[  304.853387]  pci_unregister_driver+0x3b/0x90
[  304.853393]  amdgpu_exit+0x11/0x69 [amdgpu]
[  304.853540]  __x64_sys_delete_module+0x142/0x260
[  304.853548]  ? exit_to_user_mode_prepare+0x3e/0x190
[  304.853555]  do_syscall_64+0x38/0x90
[  304.853562]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
---
 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 0b598b510bd8..eb63324c30d2 100644
@@ -829,7 +829,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
 		kfree(rsv);
 
 	list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) {
-		drm_buddy_free_list(&mgr->mm, &rsv->blocks);
+		drm_buddy_free_list(&mgr->mm, &rsv->allocated);
 		kfree(rsv);
 	}
 	drm_buddy_fini(&mgr->mm);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Am 16.12.22 um 03:56 schrieb YiPeng Chai:

Quoted 42 lines

Fixed bug on error when uninstalling amdgpu.
The error message is as follows:

[  304.852489] kernel BUG at drivers/gpu/drm/drm_buddy.c:278!
[  304.852503] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[  304.852510] CPU: 2 PID: 4192 Comm: modprobe Tainted: G        W IOE     5.19.0-thomas #1
[  304.852519] Hardware name: ASUS System Product Name/PRIME Z390-A, BIOS 2004 11/02/2021
[  304.852526] RIP: 0010:drm_buddy_free_block+0x26/0x30 [drm_buddy]
[  304.852535] Code: 00 00 00 90 0f 1f 44 00 00 48 8b 0e 89 c8 25 00 0c 00 00 3d 00 04 00 00 75 10 48 8b 47 18 48 d3 e0 48 01 47 28 e9 fa fe ff ff <0f> 0b 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 54 55 48 89 f5 53
[  304.852549] RSP: 0018:ffff9afac17bbcb8 EFLAGS: 00010287
[  304.852556] RAX: 0000000000000000 RBX: ffff8dacd37fd778 RCX: 0000000000000000
[  304.852563] RDX: ffff8dacd37fd7a0 RSI: ffff8dacd37fd3b8 RDI: ffff8dac672a5f80
[  304.852570] RBP: ffff8dacd37fd3a0 R08: 0000000000000001 R09: 0000000000000000
[  304.852577] R10: ffff8dac68185500 R11: ffff9afac17bbd00 R12: ffff8dac672a5f80
[  304.852584] R13: ffff8dac672a5fe0 R14: ffff8dacd37fd380 R15: ffff8dac672a5f80
[  304.852590] FS:  00007f0fa9b30c40(0000) GS:ffff8dadb6480000(0000) knlGS:0000000000000000
[  304.852598] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  304.852604] CR2: 00007f4bf1a1ba50 CR3: 0000000108c58004 CR4: 00000000003706e0
[  304.852611] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  304.852618] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  304.852625] Call Trace:
[  304.852629]  <TASK>
[  304.852632]  drm_buddy_free_list+0x2a/0x60 [drm_buddy]
[  304.852639]  amdgpu_vram_mgr_fini+0xea/0x180 [amdgpu]
[  304.852827]  amdgpu_ttm_fini+0x1f9/0x280 [amdgpu]
[  304.852925]  amdgpu_bo_fini+0x22/0x90 [amdgpu]
[  304.853022]  gmc_v11_0_sw_fini+0x26/0x30 [amdgpu]
[  304.853132]  amdgpu_device_fini_sw+0xc5/0x3b0 [amdgpu]
[  304.853229]  amdgpu_driver_release_kms+0x12/0x30 [amdgpu]
[  304.853327]  drm_dev_release+0x20/0x40 [drm]
[  304.853352]  release_nodes+0x35/0xb0
[  304.853359]  devres_release_all+0x8b/0xc0
[  304.853364]  device_unbind_cleanup+0xe/0x70
[  304.853370]  device_release_driver_internal+0xee/0x160
[  304.853377]  driver_detach+0x44/0x90
[  304.853382]  bus_remove_driver+0x55/0xe0
[  304.853387]  pci_unregister_driver+0x3b/0x90
[  304.853393]  amdgpu_exit+0x11/0x69 [amdgpu]
[  304.853540]  __x64_sys_delete_module+0x142/0x260
[  304.853548]  ? exit_to_user_mode_prepare+0x3e/0x190
[  304.853555]  do_syscall_64+0x38/0x90
[  304.853562]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Quoted 1 line

The subject line should probably read "when unloading amdgpu", but apart from that good catch.

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 0b598b510bd8..eb63324c30d2 100644
@@ -829,7 +829,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
  		kfree(rsv);
 
  	list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) {
-		drm_buddy_free_list(&mgr->mm, &rsv->blocks);
+		drm_buddy_free_list(&mgr->mm, &rsv->allocated);
  		kfree(rsv);
  	}
  	drm_buddy_fini(&mgr->mm);
author Reviewed-by Christian König
#2 lore raw

[AMD Official Use Only - General]

OK, I will update subject line. Thanks!

-----------------
Best Regards,
Thomas

-----Original Message-----
From: Christian König <[email protected]>
Sent: Friday, December 16, 2022 4:50 PM
To: Chai, Thomas <[email protected]>; [email protected]; Paneer Selvam, Arunpravin <[email protected]>
Cc: Zhou1, Tao <[email protected]>; Zhang, Hawking <[email protected]>; Chai, Thomas <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fixed bug on error when uninstalling amdgpu

Am 16.12.22 um 03:56 schrieb YiPeng Chai:

Quoted 40 lines

Fixed bug on error when uninstalling amdgpu.
The error message is as follows:

[  304.852489] kernel BUG at drivers/gpu/drm/drm_buddy.c:278!
[  304.852503] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
[  304.852510] CPU: 2 PID: 4192 Comm: modprobe Tainted: G        W IOE     5.19.0-thomas #1
[  304.852519] Hardware name: ASUS System Product Name/PRIME Z390-A, 

BIOS 2004 11/02/2021 [ 304.852526] RIP:
0010:drm_buddy_free_block+0x26/0x30 [drm_buddy] [ 304.852535] Code:
00 00 00 90 0f 1f 44 00 00 48 8b 0e 89 c8 25 00 0c 00 00 3d 00 04 00
00 75 10 48 8b 47 18 48 d3 e0 48 01 47 28 e9 fa fe ff ff <0f> 0b 0f 1f
84 00 00 00 00 00 0f 1f 44 00 00 41 54 55 48 89 f5 53 [ 304.852549]
RSP: 0018:ffff9afac17bbcb8 EFLAGS: 00010287 [ 304.852556] RAX:
0000000000000000 RBX: ffff8dacd37fd778 RCX: 0000000000000000 [
304.852563] RDX: ffff8dacd37fd7a0 RSI: ffff8dacd37fd3b8 RDI:
ffff8dac672a5f80 [ 304.852570] RBP: ffff8dacd37fd3a0 R08:
0000000000000001 R09: 0000000000000000 [ 304.852577] R10:
ffff8dac68185500 R11: ffff9afac17bbd00 R12: ffff8dac672a5f80 [
304.852584] R13: ffff8dac672a5fe0 R14: ffff8dacd37fd380 R15:
ffff8dac672a5f80 [ 304.852590] FS: 00007f0fa9b30c40(0000)
GS:ffff8dadb6480000(0000) knlGS:0000000000000000 [ 304.852598] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 304.852604] CR2: 00007f4bf1a1ba50 CR3: 0000000108c58004 CR4: 00000000003706e0 [ 304.852611] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 304.852618] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 304.852625] Call Trace:

[  304.852629]  <TASK>
[  304.852632]  drm_buddy_free_list+0x2a/0x60 [drm_buddy] [  
304.852639]  amdgpu_vram_mgr_fini+0xea/0x180 [amdgpu] [  304.852827]  
amdgpu_ttm_fini+0x1f9/0x280 [amdgpu] [  304.852925]  
amdgpu_bo_fini+0x22/0x90 [amdgpu] [  304.853022]  
gmc_v11_0_sw_fini+0x26/0x30 [amdgpu] [  304.853132]  
amdgpu_device_fini_sw+0xc5/0x3b0 [amdgpu] [  304.853229]  
amdgpu_driver_release_kms+0x12/0x30 [amdgpu] [  304.853327]  
drm_dev_release+0x20/0x40 [drm] [  304.853352]  
release_nodes+0x35/0xb0 [  304.853359]  devres_release_all+0x8b/0xc0 [  
304.853364]  device_unbind_cleanup+0xe/0x70 [  304.853370]  
device_release_driver_internal+0xee/0x160
[  304.853377]  driver_detach+0x44/0x90 [  304.853382]  
bus_remove_driver+0x55/0xe0 [  304.853387]  
pci_unregister_driver+0x3b/0x90 [  304.853393]  amdgpu_exit+0x11/0x69 
[amdgpu] [  304.853540]  __x64_sys_delete_module+0x142/0x260
[  304.853548]  ? exit_to_user_mode_prepare+0x3e/0x190
[  304.853555]  do_syscall_64+0x38/0x90 [  304.853562]  
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Quoted 1 line

The subject line should probably read "when unloading amdgpu", but apart from that good catch.

Quoted 18 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 0b598b510bd8..eb63324c30d2 100644
@@ -829,7 +829,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
  		kfree(rsv);
 
  	list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) {
-		drm_buddy_free_list(&mgr->mm, &rsv->blocks);
+		drm_buddy_free_list(&mgr->mm, &rsv->allocated);
  		kfree(rsv);
  	}
  	drm_buddy_fini(&mgr->mm);