* [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
@ 2025-01-03 7:41 Lifeng Zheng
2025-01-03 16:56 ` Mario Limonciello
0 siblings, 1 reply; 6+ messages in thread
From: Lifeng Zheng @ 2025-01-03 7:41 UTC (permalink / raw)
To: rafael, viresh.kumar, mario.limonciello, perry.yuan
Cc: linux-pm, linux-kernel, linuxarm, jonathan.cameron, zhanjie9,
lihuisong, zhenglifeng1, fanghao11
Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
boost state") sets per-policy boost flag to false when boost fail.
However, this boost flag will be set to reverse value in
store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
will cause the per-policy boost flag set to true when fail to set boost.
Remove the extra assignment in amd_pstate_set_boost() and keep all
operations on per-policy boost flag outside of set_boost() to fix this
problem.
Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
drivers/cpufreq/amd-pstate.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 66e5dfc711c0..4ce923788f3a 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
mutex_lock(&amd_pstate_driver_lock);
ret = amd_pstate_cpu_boost_update(policy, state);
WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
- policy->boost_enabled = !ret ? state : false;
refresh_frequency_limits(policy);
mutex_unlock(&amd_pstate_driver_lock);
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
2025-01-03 7:41 [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail Lifeng Zheng
@ 2025-01-03 16:56 ` Mario Limonciello
2025-01-06 7:54 ` zhenglifeng (A)
2025-01-08 1:31 ` zhenglifeng (A)
0 siblings, 2 replies; 6+ messages in thread
From: Mario Limonciello @ 2025-01-03 16:56 UTC (permalink / raw)
To: Lifeng Zheng, rafael, viresh.kumar, perry.yuan
Cc: linux-pm, linux-kernel, linuxarm, jonathan.cameron, zhanjie9,
lihuisong, fanghao11
On 1/3/2025 01:41, Lifeng Zheng wrote:
> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
> boost state") sets per-policy boost flag to false when boost fail.
> However, this boost flag will be set to reverse value in
> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
> will cause the per-policy boost flag set to true when fail to set boost.
> Remove the extra assignment in amd_pstate_set_boost() and keep all
> operations on per-policy boost flag outside of set_boost() to fix this
> problem.
>
> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
> ---
Hi There,
Thanks for the patch. Unfortunately, it doesn't apply to the current
linux-next branch at
https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git
Although the issue you identified is still valid, there have been other
contextual changes in the function [1]. Can you rebase on that branch,
test it again and send a v2?
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/tree/drivers/cpufreq/amd-pstate.c?h=linux-next#n750
Thanks!
> drivers/cpufreq/amd-pstate.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 66e5dfc711c0..4ce923788f3a 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
> mutex_lock(&amd_pstate_driver_lock);
> ret = amd_pstate_cpu_boost_update(policy, state);
> WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
> - policy->boost_enabled = !ret ? state : false;
> refresh_frequency_limits(policy);
> mutex_unlock(&amd_pstate_driver_lock);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
2025-01-03 16:56 ` Mario Limonciello
@ 2025-01-06 7:54 ` zhenglifeng (A)
2025-01-08 1:31 ` zhenglifeng (A)
1 sibling, 0 replies; 6+ messages in thread
From: zhenglifeng (A) @ 2025-01-06 7:54 UTC (permalink / raw)
To: Mario Limonciello, rafael, viresh.kumar, perry.yuan
Cc: linux-pm, linux-kernel, linuxarm, jonathan.cameron, zhanjie9,
lihuisong, fanghao11
On 2025/1/4 0:56, Mario Limonciello wrote:
> On 1/3/2025 01:41, Lifeng Zheng wrote:
>> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
>> boost state") sets per-policy boost flag to false when boost fail.
>> However, this boost flag will be set to reverse value in
>> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
>> will cause the per-policy boost flag set to true when fail to set boost.
>> Remove the extra assignment in amd_pstate_set_boost() and keep all
>> operations on per-policy boost flag outside of set_boost() to fix this
>> problem.
>>
>> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>> ---
>
> Hi There,
>
> Thanks for the patch. Unfortunately, it doesn't apply to the current linux-next branch at https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git
>
> Although the issue you identified is still valid, there have been other contextual changes in the function [1]. Can you rebase on that branch, test it again and send a v2?
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/tree/drivers/cpufreq/amd-pstate.c?h=linux-next#n750
>
> Thanks!
Thanks, I'll test on this branch and send a v2.
>
>> drivers/cpufreq/amd-pstate.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>> index 66e5dfc711c0..4ce923788f3a 100644
>> --- a/drivers/cpufreq/amd-pstate.c
>> +++ b/drivers/cpufreq/amd-pstate.c
>> @@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
>> mutex_lock(&amd_pstate_driver_lock);
>> ret = amd_pstate_cpu_boost_update(policy, state);
>> WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
>> - policy->boost_enabled = !ret ? state : false;
>> refresh_frequency_limits(policy);
>> mutex_unlock(&amd_pstate_driver_lock);
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
2025-01-03 16:56 ` Mario Limonciello
2025-01-06 7:54 ` zhenglifeng (A)
@ 2025-01-08 1:31 ` zhenglifeng (A)
2025-01-08 2:26 ` Mario Limonciello
1 sibling, 1 reply; 6+ messages in thread
From: zhenglifeng (A) @ 2025-01-08 1:31 UTC (permalink / raw)
To: Mario Limonciello
Cc: rafael, viresh.kumar, perry.yuan, linux-pm, linux-kernel,
linuxarm, jonathan.cameron, zhanjie9, lihuisong, fanghao11
On 2025/1/4 0:56, Mario Limonciello wrote:
> On 1/3/2025 01:41, Lifeng Zheng wrote:
>> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
>> boost state") sets per-policy boost flag to false when boost fail.
>> However, this boost flag will be set to reverse value in
>> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
>> will cause the per-policy boost flag set to true when fail to set boost.
>> Remove the extra assignment in amd_pstate_set_boost() and keep all
>> operations on per-policy boost flag outside of set_boost() to fix this
>> problem.
>>
>> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>> ---
>
> Hi There,
>
> Thanks for the patch. Unfortunately, it doesn't apply to the current linux-next branch at https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git
Hello Mario,
When I try to build on this branch, I got an error:
arch/x86/kernel/relocate_kernel_64.o: In function `virtual_mapped':
.../linux/arch/x86/kernel/relocate_kernel_64.S:249: undefined reference to `saved_context_gdt_desc'
scripts/Makefile.vmlinux:77: recipe for target 'vmlinux' failed
This error occurs when CONFIG_KEXEC_JUMP=y, and doesn't occur when build on
torvalds master branch with same config. Please check if there is any
problem whith this branch.
>
> Although the issue you identified is still valid, there have been other contextual changes in the function [1]. Can you rebase on that branch, test it again and send a v2?
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/tree/drivers/cpufreq/amd-pstate.c?h=linux-next#n750
>
> Thanks!
>
>> drivers/cpufreq/amd-pstate.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>> index 66e5dfc711c0..4ce923788f3a 100644
>> --- a/drivers/cpufreq/amd-pstate.c
>> +++ b/drivers/cpufreq/amd-pstate.c
>> @@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
>> mutex_lock(&amd_pstate_driver_lock);
>> ret = amd_pstate_cpu_boost_update(policy, state);
>> WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
>> - policy->boost_enabled = !ret ? state : false;
>> refresh_frequency_limits(policy);
>> mutex_unlock(&amd_pstate_driver_lock);
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
2025-01-08 1:31 ` zhenglifeng (A)
@ 2025-01-08 2:26 ` Mario Limonciello
2025-01-08 9:47 ` zhenglifeng (A)
0 siblings, 1 reply; 6+ messages in thread
From: Mario Limonciello @ 2025-01-08 2:26 UTC (permalink / raw)
To: zhenglifeng (A)
Cc: rafael, viresh.kumar, perry.yuan, linux-pm, linux-kernel,
linuxarm, jonathan.cameron, zhanjie9, lihuisong, fanghao11
On 1/7/2025 19:31, zhenglifeng (A) wrote:
> On 2025/1/4 0:56, Mario Limonciello wrote:
>
>> On 1/3/2025 01:41, Lifeng Zheng wrote:
>>> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
>>> boost state") sets per-policy boost flag to false when boost fail.
>>> However, this boost flag will be set to reverse value in
>>> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
>>> will cause the per-policy boost flag set to true when fail to set boost.
>>> Remove the extra assignment in amd_pstate_set_boost() and keep all
>>> operations on per-policy boost flag outside of set_boost() to fix this
>>> problem.
>>>
>>> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
>>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>>> ---
>>
>> Hi There,
>>
>> Thanks for the patch. Unfortunately, it doesn't apply to the current linux-next branch at https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git
>
> Hello Mario,
>
> When I try to build on this branch, I got an error:
>
> arch/x86/kernel/relocate_kernel_64.o: In function `virtual_mapped':
> .../linux/arch/x86/kernel/relocate_kernel_64.S:249: undefined reference to `saved_context_gdt_desc'
> scripts/Makefile.vmlinux:77: recipe for target 'vmlinux' failed
>
> This error occurs when CONFIG_KEXEC_JUMP=y, and doesn't occur when build on
> torvalds master branch with same config. Please check if there is any
> problem whith this branch.
>
Hi,
It's because the branch is based on an earlier 6.13-rc.
Two ideas that can help you:
1) You can pull this patch manually on top of it to avoid that issue.
https://git.kernel.org/torvalds/c/aeb68937614f4
2) You can manually rebase the branch on newer 6.13-rc locally to make
your commit. That commit that fixed it landed in 6.13-rc3, so rc3 or
later would be fine.
>>
>> Although the issue you identified is still valid, there have been other contextual changes in the function [1]. Can you rebase on that branch, test it again and send a v2?
>>
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/tree/drivers/cpufreq/amd-pstate.c?h=linux-next#n750
>>
>> Thanks!
>>
>>> drivers/cpufreq/amd-pstate.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>>> index 66e5dfc711c0..4ce923788f3a 100644
>>> --- a/drivers/cpufreq/amd-pstate.c
>>> +++ b/drivers/cpufreq/amd-pstate.c
>>> @@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
>>> mutex_lock(&amd_pstate_driver_lock);
>>> ret = amd_pstate_cpu_boost_update(policy, state);
>>> WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
>>> - policy->boost_enabled = !ret ? state : false;
>>> refresh_frequency_limits(policy);
>>> mutex_unlock(&amd_pstate_driver_lock);
>>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
2025-01-08 2:26 ` Mario Limonciello
@ 2025-01-08 9:47 ` zhenglifeng (A)
0 siblings, 0 replies; 6+ messages in thread
From: zhenglifeng (A) @ 2025-01-08 9:47 UTC (permalink / raw)
To: Mario Limonciello
Cc: rafael, viresh.kumar, perry.yuan, linux-pm, linux-kernel,
linuxarm, jonathan.cameron, zhanjie9, lihuisong, fanghao11
On 2025/1/8 10:26, Mario Limonciello wrote:
> On 1/7/2025 19:31, zhenglifeng (A) wrote:
>> On 2025/1/4 0:56, Mario Limonciello wrote:
>>
>>> On 1/3/2025 01:41, Lifeng Zheng wrote:
>>>> Commit c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision
>>>> boost state") sets per-policy boost flag to false when boost fail.
>>>> However, this boost flag will be set to reverse value in
>>>> store_local_boost() and cpufreq_boost_trigger_state() in cpufreq.c. This
>>>> will cause the per-policy boost flag set to true when fail to set boost.
>>>> Remove the extra assignment in amd_pstate_set_boost() and keep all
>>>> operations on per-policy boost flag outside of set_boost() to fix this
>>>> problem.
>>>>
>>>> Fixes: c8c68c38b56f ("cpufreq: amd-pstate: initialize core precision boost state")
>>>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>>>> ---
>>>
>>> Hi There,
>>>
>>> Thanks for the patch. Unfortunately, it doesn't apply to the current linux-next branch at https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git
>>
>> Hello Mario,
>>
>> When I try to build on this branch, I got an error:
>>
>> arch/x86/kernel/relocate_kernel_64.o: In function `virtual_mapped':
>> .../linux/arch/x86/kernel/relocate_kernel_64.S:249: undefined reference to `saved_context_gdt_desc'
>> scripts/Makefile.vmlinux:77: recipe for target 'vmlinux' failed
>>
>> This error occurs when CONFIG_KEXEC_JUMP=y, and doesn't occur when build on
>> torvalds master branch with same config. Please check if there is any
>> problem whith this branch.
>>
> Hi,
>
> It's because the branch is based on an earlier 6.13-rc.
>
> Two ideas that can help you:
>
> 1) You can pull this patch manually on top of it to avoid that issue.
> https://git.kernel.org/torvalds/c/aeb68937614f4
>
> 2) You can manually rebase the branch on newer 6.13-rc locally to make your commit. That commit that fixed it landed in 6.13-rc3, so rc3 or later would be fine.
This solves the problem, thanks!
>
>>>
>>> Although the issue you identified is still valid, there have been other contextual changes in the function [1]. Can you rebase on that branch, test it again and send a v2?
>>>
>>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/tree/drivers/cpufreq/amd-pstate.c?h=linux-next#n750
>>>
>>> Thanks!
>>>
>>>> drivers/cpufreq/amd-pstate.c | 1 -
>>>> 1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
>>>> index 66e5dfc711c0..4ce923788f3a 100644
>>>> --- a/drivers/cpufreq/amd-pstate.c
>>>> +++ b/drivers/cpufreq/amd-pstate.c
>>>> @@ -730,7 +730,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
>>>> mutex_lock(&amd_pstate_driver_lock);
>>>> ret = amd_pstate_cpu_boost_update(policy, state);
>>>> WRITE_ONCE(cpudata->boost_state, !ret ? state : false);
>>>> - policy->boost_enabled = !ret ? state : false;
>>>> refresh_frequency_limits(policy);
>>>> mutex_unlock(&amd_pstate_driver_lock);
>>>>
>>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-08 9:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03 7:41 [PATCH] cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail Lifeng Zheng
2025-01-03 16:56 ` Mario Limonciello
2025-01-06 7:54 ` zhenglifeng (A)
2025-01-08 1:31 ` zhenglifeng (A)
2025-01-08 2:26 ` Mario Limonciello
2025-01-08 9:47 ` zhenglifeng (A)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).