Skip to contentSkip to conversation

drm/amd/powerplay: fix the null pointer issue on switching power profile

PATCH In review Huang Rui 2 participants 2 messages Jan 13, 2020

Subsystems (2)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: fix the null pointer issue on switching power profile

Fix the wrong input parameter of powerplay callback amdgpu_dpm_switch_power_profile which is encountered by kfd test.

[  176.758381] BUG: kernel NULL pointer dereference, address: 0000000000000220
[  176.758409] #PF: supervisor read access in kernel mode
[  176.758424] #PF: error_code(0x0000) - not-present page
[  176.758440] PGD 80000003f6eea067 P4D 80000003f6eea067 PUD 3ce06c067 PMD 0
[  176.758461] Oops: 0000 [#1] SMP PTI
[  176.758473] CPU: 5 PID: 2621 Comm: kfdtest Tainted: G           OE
5.4.0-rc7-custom #1
[  176.758496] Hardware name: System manufacturer System Product Name/TUF
Z370-PLUS GAMING, BIOS 0612 03/01/2018
[  176.758593] RIP: 0010:pp_dpm_switch_power_profile+0x46/0x1ee [amdgpu]
[  176.758613] Code: 00 48 89 45 d8 31 c0 48 85 ff 0f 84 9f 01 00 00 48 89 fb 41
89 f4 41 89 d5 80 7f 15 00 0f 84 96 01 00 00 48 8b 87 78 02 00 00 <48> 83 b8 20
02 00 00 00 0f 84 ba 00 00 00 83 fe 05 0f 87 82 01 00
[  176.758663] RSP: 0018:ffffa530c12ebb50 EFLAGS: 00010282
[  176.758678] RAX: 0000000000000000 RBX: ffff9797c0b00000 RCX: 0000000000000000
[  176.758698] RDX: 0000000000000001 RSI: 0000000000000005 RDI: ffff9797c0b00000
[  176.758718] RBP: ffffa530c12ebb80 R08: ffff9797ce221548 R09: 000000000000036c
[  176.758739] R10: ffffffff94006a80 R11: 00000000ffffffff R12: 0000000000000005
[  176.758759] R13: 0000000000000001 R14: ffff9797fff4dda8 R15: ffff9797ce221548
[  176.758779] FS:  00007efe09cc3780(0000) GS:ffff979826940000(0000)
knlGS:0000000000000000
[  176.758802] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  176.758819] CR2: 0000000000000220 CR3: 00000003cdc70003 CR4: 00000000003606e0
[  176.758839] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  176.758859] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  176.758879] Call Trace:
[  176.758932]  amdgpu_dpm_switch_power_profile+0x4c/0x6f [amdgpu]
[  176.758995]  amdgpu_amdkfd_set_compute_idle+0x1a/0x1c [amdgpu]
[  176.759056]  kfd_inc_compute_active+0x29/0x2b [amdgpu]
[  176.759117]  register_process+0x11c/0x14f [amdgpu]
[  176.759177]  pqm_create_queue+0x20b/0x527 [amdgpu]
[  176.759234]  kfd_ioctl_create_queue+0x4aa/0x5e5 [amdgpu]
[  176.759294]  kfd_ioctl+0x235/0x366 [amdgpu]
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +2 -1
index f7c0ae6..d3962e2 100644
@@ -1123,7 +1123,8 @@ int amdgpu_dpm_switch_power_profile(struct amdgpu_device *adev,
 		ret = smu_switch_power_profile(&adev->smu, type, en);
 	else if (adev->powerplay.pp_funcs &&
 		 adev->powerplay.pp_funcs->switch_power_profile)
-		ret = adev->powerplay.pp_funcs->switch_power_profile(adev, type, en);
+		ret = adev->powerplay.pp_funcs->switch_power_profile(adev->powerplay.pp_handle,
+								     type, en);
 
 	return ret;
 }
Signature · 6 lines
2.7.4

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

There was a same fix from Felix to address this.

Regards,
Evan

Quoted 76 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Huang Rui
Sent: Monday, January 13, 2020 10:35 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH] drm/amd/powerplay: fix the null pointer issue on switching power profile

Fix the wrong input parameter of powerplay callback amdgpu_dpm_switch_power_profile which is encountered by kfd test.

[  176.758381] BUG: kernel NULL pointer dereference, address:
0000000000000220 [  176.758409] #PF: supervisor read access in kernel mode
[  176.758424] #PF: error_code(0x0000) - not-present page [  176.758440] PGD
80000003f6eea067 P4D 80000003f6eea067 PUD 3ce06c067 PMD 0
[  176.758461] Oops: 0000 [#1] SMP PTI
[  176.758473] CPU: 5 PID: 2621 Comm: kfdtest Tainted: G           OE
5.4.0-rc7-custom #1
[  176.758496] Hardware name: System manufacturer System Product
Name/TUF Z370-PLUS GAMING, BIOS 0612 03/01/2018 [  176.758593] RIP:
0010:pp_dpm_switch_power_profile+0x46/0x1ee [amdgpu] [  176.758613]
Code: 00 48 89 45 d8 31 c0 48 85 ff 0f 84 9f 01 00 00 48 89 fb 41

89 f4 41 89 d5 80 7f 15 00 0f 84 96 01 00 00 48 8b 87 78 02 00 00 <48> 83 b8 20
02 00 00 00 0f 84 ba 00 00 00 83 fe 05 0f 87 82 01 00 [ 176.758663] RSP:
0018:ffffa530c12ebb50 EFLAGS: 00010282 [ 176.758678] RAX:
0000000000000000 RBX: ffff9797c0b00000 RCX: 0000000000000000

[  176.758698] RDX: 0000000000000001 RSI: 0000000000000005 RDI:

ffff9797c0b00000 [ 176.758718] RBP: ffffa530c12ebb80 R08: ffff9797ce221548
R09: 000000000000036c [ 176.758739] R10: ffffffff94006a80 R11:
00000000ffffffff R12: 0000000000000005 [ 176.758759] R13:
0000000000000001 R14: ffff9797fff4dda8 R15: ffff9797ce221548 [ 176.758779]
FS: 00007efe09cc3780(0000) GS:ffff979826940000(0000) knlGS:0000000000000000

[  176.758802] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  176.758819] CR2: 0000000000000220 CR3: 00000003cdc70003 CR4:
00000000003606e0 [  176.758839] DR0: 0000000000000000 DR1:
0000000000000000 DR2: 0000000000000000 [  176.758859] DR3:
0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  176.758879] Call Trace:
[  176.758932]  amdgpu_dpm_switch_power_profile+0x4c/0x6f [amdgpu]
[  176.758995]  amdgpu_amdkfd_set_compute_idle+0x1a/0x1c [amdgpu]
[  176.759056]  kfd_inc_compute_active+0x29/0x2b [amdgpu] [  176.759117]
register_process+0x11c/0x14f [amdgpu] [  176.759177]
pqm_create_queue+0x20b/0x527 [amdgpu] [  176.759234]
kfd_ioctl_create_queue+0x4aa/0x5e5 [amdgpu] [  176.759294]
kfd_ioctl+0x235/0x366 [amdgpu]
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c +2 -1
index f7c0ae6..d3962e2 100644
@@ -1123,7 +1123,8 @@ int amdgpu_dpm_switch_power_profile(struct
 amdgpu_device *adev,
 		ret = smu_switch_power_profile(&adev->smu, type, en);
 	else if (adev->powerplay.pp_funcs &&
 		 adev->powerplay.pp_funcs->switch_power_profile)
-		ret = adev->powerplay.pp_funcs->switch_power_profile(adev,
 type, en);
+		ret = adev->powerplay.pp_funcs->switch_power_profile(adev-
 >powerplay.pp_handle,
+								     type, en);

return ret;
}
--
2.7.4

Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
desktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7Cce7a462c82c94d51a9 6908d797d12d9d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637 144797057908962&amp;sdata=LLvPWFsLxMKKk2upAUQAaG4E%2FfpNtWjt6G1 mEpr78kg%3D&amp;reserved=0

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