diff mbox series

[v2,06/17] cpufreq: Fix the efficient idle check for Intel extended Families

Message ID 20250211194407.2577252-7-sohil.mehta@intel.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series Prepare for new Intel Family numbers | expand

Commit Message

Sohil Mehta Feb. 11, 2025, 7:43 p.m. UTC
IO time is considered as busy by default for modern Intel processors.
However the check doesn't include the upcoming Family 18 and 19
processors. Also, Arjan van de Ven says the current nature of the check
was mainly due to lack of testing on old systems. He suggests
considering all Intel processors as having efficient idle.

Extend the IO busy classification to all Intel processors starting with
Family 6.

Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>

---

v2: Improve commit message and code comments.

---
 drivers/cpufreq/cpufreq_ondemand.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Zhang, Rui Feb. 12, 2025, 5:35 a.m. UTC | #1
On Tue, 2025-02-11 at 19:43 +0000, Sohil Mehta wrote:
> IO time is considered as busy by default for modern Intel processors.
> However the check doesn't include the upcoming Family 18 and 19
> processors. Also, Arjan van de Ven says the current nature of the
> check
> was mainly due to lack of testing on old systems. He suggests
> considering all Intel processors as having efficient idle.
> 
> Extend the IO busy classification to all Intel processors starting
> with
> Family 6.
> 
> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com>
> 
> ---
> 
> v2: Improve commit message and code comments.
> 
> ---
>  drivers/cpufreq/cpufreq_ondemand.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq_ondemand.c
> b/drivers/cpufreq/cpufreq_ondemand.c
> index a7c38b8b3e78..b13f197707f4 100644
> --- a/drivers/cpufreq/cpufreq_ondemand.c
> +++ b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -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 */
> @@ -32,21 +36,20 @@ static unsigned int default_powersave_bias;
>  /*
>   * Not all CPUs want IO time to be accounted as busy; this depends
> on how
>   * efficient idling at a higher frequency/voltage is.
> - * Pavel Machek says this is not so for various generations of AMD
> and old
> - * Intel systems.
> + * Pavel Machek says this is not so for various generations of AMD.
>   * Mike Chan (android.com) claims this is also not true for ARM.
> - * Because of this, whitelist specific known (series) of CPUs by
> default, and
> + * Because of this, select known series of CPUs by default, and
>   * leave all others up to the user.
>   */
>  static int should_io_be_busy(void)
>  {
>  #if defined(CONFIG_X86)
>  	/*
> -	 * For Intel, Core 2 (model 15) and later have an efficient
> idle.
> +	 * Starting with Family 6 consider all Intel CPUs to 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)

This is "Starting from P4" rather than "Starting from Family 6", right?

thanks,
rui
>  		return 1;
>  #endif
>  	return 0;
Sohil Mehta Feb. 13, 2025, 6:49 p.m. UTC | #2
On 2/11/2025 9:35 PM, Zhang, Rui wrote:
>>  static int should_io_be_busy(void)
>>  {
>>  #if defined(CONFIG_X86)
>>  	/*
>> -	 * For Intel, Core 2 (model 15) and later have an efficient
>> idle.
>> +	 * Starting with Family 6 consider all Intel CPUs to 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)
> 
> This is "Starting from P4" rather than "Starting from Family 6", right?
> 

As described in the commit message, we are extending this to all
relevant Intel processors. That would include Family 6, Family 15 and
the upcoming Family > 15 processors as well.

A VFM check starting at INTEL_PENTIUM_PRO (Family 6, Model 1) is just a
way to simplify that.
Zhang, Rui Feb. 14, 2025, 2:03 a.m. UTC | #3
On Thu, 2025-02-13 at 10:49 -0800, Sohil Mehta wrote:
> On 2/11/2025 9:35 PM, Zhang, Rui wrote:
> > >  static int should_io_be_busy(void)
> > >  {
> > >  #if defined(CONFIG_X86)
> > >         /*
> > > -        * For Intel, Core 2 (model 15) and later have an
> > > efficient
> > > idle.
> > > +        * Starting with Family 6 consider all Intel CPUs to 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)
> > 
> > This is "Starting from P4" rather than "Starting from Family 6",
> > right?
> > 
> 
> As described in the commit message, we are extending this to all
> relevant Intel processors. That would include Family 6, Family 15 and
> the upcoming Family > 15 processors as well.
> 
> A VFM check starting at INTEL_PENTIUM_PRO (Family 6, Model 1) is just
> a
> way to simplify that.
> 
You're right. Previously I thought the Fam15 processors are before
Fam6.

-rui
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index a7c38b8b3e78..b13f197707f4 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -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 */
@@ -32,21 +36,20 @@  static unsigned int default_powersave_bias;
 /*
  * Not all CPUs want IO time to be accounted as busy; this depends on how
  * efficient idling at a higher frequency/voltage is.
- * Pavel Machek says this is not so for various generations of AMD and old
- * Intel systems.
+ * Pavel Machek says this is not so for various generations of AMD.
  * Mike Chan (android.com) claims this is also not true for ARM.
- * Because of this, whitelist specific known (series) of CPUs by default, and
+ * Because of this, select known series of CPUs by default, and
  * leave all others up to the user.
  */
 static int should_io_be_busy(void)
 {
 #if defined(CONFIG_X86)
 	/*
-	 * For Intel, Core 2 (model 15) and later have an efficient idle.
+	 * Starting with Family 6 consider all Intel CPUs to 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;