cpufreq: ondemand: Update the efficient idle check for Intel extended Families
PATCH v3 1/1 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.
---
v3:
- Posting this patch separately since the core family cleanup series was merged without it.
- Improve commit message and code comments.
v2: https://lore.kernel.org/lkml/[email protected]/
--- drivers/cpufreq/cpufreq_ondemand.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/cpufreq/cpufreq_ondemand.c +6 -5
@@ -15,6 +15,10 @@#include <linux/tick.h> #include <linux/sched/cpufreq.h> +#ifdef CONFIG_X86 +#include <asm/cpu_device_id.h> +#endif +#include "cpufreq_ondemand.h" /* On-demand governor macros */
@@ -41,12 +45,9 @@ static unsigned int default_powersave_bias;static int should_io_be_busy (void ) {#if defined(CONFIG_X86 ) -/* -* For Intel, Core 2 (model 15) and later have an efficient idle. -*/ +/* For Intel, Family 6 and later have an efficient idle. */ if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && - boot_cpu_data.x86 ==6 && - boot_cpu_data.x86_model >=15 ) + boot_cpu_data.x86_vfm >=INTEL_PENTIUM_PRO )return 1 ;#endif return 0 ;
Signature · 1 line
2.43.0
Rafael J. Wysocki
maintainerQuoted 29 lines · Sohil Mehta
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.
Signed-off-by Sohil Mehta <[email protected]>---
v3:
- Posting this patch separately since the core family cleanup series was merged without it.
- Improve commit message and code comments.v2: https://lore.kernel.org/lkml/[email protected]/
--- drivers/cpufreq/cpufreq_ondemand.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/cpufreq/cpufreq_ondemand.c +0
-0
drivers/cpufreq/cpufreq_ondemand.c line 16
Quoted 2 lines
drivers/cpufreq/cpufreq_ondemand.c +0
-0@@ -15,6 +15,10 @@#include <linux/tick.h> #include <linux/sched/cpufreq.h>
Since you are adding this #ifdef below, why don't you go a bit farther and do
drivers/cpufreq/cpufreq_ondemand.c line 19
Quoted 2 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-0+#ifdef CONFIG_X86 +#include <asm/cpu_device_id.h>
static bool should_io_be_busy(void)
{
/* All Intel Family 6 and later processors have efficient idle. */
return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO;
}
#else
static inline bool should_io_be_busy(void)
{
return false;
}Quoted 21 lines
drivers/cpufreq/cpufreq_ondemand.c +4
-6+#endif +#include "cpufreq_ondemand.h" /* On-demand governor macros */ @@ -41,12 +45,9 @@ static unsigned int default_powersave_bias;static int should_io_be_busy (void ) {#if defined(CONFIG_X86 ) -/* -* For Intel, Core 2 (model 15) and later have an efficient idle. -*/ +/* For Intel, Family 6 and later have an efficient idle. */ if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && - boot_cpu_data.x86 ==6 && - boot_cpu_data.x86_model >=15 ) + boot_cpu_data.x86_vfm >=INTEL_PENTIUM_PRO )return 1 ;#endif return 0 ; --
Quoted 14 lines · Rafael J. Wysocki
Since you are adding this #ifdef below, why don't you go a bit farther and do
drivers/cpufreq/cpufreq_ondemand.c line 19
Quoted 2 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-0+#ifdef CONFIG_X86 +#include <asm/cpu_device_id.h> static bool
should_io_be_busy(void){ /* All Intel Family 6 and later processors have efficient idle. */ return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&boot_cpu_data.x86_vfm >=
INTEL_PENTIUM_PRO;
}
#else
static inline boolshould_io_be_busy(void)
Quoted 7 lines
{ return false; }drivers/cpufreq/cpufreq_ondemand.c line 22
Quoted 4 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-0+#endif +#include "cpufreq_ondemand.h"
I am fine with this approach. Would moving the #define to the header be slightly better?
Add to cpufreq_ondemand.h:
#ifdef CONFIG_X86
#include <asm/cpu_device_id.h>
bool od_should_io_be_busy(void);
#else
static inline bool od_should_io_be_busy(void) { return false; } #endif
Then, cpufreq_ondemand.c doesn't need the #ifdefs. It can simply do:
bool od_should_io_be_busy(void)
{
/* For Intel, Family 6 and later have an efficient idle. */
return (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO);
}Rafael J. Wysocki
maintainerQuoted 20 lines · Sohil Mehta
Quoted 17 lines · Rafael J. Wysocki
Since you are adding this #ifdef below, why don't you go a bit farther and do
drivers/cpufreq/cpufreq_ondemand.c line 19
Quoted 2 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-0+#ifdef CONFIG_X86 +#include <asm/cpu_device_id.h> static bool
should_io_be_busy(void){ /* All Intel Family 6 and later processors have efficient idle. */ return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&boot_cpu_data.x86_vfm >=
INTEL_PENTIUM_PRO;
}
#else
static inline boolshould_io_be_busy(void){ return false; }
Quoted 7 lines
Quoted 4 lines
drivers/cpufreq/cpufreq_ondemand.c line 22
Quoted 4 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-0+#endif +#include "cpufreq_ondemand.h" I am fine with this approach. Would moving the #define to the header be slightly better?
I think so.
Quoted 9 lines
Add to
cpufreq_ondemand.h:#ifdef
CONFIG_X86
#include <asm/cpu_device_id.h>
boolod_should_io_be_busy(void);
#else
static inline boolod_should_io_be_busy(void){ return false; } #endif
Quoted 8 lines
Then,
cpufreq_ondemand.cdoesn't need the #ifdefs. It can simply do:bool
od_should_io_be_busy(void){ /* For Intel, Family 6 and later have an efficient idle. */ return (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && boot_cpu_data.x86_vfm >= INTEL_PENTIUM_PRO); }
You'd still need to put the above under #ifdef CONFIG_X86 though.
But it may as well go into the header as static inline in the CONFIG_X86 case.
Quoted 1 line · Rafael J. Wysocki
But it may as well go into the header as static inline in the
CONFIG_X86case.
Makes sense. Will do.