.. it sounds like we want to split this up into package versus cluster
frequency or something?

What's the API look like right now?



-adrian

On Mon, 1 Jun 2026 at 23:42, ShengYi Hung <[email protected]> wrote:
>
> The branch main has been updated by aokblast:
>
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=7b26353a59d66dc1bc611fd042a49b9e3bd13699
>
> commit 7b26353a59d66dc1bc611fd042a49b9e3bd13699
> Author:     ShengYi Hung <[email protected]>
> AuthorDate: 2026-06-01 09:46:37 +0000
> Commit:     ShengYi Hung <[email protected]>
> CommitDate: 2026-06-02 06:41:41 +0000
>
>     hwpstate_intel: Disable package control on hybrid CPU
>
>     In package control mode, the performance of all cores depends on the
>     most recent value written to the request field. If the last write comes
>     from an E-core, all cores are forced to align with the E-core
>     performance level, resulting in significant performance degradation.
>     Therefore, package control is disabled on hybrid-core systems.
>
>     Reviewed by:    olce
>     MFC after:      2 weeks
>     Sponsored by:   The FreeBSD Foundation
>     Sponsored by:   Framework Computer Inc
>     Differential Revision: https://reviews.freebsd.org/D57377
> ---
>  sys/x86/cpufreq/hwpstate_intel.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/sys/x86/cpufreq/hwpstate_intel.c 
> b/sys/x86/cpufreq/hwpstate_intel.c
> index 3d2cc0a5966b..db8600d7b89a 100644
> --- a/sys/x86/cpufreq/hwpstate_intel.c
> +++ b/sys/x86/cpufreq/hwpstate_intel.c
> @@ -321,9 +321,19 @@ out:
>         return (ret);
>  }
>
> +static void
> +intel_hwpstate_hybrid_cb(void *ctx)
> +{
> +       uint32_t *small_cores = ctx;
> +
> +       atomic_add_32(small_cores, PCPU_GET(small_core));
> +}
> +
>  void
>  intel_hwpstate_identify(driver_t *driver, device_t parent)
>  {
> +       uint32_t small_cores = 0;
> +
>         if (device_find_child(parent, "hwpstate_intel", DEVICE_UNIT_ANY) != 
> NULL)
>                 return;
>
> @@ -343,6 +353,17 @@ intel_hwpstate_identify(driver_t *driver, device_t 
> parent)
>         if ((cpu_power_eax & CPUTPM1_HWP) == 0)
>                 return;
>
> +       /*
> +        * On hybrid-core systems, package-level control cannot be used.
> +        * It may cause all cores to run at the E-core frequency because
> +        * the resulting package frequency depends on the last core that
> +        * sets the frequency.
> +        */
> +       smp_rendezvous_cpus(all_cpus, smp_no_rendezvous_barrier,
> +           intel_hwpstate_hybrid_cb, smp_no_rendezvous_barrier, 
> &small_cores);
> +       if (small_cores > 0 && small_cores < mp_ncores)
> +               hwpstate_pkg_ctrl_enable = false;
> +
>         if (BUS_ADD_CHILD(parent, 10, "hwpstate_intel", 
> device_get_unit(parent))
>             == NULL)
>                 device_printf(parent, "hwpstate_intel: add child failed\n");
>

Reply via email to