Skip to contentSkip to conversation

drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

PATCH In review Kuehling, Felix 4 participants 6 messages Nov 15, 2018 – Nov 19, 2018 3 messages not in the archive

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

PATCH 1/1 drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -2
index a9c7597..1c1fed6 100644
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 
-	amdgpu_dpm_switch_power_profile(adev,
-					PP_SMC_POWER_PROFILE_COMPUTE, !idle);
+	if (adev->powerplay.pp_funcs &&
+	    adev->powerplay.pp_funcs->switch_power_profile)
+		amdgpu_dpm_switch_power_profile(adev,
+						PP_SMC_POWER_PROFILE_COMPUTE,
+						!idle);
 }
 
 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1542318992-12464-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Kuehling, Felix <[email protected]>
Sent: Thursday, November 15, 2018 4:56:51 PM
To: [email protected]
Cc: Kuehling, Felix; Joerg Roedel
Subject: [PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -2
index a9c7597..1c1fed6 100644
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 
-       amdgpu_dpm_switch_power_profile(adev,
-                                       PP_SMC_POWER_PROFILE_COMPUTE, !idle);
+       if (adev->powerplay.pp_funcs &&
+           adev->powerplay.pp_funcs->switch_power_profile)
+               amdgpu_dpm_switch_power_profile(adev,
+                                               PP_SMC_POWER_PROFILE_COMPUTE,
+                                               !idle);
 }
 
 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)

--
2.7.4

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB180900E62C3F2EB8C61C1FAFF7DC0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw

I pushed the change to amd-staging-drm-next. I'd also like to get it into drm-fixes. Should I cherry-pick it to your drm-fixes-4.20 branch on fd.o?

Thanks,
  Felix

Quoted 37 lines · Alexander

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> on behalf of Kuehling, Felix <[email protected]>
*Sent:* Thursday, November 15, 2018 4:56:51 PM
*To:* [email protected]
*Cc:* Kuehling, Felix; Joerg Roedel
*Subject:* [PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--

 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -0
index a9c7597..1c1fed6 100644
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct
 kgd_dev *kgd, bool idle)
  {
          struct amdgpu_device *adev = (struct amdgpu_device *)kgd;


-       amdgpu_dpm_switch_power_profile(adev,
-                                       PP_SMC_POWER_PROFILE_COMPUTE, !idle);
+       if (adev->powerplay.pp_funcs &&

Quoted 15 lines

+           adev->powerplay.pp_funcs->switch_power_profile) +               amdgpu_dpm_switch_power_profile(adev,
+
PP_SMC_POWER_PROFILE_COMPUTE,
+                                               !idle);
 }

 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)

Signature · 6 lines
2.7.4

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): f1108e8c-d330-bff3-b04b-4e79aaeabb9a-5C7GfCeVMHo@public.gmane.org

#6 lore raw

I'll grab it for my -fixes pull this week.

Alex

________________________________
From: Kuehling, Felix
Sent: Monday, November 19, 2018 3:02:27 PM
To: Deucher, Alexander; [email protected]
Cc: Joerg Roedel
Subject: Re: [PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

I pushed the change to amd-staging-drm-next. I'd also like to get it into drm-fixes. Should I cherry-pick it to your drm-fixes-4.20 branch on fd.o?

Thanks,
Felix

Quoted 44 lines · Alexander

------------------------------------------------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Kuehling, Felix <[email protected]>
*Sent:* Thursday, November 15, 2018 4:56:51 PM
*To:* [email protected]
*Cc:* Kuehling, Felix; Joerg Roedel
*Subject:* [PATCH] drm/amdgpu: Fix oops when
pp_funcs->switch_power_profile is unset

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -2
index a9c7597..1c1fed6 100644
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct
 kgd_dev *kgd, bool idle)
 {
         struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 
-       amdgpu_dpm_switch_power_profile(adev,
-                                       PP_SMC_POWER_PROFILE_COMPUTE,
 !idle);
+       if (adev->powerplay.pp_funcs &&
+           adev->powerplay.pp_funcs->switch_power_profile)
+               amdgpu_dpm_switch_power_profile(adev,
+
 PP_SMC_POWER_PROFILE_COMPUTE,
+                                               !idle);

}

Quoted 8 lines

bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)
--
2.7.4

_______________________________________________
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

Tested-by
#7 lore raw
In reply to a message not in the archive
Quoted 10 lines · Felix

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Tested on my Kaveri box and the issue is fixed, thanks!

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

#8 lore raw
In reply to a message not in the archive

Am 15.11.18 um 22:56 schrieb Kuehling, Felix:

Quoted 7 lines

On Vega20 and other pre-production GPUs, powerplay is not enabled yet. Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -0
index a9c7597..1c1fed6 100644
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle) · line 513

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +5 -2
-	amdgpu_dpm_switch_power_profile(adev,
-					PP_SMC_POWER_PROFILE_COMPUTE, !idle);
+	if (adev->powerplay.pp_funcs &&
+	    adev->powerplay.pp_funcs->switch_power_profile)
+		amdgpu_dpm_switch_power_profile(adev,
+						PP_SMC_POWER_PROFILE_COMPUTE,
+						!idle);
  }
 
  bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)

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