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

Quan, Evan Evan.Quan at amd.com
Mon Jan 13 03:39:42 UTC 2020


There was a same fix from Felix to address this.

Regards,
Evan
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Huang
> Rui
> Sent: Monday, January 13, 2020 10:35 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Kuehling, Felix
> <Felix.Kuehling at amd.com>; Huang, Ray <Ray.Huang at amd.com>
> 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]
> 
> Signed-off-by: Huang Rui <ray.huang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
> index f7c0ae6..d3962e2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
> @@ -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
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
> desktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&data=02%7C01%7Cevan.quan%40amd.com%7Cce7a462c82c94d51a9
> 6908d797d12d9d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637
> 144797057908962&sdata=LLvPWFsLxMKKk2upAUQAaG4E%2FfpNtWjt6G1
> mEpr78kg%3D&reserved=0


More information about the amd-gfx mailing list