linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag
@ 2025-05-27 12:59 Shashank Balaji
  2025-05-27 12:59 ` [PATCH v2 1/2] cpufreq: userspace: set " Shashank Balaji
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 12:59 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Jonathan Corbet
  Cc: linux-pm, linux-doc, linux-kernel, Shinya Takumi,
	20250522-userspace-governor-doc-v1-1-c8a038e39084,
	Shashank Balaji

In-Reply-To: 20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com
Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
Changes in v2:
- Instead of modifying the documentation to say that variation in frequency is
possible despite setting scaling_setspeed, add the CPUFREQ_GOV_STRICT_TARGET
flag to the userspace governor to make its behaviour match the expectation when
used with the intel_pstate driver with HWP enabled
- Mention in the documentation that variation in frequency due to hardware
factors is possible
- Link to v1: https://lore.kernel.org/r/20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com

---
Shashank Balaji (2):
      cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag
      cpufreq, docs: userspace: mention variation in freq due to hw coordination

 Documentation/admin-guide/pm/cpufreq.rst | 4 +++-
 drivers/cpufreq/cpufreq_userspace.c      | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
---
base-commit: 914873bc7df913db988284876c16257e6ab772c6
change-id: 20250522-userspace-governor-doc-86380dbab3d5

Best regards,
-- 
Shashank Balaji <shashank.mahadasyam@sony.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag
  2025-05-27 12:59 [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
@ 2025-05-27 12:59 ` Shashank Balaji
  2025-05-27 12:59 ` [PATCH v2 2/2] cpufreq, docs: userspace: mention variation in freq due to hw coordination Shashank Balaji
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 12:59 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Jonathan Corbet
  Cc: linux-pm, linux-doc, linux-kernel, Shinya Takumi,
	20250522-userspace-governor-doc-v1-1-c8a038e39084,
	Shashank Balaji

When the userspace governor is used, the user intends to set a fixed CPU
frequency for a policy, for whatever reason. The CPUFREQ_GOV_STRICT_TARGET
flag is the required behaviour. Without this flag, the intel_pstate driver,
with HWP enabled, will set HWP_MIN_PERF to the target frequency and HWP_MAX_PERF
to the policy maximum, when configuring the HWP_REQUEST MSR. This lets the
hardware choose any frequency between the target frequency and the policy
maximum, which is not the intended behaviour. To fix this,
`cat scaling_setspeed > scaling_max_freq` had to be done. With this patch, that
is no longer necessary. Setting scaling_setspeed is sufficient, as expected.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 drivers/cpufreq/cpufreq_userspace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 2c42fee76daa808f0cd1c7b1ab85476e695082e9..77d62152cd386d0eea69eba347b39f055ec860ce 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -134,6 +134,7 @@ static struct cpufreq_governor cpufreq_gov_userspace = {
 	.store_setspeed	= cpufreq_set,
 	.show_setspeed	= show_speed,
 	.owner		= THIS_MODULE,
+	.flags		= CPUFREQ_GOV_STRICT_TARGET,
 };
 
 MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>, "

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] cpufreq, docs: userspace: mention variation in freq due to hw coordination
  2025-05-27 12:59 [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
  2025-05-27 12:59 ` [PATCH v2 1/2] cpufreq: userspace: set " Shashank Balaji
@ 2025-05-27 12:59 ` Shashank Balaji
  2025-06-17 10:14 ` [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
  2025-06-18 19:35 ` Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-05-27 12:59 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Jonathan Corbet
  Cc: linux-pm, linux-doc, linux-kernel, Shinya Takumi,
	20250522-userspace-governor-doc-v1-1-c8a038e39084,
	Shashank Balaji

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 Documentation/admin-guide/pm/cpufreq.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst
index 3950583f2b1549b27f568632547e22e9ef8bc167..30799f734ca5568002d790c1db0ced7454bbbc8d 100644
--- a/Documentation/admin-guide/pm/cpufreq.rst
+++ b/Documentation/admin-guide/pm/cpufreq.rst
@@ -398,7 +398,9 @@ policy limits change after that.
 
 This governor does not do anything by itself.  Instead, it allows user space
 to set the CPU frequency for the policy it is attached to by writing to the
-``scaling_setspeed`` attribute of that policy.
+``scaling_setspeed`` attribute of that policy. Though the intention may be to
+set an exact frequency for the policy, the actual frequency may vary depending
+on hardware coordination, thermal and power limits, and other factors.
 
 ``schedutil``
 -------------

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag
  2025-05-27 12:59 [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
  2025-05-27 12:59 ` [PATCH v2 1/2] cpufreq: userspace: set " Shashank Balaji
  2025-05-27 12:59 ` [PATCH v2 2/2] cpufreq, docs: userspace: mention variation in freq due to hw coordination Shashank Balaji
@ 2025-06-17 10:14 ` Shashank Balaji
  2025-06-18 19:35 ` Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Shashank Balaji @ 2025-06-17 10:14 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm, linux-doc, linux-kernel, Viresh Kumar, Jonathan Corbet,
	Shinya Takumi, 20250522-userspace-governor-doc-v1-1-c8a038e39084

Hi Rafael,

Could you please take a look at this?

Thanks

Regards,
Shashank

On Tue, May 27, 2025 at 09:59:08PM +0900, Shashank Balaji wrote:
> In-Reply-To: 20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com
> Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
> ---
> Changes in v2:
> - Instead of modifying the documentation to say that variation in frequency is
> possible despite setting scaling_setspeed, add the CPUFREQ_GOV_STRICT_TARGET
> flag to the userspace governor to make its behaviour match the expectation when
> used with the intel_pstate driver with HWP enabled
> - Mention in the documentation that variation in frequency due to hardware
> factors is possible
> - Link to v1: https://lore.kernel.org/r/20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com
> 
> ---
> Shashank Balaji (2):
>       cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag
>       cpufreq, docs: userspace: mention variation in freq due to hw coordination
> 
>  Documentation/admin-guide/pm/cpufreq.rst | 4 +++-
>  drivers/cpufreq/cpufreq_userspace.c      | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> ---
> base-commit: 914873bc7df913db988284876c16257e6ab772c6
> change-id: 20250522-userspace-governor-doc-86380dbab3d5
> 
> Best regards,
> -- 
> Shashank Balaji <shashank.mahadasyam@sony.com>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag
  2025-05-27 12:59 [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
                   ` (2 preceding siblings ...)
  2025-06-17 10:14 ` [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
@ 2025-06-18 19:35 ` Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2025-06-18 19:35 UTC (permalink / raw)
  To: Shashank Balaji
  Cc: Rafael J. Wysocki, Viresh Kumar, Jonathan Corbet, linux-pm,
	linux-doc, linux-kernel, Shinya Takumi,
	20250522-userspace-governor-doc-v1-1-c8a038e39084

On Tue, May 27, 2025 at 3:00 PM Shashank Balaji
<shashank.mahadasyam@sony.com> wrote:
>
> In-Reply-To: 20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com
> Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
> ---
> Changes in v2:
> - Instead of modifying the documentation to say that variation in frequency is
> possible despite setting scaling_setspeed, add the CPUFREQ_GOV_STRICT_TARGET
> flag to the userspace governor to make its behaviour match the expectation when
> used with the intel_pstate driver with HWP enabled
> - Mention in the documentation that variation in frequency due to hardware
> factors is possible
> - Link to v1: https://lore.kernel.org/r/20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com
>
> ---
> Shashank Balaji (2):
>       cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag
>       cpufreq, docs: userspace: mention variation in freq due to hw coordination
>
>  Documentation/admin-guide/pm/cpufreq.rst | 4 +++-
>  drivers/cpufreq/cpufreq_userspace.c      | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> ---

Both patches applied as 6.17 material, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-18 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 12:59 [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
2025-05-27 12:59 ` [PATCH v2 1/2] cpufreq: userspace: set " Shashank Balaji
2025-05-27 12:59 ` [PATCH v2 2/2] cpufreq, docs: userspace: mention variation in freq due to hw coordination Shashank Balaji
2025-06-17 10:14 ` [PATCH v2 0/2] cpufreq: userspace: add CPUFREQ_GOV_STRICT_TARGET flag Shashank Balaji
2025-06-18 19:35 ` Rafael J. Wysocki

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).