Skip to contentSkip to conversation

drm/amd/pm: Update intermediate power state for SI

PATCH In review Lijo Lazar 3 participants 5 messages Sep 23, 2021

Subsystems (3)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amd/pm: Update intermediate power state for SI

Update the current state as boot state during dpm initialization. During the subsequent initialization, set_power_state gets called to transition to the final power state. set_power_state refers to values from the current state and without current state populated, it could result in NULL pointer dereference.

---
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +2 -0
index bdbbeb959c68..81f82aa05ec2 100644
@@ -6867,6 +6867,8 @@ static int si_dpm_enable(struct amdgpu_device *adev)
 	si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
 	si_thermal_start_thermal_controller(adev);
 
+	ni_update_current_ps(adev, boot_ps);
+
 	return 0;
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, September 23, 2021 12:30
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Update intermediate power state for SI

Update the current state as boot state during dpm initialization.
During the subsequent initialization, set_power_state gets called to transition to the final power state. set_power_state refers to values from the current state and without current state populated, it could result in NULL pointer dereference.

---
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +2 -0
index bdbbeb959c68..81f82aa05ec2 100644
@@ -6867,6 +6867,8 @@ static int si_dpm_enable(struct amdgpu_device *adev)
 	si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
 	si_thermal_start_thermal_controller(adev);
 
+	ni_update_current_ps(adev, boot_ps);
+
 	return 0;
 }
 

--
2.17.1

Acked-by on v1 1/1
#2 lore raw
In reply to Lijo Lazar
Fixes f9b7f3703ff9 ("drm/amdgpu/acpi: make ATPX/ATCS structures global (v2)")

Thanks!

Quoted 30 lines · Lijo Lazar

Update the current state as boot state during dpm initialization. During the subsequent initialization, set_power_state gets called to transition to the final power state. set_power_state refers to values from the current state and without current state populated, it could result in NULL pointer dereference.

---
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +2 -1
index bdbbeb959c68..81f82aa05ec2 100644
@@ -6867,6 +6867,8 @@ static int si_dpm_enable(struct amdgpu_device *adev)
        si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
        si_thermal_start_thermal_controller(adev);
 
+       ni_update_current_ps(adev, boot_ps);
+
        return 0;
 }
 
--

2.17.1

author Acked-by Alex Deucher
#3 lore raw

[AMD Official Use Only]

Hi Alex,

"Fixes" tag - I interpret it as fixes some broken logic in the earlier patch. This one doesn't fix f9b7f3703ff9 ("drm/amdgpu/acpi: make ATPX/ATCS structures global (v2)"). That patch's logic works well and is fine as it is.

May be add a reference or some more details in the comments?

Thanks,
Lijo

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, September 23, 2021 6:21 PM
To: Lazar, Lijo <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Update intermediate power state for SI

Fixes f9b7f3703ff9 ("drm/amdgpu/acpi: make ATPX/ATCS structures global (v2)")

Thanks!

Quoted 37 lines · Lijo Lazar

Update the current state as boot state during dpm initialization. During the subsequent initialization, set_power_state gets called to transition to the final power state. set_power_state refers to values from the current state and without current state populated, it could result in NULL pointer dereference.

gitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1698&amp;data=04%7C0 1%7Clijo.lazar%40amd.com%7C8a10ba2a0d7d4896ed1408d97e90d3cc%7C3dd8961f e4884e608e11a82d994e183d%7C0%7C0%7C637679982775776349%7CUnknown%7CTWFp bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn 0%3D%7C1000&amp;sdata=gTpG97DwoTSYBTN%2BSZYiAAL4o1VjG5n%2BaHu65s%2BADG E%3D&amp;reserved=0

---
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +2 -1
index bdbbeb959c68..81f82aa05ec2 100644
@@ -6867,6 +6867,8 @@ static int si_dpm_enable(struct amdgpu_device *adev)
        si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
        si_thermal_start_thermal_controller(adev);
 
+       ni_update_current_ps(adev, boot_ps);
+
        return 0;
 }
 
--

2.17.1

#4 lore raw
Quoted 8 lines · Lijo

[AMD Official Use Only]

Hi Alex,

"Fixes" tag - I interpret it as fixes some broken logic in the earlier patch. This one doesn't fix f9b7f3703ff9 ("drm/amdgpu/acpi: make ATPX/ATCS structures global (v2)"). That patch's logic works well and is fine as it is.

May be add a reference or some more details in the comments?

yeah, probably skip that fixes tag. I suspect this bug was there from when dpm support was first added for SI if you want to dig up that commit, otherwise, I can just send it out for stable as is with the bug reference.

Alex

Quoted 54 lines

Thanks,
Lijo

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, September 23, 2021 6:21 PM
To: Lazar, Lijo <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Feng, Kenneth <[email protected]>; Quan, Evan <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Update intermediate power state for SI

Fixes f9b7f3703ff9 ("drm/amdgpu/acpi: make ATPX/ATCS structures global (v2)")

Thanks!

Quoted 37 lines · Lijo Lazar

Update the current state as boot state during dpm initialization. During the subsequent initialization, set_power_state gets called to transition to the final power state. set_power_state refers to values from the current state and without current state populated, it could result in NULL pointer dereference.

gitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1698&amp;data=04%7C0 1%7Clijo.lazar%40amd.com%7C8a10ba2a0d7d4896ed1408d97e90d3cc%7C3dd8961f e4884e608e11a82d994e183d%7C0%7C0%7C637679982775776349%7CUnknown%7CTWFp bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn 0%3D%7C1000&amp;sdata=gTpG97DwoTSYBTN%2BSZYiAAL4o1VjG5n%2BaHu65s%2BADG E%3D&amp;reserved=0

---
 drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +2 -1
index bdbbeb959c68..81f82aa05ec2 100644
@@ -6867,6 +6867,8 @@ static int si_dpm_enable(struct amdgpu_device *adev)
        si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
        si_thermal_start_thermal_controller(adev);
 
+       ni_update_current_ps(adev, boot_ps);
+
        return 0;
 }
 
--

2.17.1