[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH v4 15/15] xen/xenpm: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Thu, 22 May 2025 05:59:40 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=URqgedpDIipbImUzPk3jV2mGpeB3OInPHgAlaLmnlrE=; b=ZN9oZInW9bqtLXs2ZHshcDHaa/BFms6XinuC20kPCvpyERPNGDm0pdZzguoB+T3Ku1kBfnD/e63aAOuPuU2BxcKWUVoM1wNaHcQCSPOJXLx2R78ey2eEQDTHeDTCwHxZ6qXAlV4iwa9ZvnPwC6ldWVttJ1y6g0sjQxp2g80tbeHVQXFIznDb7LIPAXYlp6lQkw2gl+hKobVKJoxy3+kASLFNziUYl79CV0UUykUOV9jaU4hiPobJb3EgxDHiVW9YjKlg1Hpx8FaCuRNG652AHq99EGczQjoco9OMyW69MfonInsy3/+LEX0sXpP3TbJcT0+kSmHobn6QSP8JXas9qw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I167EzEwUjGcxlazB4KH6YRgJ0hBkrCf97T2Tl7nqlblCyxvWhdfWvlo2IqmxynHMCeCHfbOIOQI5cEdd3z4cG5nOTDzA3WrLsmMqizeKAbPrPqvcXwaJJFjUoyUhfV48CE5x1ustTuTF3JU8LRsL0O60k04fkWV6gwQ0R76T9MsR20/PYFGbODDSpMg/LHolOBLPgoL7iS7YH2z/RgRkxrtA7kYPjWvqq9DnFnhWoOmGP9LEZdEOaZBbVpcO1gyez4aLYK5Ok4NMwKexhWZpAMY/60h7SxyCIfEQOoTIINEU0EJR8eKgz/1YKSycgh7kX/PikqPF/5CAf9jzC7Ecw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 22 May 2025 06:00:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ActionId=7d81e07e-7a48-4427-8fad-24b268d87197;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ContentBits=0;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Enabled=true;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Method=Privileged;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Name=Open Source;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SetDate=2025-05-22T05:59:33Z;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Tag=10, 0, 1, 1;
  • Thread-index: AQHbrRCy0dvLnopz7kONlcDKiL+9s7O8Z2mAgCH2THA=
  • Thread-topic: [PATCH v4 15/15] xen/xenpm: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Wednesday, April 30, 2025 11:02 PM
> To: Penny, Zheng <penny.zheng@xxxxxxx>
> Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Andrew Cooper
> <andrew.cooper3@xxxxxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v4 15/15] xen/xenpm: Adapt SET/GET_CPUFREQ_CPPC
> xen_sysctl_pm_op for amd-cppc driver
>
> On 14.04.2025 09:40, Penny Zheng wrote:
> > +    /* Only allow values if params bit is set. */
> > +    if ( (!(set_cppc->set_params & XEN_SYSCTL_CPPC_SET_DESIRED) &&
> > +          set_cppc->desired) ||
> > +         (!(set_cppc->set_params & XEN_SYSCTL_CPPC_SET_MINIMUM) &&
> > +          set_cppc->minimum) ||
> > +         (!(set_cppc->set_params & XEN_SYSCTL_CPPC_SET_MAXIMUM) &&
> > +          set_cppc->maximum) ||
> > +         (!(set_cppc->set_params &
> XEN_SYSCTL_CPPC_SET_ENERGY_PERF) &&
> > +          set_cppc->energy_perf) )
> > +        return -EINVAL;
> > +
> > +    /* Activity window not supported in MSR */
> > +    if ( set_cppc->set_params & XEN_SYSCTL_CPPC_SET_ACT_WINDOW )
> > +        return -EOPNOTSUPP;
> > +
> > +    /* Return if there is nothing to do. */
> > +    if ( set_cppc->set_params == 0 )
> > +        return 0;
> > +
> > +    epp = per_cpu(epp_init, cpu);
> > +    /*
> > +     * Apply presets:
> > +     * XEN_SYSCTL_CPPC_SET_DESIRED reflects whether desired perf is set,
> which
> > +     * is also the flag to distiguish between passive mode and active mode.
> > +     * When it is set, CPPC in passive mode, only
> > +     * XEN_SYSCTL_CPPC_SET_PRESET_NONE could be chosen, where
> min_perf =
> > +     * lowest_nonlinear_perf to ensures performance in P-state range.
> > +     * when it is not set, CPPC in active mode, three different profile
> > +     *
> XEN_SYSCTL_CPPC_SET_PRESET_POWERSAVE/PERFORMANCE/BALANC
> E are provided,
> > +     * where min_perf = lowest_perf having T-state range of performance.
> > +     */
>
> I fear I'm struggling to parse some of this, making it difficult to suggest 
> possible
> adjustments (as I can't derive what is meant to be said). Plus where's the 
> term T-
> state coming from all of the sudden?
>

Pasting description on "lowest_perf" and "nonlinear_lowest_perf":
"
Lowest Nonlinear Performance is the lowest performance level at which nonlinear 
power savings are achieved, for example, due to the combined effects of voltage 
and frequency scaling. Above this threshold, lower performance levels should be 
generally more energy efficient than higher performance levels. In traditional 
terms, this represents the P-state range of performance levels.

Lowest Performance is the absolute lowest performance level of the platform. 
Selecting a performance level lower than the lowest nonlinear performance level 
may actually cause an efficiency penalty, but should reduce the instantaneous 
power consumption of the processor. In traditional terms, this represents the 
T-state range of performance levels.
"
IMO, in passive mode, we rely on Xen governor to do performance tuning. And Xen 
governor is thinking based on P-states. So I take non-linear lowest perf as 
min_perf
While in active mode, hardware itself is calculating suitable 
performance/frequency automatically based on workload, thermal, voltage, and 
etc. So maybe setting min_perf with lowest perf is a better choice?


> > +        ret = get_amd_cppc_para(policy->cpu,
> > + &op->u.get_para.u.cppc_para);
> > +
> > +    if ( strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME,
> > +                 CPUFREQ_NAME_LEN) &&
> > +         strncmp(op->u.get_para.scaling_driver,
> XEN_AMD_CPPC_EPP_DRIVER_NAME,
> > +                 CPUFREQ_NAME_LEN) )
> >      {
> >          if ( !(scaling_available_governors =
> >                 xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
>
> Isn't it the non-EPP driver which is governor-independent?
>

EPP driver is governor-independent, indicating active mode. Hardware itself 
will automatically calculate and set frequency. User only shall set min_perf, 
max_perf, and EPP at the beginning.
EPP is a preference ratio value towards performance over powersave, on the 
scale of 0-255, 0 as 100% percentage favoring performance, while 255 as 100% 
percentage favoring powersave
Non-EPP driver is still relying on Xen governor to do the tuning.

> Jan

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.