summaryrefslogtreecommitdiff
path: root/drivers/cpufreq
AgeCommit message (Collapse)Author
2025-02-20cpufreq: governor: Fix negative 'idle_time' handling in dbs_update()Jie Zhan
We observed an issue that the CPU frequency can't raise up with a 100% CPU load when NOHZ is off and the 'conservative' governor is selected. 'idle_time' can be negative if it's obtained from get_cpu_idle_time_jiffy() when NOHZ is off. This was found and explained in commit 9485e4ca0b48 ("cpufreq: governor: Fix handling of special cases in dbs_update()"). However, commit 7592019634f8 ("cpufreq: governors: Fix long idle detection logic in load calculation") introduced a comparison between 'idle_time' and 'samling_rate' to detect a long idle interval. While 'idle_time' is converted to int before comparison, it's actually promoted to unsigned again when compared with an unsigned 'sampling_rate'. Hence, this leads to wrong idle interval detection when it's in fact 100% busy and sets policy_dbs->idle_periods to a very large value. 'conservative' adjusts the frequency to minimum because of the large 'idle_periods', such that the frequency can't raise up. 'Ondemand' doesn't use policy_dbs->idle_periods so it fortunately avoids the issue. Correct negative 'idle_time' to 0 before any use of it in dbs_update(). Fixes: 7592019634f8 ("cpufreq: governors: Fix long idle detection logic in load calculation") Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com> Reviewed-by: Chen Yu <yu.c.chen@intel.com> Link: https://patch.msgid.link/20250213035510.2402076-1-zhanjie9@hisilicon.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-02-19cpufreq: enable 1200Mhz clock speed for armada-37xxBenjamin Schneider
This frequency was disabled because of stability problems whose source could not be accurately identified[1]. After seven months of testing, the evidence points to an incorrectly configured bootloader as the source of the historical instability. Testing was performed on two A3720 devices with this frequency enabled and the ondemand policy in use. Marvell merged[2] changes to their bootloader source needed to address the stability issue. This driver should expose this frequency option to users. [1] https://github.com/torvalds/linux/commit/484f2b7c61b9ae58cc00c5127bcbcd9177af8dfe [2] https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/44 Signed-off-by: Benjamin Schneider <ben@bens.haus> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-18cpufreq: intel_pstate: Make it possible to avoid enabling CASRafael J. Wysocki
Capacity-aware scheduling (CAS) is enabled by default by intel_pstate on hybrid systems without SMT, but in some usage scenarios it may be more attractive to place tasks for maximum CPU performance regardless of the extra cost in terms of energy, which is the case on such systems when CAS is not enabled, so introduce a command line option to forbid intel_pstate to enable CAS. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by:Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/2781262.mvXUDI8C0e@rjwysocki.net
2025-02-17cpufreq: Introduce an optional cpuinfo_avg_freq sysfs entryBeata Michalska
Currently the CPUFreq core exposes two sysfs attributes that can be used to query current frequency of a given CPU(s): namely cpuinfo_cur_freq and scaling_cur_freq. Both provide slightly different view on the subject and they do come with their own drawbacks. cpuinfo_cur_freq provides higher precision though at a cost of being rather expensive. Moreover, the information retrieved via this attribute is somewhat short lived as frequency can change at any point of time making it difficult to reason from. scaling_cur_freq, on the other hand, tends to be less accurate but then the actual level of precision (and source of information) varies between architectures making it a bit ambiguous. The new attribute, cpuinfo_avg_freq, is intended to provide more stable, distinct interface, exposing an average frequency of a given CPU(s), as reported by the hardware, over a time frame spanning no more than a few milliseconds. As it requires appropriate hardware support, this interface is optional. Note that under the hood, the new attribute relies on the information provided by arch_freq_get_on_cpu, which, up to this point, has been feeding data for scaling_cur_freq attribute, being the source of ambiguity when it comes to interpretation. This has been amended by restoring the intended behavior for scaling_cur_freq, with a new dedicated config option to maintain status quo for those, who may need it. CC: Jonathan Corbet <corbet@lwn.net> CC: Thomas Gleixner <tglx@linutronix.de> CC: Ingo Molnar <mingo@redhat.com> CC: Borislav Petkov <bp@alien8.de> CC: Dave Hansen <dave.hansen@linux.intel.com> CC: H. Peter Anvin <hpa@zytor.com> CC: Phil Auld <pauld@redhat.com> CC: x86@kernel.org CC: linux-doc@vger.kernel.org Signed-off-by: Beata Michalska <beata.michalska@arm.com> Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> Reviewed-by: Sumit Gupta <sumitg@nvidia.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20250131162439.3843071-3-beata.michalska@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2025-02-17cpufreq: Allow arch_freq_get_on_cpu to return an errorBeata Michalska
Allow arch_freq_get_on_cpu to return an error for cases when retrieving current CPU frequency is not possible, whether that being due to lack of required arch support or due to other circumstances when the current frequency cannot be determined at given point of time. Signed-off-by: Beata Michalska <beata.michalska@arm.com> Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20250131162439.3843071-2-beata.michalska@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2025-02-07cpufreq: Remove cpufreq_enable_boost_support()Viresh Kumar
Remove the now unused helper, cpufreq_enable_boost_support(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: staticize policy_has_boost_freq()Viresh Kumar
policy_has_boost_freq() isn't used outside of freq_table.c now, mark it static. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: qcom: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: dt: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: scmi: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
2025-02-07cpufreq: powernv: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: loongson: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: apple: Set .set_boost directlyViresh Kumar
The boost feature can be controlled at two levels currently, driver level (applies to all policies) and per-policy. Currently the driver enables driver level boost support from the per-policy ->init() callback, which isn't really efficient as that gets called for each policy and then there is online/offline path too where this gets done unnecessarily. Instead set the .set_boost field directly and always enable the boost support. If a policy doesn't support boost feature, the core will not enable it for that policy. Keep the initial state of driver level boost to disabled and let the user enable it if required as ideally the boost frequencies must be used only when really required. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: Restrict enabling boost on policies with no boost frequenciesViresh Kumar
It is possible to have a scenario where not all cpufreq policies support boost frequencies. And letting sysfs (or other parts of the kernel) enable boost feature for that policy isn't correct. Now that all drivers (that required a change) are updated to set the policy->boost_supported properly, check this flag before enabling boost feature for a policy. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: cppc: Set policy->boost_supportedViresh Kumar
With a later commit, the cpufreq core will call the ->set_boost() callback only if the policy supports boost frequency. The boost_supported flag is set by the cpufreq core if policy->freq_table is set and one or more boost frequencies are present. For other drivers, the flag must be set explicitly. With this, the local variable boost_supported isn't required anymore. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: amd: Set policy->boost_supportedViresh Kumar
With a later commit, the cpufreq core will call the ->set_boost() callback only if the policy supports boost frequency. The boost_supported flag is set by the cpufreq core if policy->freq_table is set and one or more boost frequencies are present. For other drivers, the flag must be set explicitly. The policy->boost_enabled flag is set by the cpufreq core once the policy is initialized, don't set it anymore. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: acpi: Set policy->boost_supportedViresh Kumar
With a later commit, the cpufreq core will call the ->set_boost() callback only if the policy supports boost frequency. The boost_supported flag is set by the cpufreq core if policy->freq_table is set and one or more boost frequencies are present. For other drivers, the flag must be set explicitly. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: Introduce policy->boost_supported flagViresh Kumar
It is possible to have a scenario where not all cpufreq policies support boost frequencies. And letting sysfs (or other parts of the kernel) enable boost feature for that policy isn't correct. Add a new flag, boost_supported, which will be set to true by the cpufreq core only if the freq table contains valid boost frequencies. Some cpufreq drivers though don't have boost frequencies in the freq-table, they can set this flag from their ->init() callbacks. Once all the drivers are updated to set the flag correctly, we can check it before enabling boost feature for a policy. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: Export cpufreq_boost_set_sw()Viresh Kumar
This will be used directly by cpufreq driver going forward, export it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: staticize cpufreq_boost_trigger_state()Viresh Kumar
cpufreq_boost_trigger_state() is only used by cpufreq core, mark it static. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2025-02-07cpufreq: Stop checking for duplicate available/boost freq attributesViresh Kumar
None of the drivers set these attributes directly now, remove the unnecessary check. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: Remove cpufreq_generic_attrsViresh Kumar
All users of cpufreq_generic_attr are migrated now, remove it. While at it, also stop exporting attributes for available and boost frequencies as they are only used by cpufreq core now. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: virtual: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: vexpress: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: tegra: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: speedstep: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: spear: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: sh: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: scpi: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: scmi: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: sc520_freq: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: qoriq: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: qcom: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: powernv: Stop setting common freq attributesViresh Kumar
The cpufreq core handles this now, the driver can skip setting it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: powernow: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: pmac: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: pasemi: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: p4: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: omap: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: mediatek: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: loongson: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: longhaul: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: kirkwood: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: imx6q: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: elanfreq: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: e_powersaver: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: davinci: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: brcmstb: Stop setting common freq attributesViresh Kumar
The cpufreq core handles this now, the driver can skip setting it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: bmips: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2025-02-07cpufreq: apple: Stop setting cpufreq_driver->attr fieldViresh Kumar
The cpufreq core now handles this for basic attributes, including boost frequencies, the driver can skip setting them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org>