lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iXrqs2oVx0iYanjyJ6ucXorWi6PXPqW7Kdjnsu-zTGEg@mail.gmail.com>
Date: Mon, 8 Sep 2025 20:54:30 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Sohil Mehta <sohil.mehta@...el.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org, 
	x86@...nel.org, Tony Luck <tony.luck@...el.com>, Zhao Liu <zhao1.liu@...ux.intel.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] cpufreq: ondemand: Update the efficient idle check for
 Intel extended Families

On Fri, Sep 5, 2025 at 11:32 PM Sohil Mehta <sohil.mehta@...el.com> wrote:
>
> On 9/4/2025 1:02 PM, Rafael J. Wysocki wrote:
>
> >
> > Since you are adding this #ifdef below, why don't you go a bit farther and do
> >
> >> +#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;
> > }
> >> +#endif
> >> +
> >>  #include "cpufreq_ondemand.h"
> >>
>
> I am fine with this approach. Would moving the #define to the header be
> slightly better?

I think so.

> 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);
> }

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ