All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] cpufreq: Introduce boot frequency QoS
@ 2025-12-08 10:59 Pierre Gondois
  2025-12-08 10:59 ` [PATCH v2 1/3] cpufreq: Add boost_freq_req QoS request Pierre Gondois
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Pierre Gondois @ 2025-12-08 10:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Christian Loehle, Ionela Voinescu, zhenglifeng1, Jie Zhan,
	Pierre Gondois, Huang Rui, Gautham R. Shenoy, Mario Limonciello,
	Perry Yuan, Rafael J. Wysocki, Viresh Kumar, linux-pm

The Power Management Quality of Service (PM QoS) allows to
aggregate constraints from multiple entities. It is currently
used to manage the min/max frequency of a given policy.

Frequency constraints can come from:
- Thermal framework: acpi_thermal_cpufreq_init()
- Firmware: _PPC objects: acpi_processor_ppc_init()
- User: by setting policyX/scaling_[min|max]_freq
The minimum of the max frequency constraints is used to compute
the resulting maximum allowed frequency.

When enabling boost frequencies, the same frequency request object
(policy->max_freq_req) as to handle requests from users is used.
As a result, when setting:
- scaling_max_freq
- boost
The last sysfs file used overwrites the request from the other
sysfs file.

To avoid this:
1. Create a per-policy boost_freq_req to save the boost
constraints instead of overwriting the last scaling_max_freq
constraint.

2. policy_set_boost() calls the cpufreq set_boost callback.
Update the newly added boost_freq_req request from there:
- whenever boost is toggled
- to cover all possible paths

3. In the existing set_boost() callbacks:
- Don't update policy->max as this is done through the qos notifier
  cpufreq_notifier_max() which calls cpufreq_set_policy().
- Remove freq_qos_update_request() calls as the qos request is now
  done in policy_set_boost() and updates the new boost_freq_req

------------

E.g.:
On a Juno with available frequencies: 600.000, 1.000.000
Boost frequencies: 1.200.000
Using the cppc-cpufreq driver.

---
Without the patches:
# ## Init state
scaling_max_freq:1000000
cpuinfo_max_freq:1000000

# echo 700000 > scaling_max_freq
scaling_max_freq:700000
cpuinfo_max_freq:1000000

# echo 1 > ../boost
scaling_max_freq:1200000
cpuinfo_max_freq:1200000

# echo 800000 > scaling_max_freq
scaling_max_freq:800000
cpuinfo_max_freq:1200000

# echo 0 > ../boost
scaling_max_freq:1000000
cpuinfo_max_freq:1000000

---
With the patches:
# ## Init
scaling_max_freq:1000000
cpuinfo_max_freq:1000000

# echo 700000 > scaling_max_freq
scaling_max_freq:700000
cpuinfo_max_freq:1000000

# echo 1 > ../boost
scaling_max_freq:700000
cpuinfo_max_freq:1200000

# echo 800000 > scaling_max_freq
scaling_max_freq:800000
cpuinfo_max_freq:1200000

# echo 0 > ../boost
scaling_max_freq:800000
cpuinfo_max_freq:1000000

---

With the patches, the maximum scaling frequency requested is
conserved even though boosting is enabled/disabled.

The patches might be eligible for a stable tag.

------------

v1 -> v2:
- Don't call blocking_notifier_call_chain() when freeing boost_freq_req
- Free boost_freq_req before max_freq_req
- Removed unused 'ret' variable
- Merged patch:
Revert "cpufreq: Fix re-boost issue after hotplugging a CPU"
into:
cpufreq: Update set_boost callbacks to rely on boost_freq_req

Pierre Gondois (3):
  cpufreq: Add boost_freq_req QoS request
  cpufreq: Centralize boost freq QoS requests
  cpufreq: Update set_boost callbacks to rely on boost_freq_req

 drivers/cpufreq/amd-pstate.c   |  2 --
 drivers/cpufreq/cppc_cpufreq.c | 21 +++----------
 drivers/cpufreq/cpufreq.c      | 54 +++++++++++++++++++++++++---------
 include/linux/cpufreq.h        |  1 +
 4 files changed, 45 insertions(+), 33 deletions(-)

--
2.43.0

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

end of thread, other threads:[~2026-01-15  3:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 10:59 [PATCH v2 0/3] cpufreq: Introduce boot frequency QoS Pierre Gondois
2025-12-08 10:59 ` [PATCH v2 1/3] cpufreq: Add boost_freq_req QoS request Pierre Gondois
2025-12-10  3:01   ` zhenglifeng (A)
2025-12-17 16:21     ` Pierre Gondois
2025-12-08 10:59 ` [PATCH v2 2/3] cpufreq: Centralize boost freq QoS requests Pierre Gondois
2026-01-08  5:10   ` Viresh Kumar
2026-01-12 15:04     ` Pierre Gondois
2025-12-08 10:59 ` [PATCH v2 3/3] cpufreq: Update set_boost callbacks to rely on boost_freq_req Pierre Gondois
2025-12-10  9:26   ` zhenglifeng (A)
2025-12-17 16:22     ` Pierre Gondois
2025-12-20 10:29       ` zhenglifeng (A)
2025-12-23  8:15       ` zhenglifeng (A)
2026-01-12 15:02         ` Pierre Gondois
2026-01-13  1:30           ` Viresh Kumar
2026-01-13 12:20             ` Rafael J. Wysocki
2026-01-15  3:41               ` zhenglifeng (A)
2026-01-08  4:37 ` [PATCH v2 0/3] cpufreq: Introduce boot frequency QoS Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.