Skip to content

Commit 7f3cfb7

Browse files
sohilmehrafaeljw
authored andcommitted
cpufreq: ondemand: Update the efficient idle check for Intel extended Families
IO time is considered busy by default for modern Intel processors. The current check covers recent Family 6 models but excludes the brand new Families 18 and 19. According to Arjan van de Ven, the model check was mainly due to a lack of testing on systems before INTEL_CORE2_MEROM. He suggests considering all Intel processors as having an efficient idle. Extend the IO busy classification to all Intel processors starting with Family 6, including Family 15 (Pentium 4s) and upcoming Families 18/19. Use an x86 VFM check and move the function to the header file to avoid using arch-specific #ifdefs in the C file. Signed-off-by: Sohil Mehta <sohil.mehta@intel.com> Link: https://patch.msgid.link/20250908230655.2562440-1-sohil.mehta@intel.com [ rjw: Added empty line after #include ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 5590db4 commit 7f3cfb7

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

drivers/cpufreq/cpufreq_ondemand.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,6 @@ static struct od_ops od_ops;
2929

3030
static unsigned int default_powersave_bias;
3131

32-
/*
33-
* Not all CPUs want IO time to be accounted as busy; this depends on how
34-
* efficient idling at a higher frequency/voltage is.
35-
* Pavel Machek says this is not so for various generations of AMD and old
36-
* Intel systems.
37-
* Mike Chan (android.com) claims this is also not true for ARM.
38-
* Because of this, whitelist specific known (series) of CPUs by default, and
39-
* leave all others up to the user.
40-
*/
41-
static int should_io_be_busy(void)
42-
{
43-
#if defined(CONFIG_X86)
44-
/*
45-
* For Intel, Core 2 (model 15) and later have an efficient idle.
46-
*/
47-
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
48-
boot_cpu_data.x86 == 6 &&
49-
boot_cpu_data.x86_model >= 15)
50-
return 1;
51-
#endif
52-
return 0;
53-
}
54-
5532
/*
5633
* Find right freq to be set now with powersave_bias on.
5734
* Returns the freq_hi to be used right now and will set freq_hi_delay_us,
@@ -377,7 +354,7 @@ static int od_init(struct dbs_data *dbs_data)
377354
dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
378355
dbs_data->ignore_nice_load = 0;
379356
tuners->powersave_bias = default_powersave_bias;
380-
dbs_data->io_is_busy = should_io_be_busy();
357+
dbs_data->io_is_busy = od_should_io_be_busy();
381358

382359
dbs_data->tuners = tuners;
383360
return 0;

drivers/cpufreq/cpufreq_ondemand.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,26 @@ static inline struct od_policy_dbs_info *to_dbs_info(struct policy_dbs_info *pol
2424
struct od_dbs_tuners {
2525
unsigned int powersave_bias;
2626
};
27+
28+
#ifdef CONFIG_X86
29+
#include <asm/cpu_device_id.h>
30+
31+
/*
32+
* Not all CPUs want IO time to be accounted as busy; this depends on
33+
* how efficient idling at a higher frequency/voltage is.
34+
*
35+
* Pavel Machek says this is not so for various generations of AMD and
36+
* old Intel systems. Mike Chan (android.com) claims this is also not
37+
* true for ARM.
38+
*
39+
* Because of this, select a known series of Intel CPUs (Family 6 and
40+
* later) by default, and leave all others up to the user.
41+
*/
42+
static inline bool od_should_io_be_busy(void)
43+
{
44+
return (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
45+
boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO);
46+
}
47+
#else
48+
static inline bool od_should_io_be_busy(void) { return false; }
49+
#endif

0 commit comments

Comments
 (0)