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

RE: [PATCH v10 7/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "Andryuk, Jason" <Jason.Andryuk@xxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Mon, 13 Oct 2025 08:16:18 +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=h++AllElID1HxjF1HaUrAPJtMNOpcRaOVOLhUh9zV7Q=; b=VBfKB5WJAYp2n4VWx4quXeyIc25l2iV5/PhTJa9w24oLDgYdpf+GD9Ne/WIP3DKwP1L0LiGcbmO56CWnWem4dA6Kl5yuSQZVUMuHCsukx8vlWxc3HzPEeIkjwK9LwOesQjQiSvMwFsqKTBoK5o/qUBxjv8QsL3hTuXguFE75I4l2GXIXmwALeuKGf97N+4sKOO5EYiSAKe6p+NBWBsRCY5wVLIGq1T1tqw+mEDNsakulHvxchu7SAAvpX0ybLGlxwFSUK602TOU7CtDbDxVqwNXpDIeqD/9j9H860c7b9Gqdd8/c3blHNdl+bA12IvqMiLvIurTWNi49U4P39RiJ+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RVOGnqq1WEfwNkIdXgHRO3QDxPTcSeTkoLiB/NZUMS8kg7Bbb6YsYehDyvAauF5Aa0Ecqv43+z/v2isFhPW/jAO105j+inn4DAPkfU0Jhyc2K0rIna8aq55aR0Ro0CpHsbhtzZVyrrrXQmM8fQIbi9X+qTg3qn58yR978SgowFY6SY73ZRTNXCcEfxnf8q3FJWWZkXrQ6T8EZuDFVYst1ASePB9G+L/J2AmNrHK7d6L17E6Rr20nbtaBUBerKSXTIqxDmVW/SKhfyfrpCRMYO2/dpw2A2h/BpFctbzLwhtxsTz8VUHPiBVCGC2c16T6555DXqwlDGKXgnwJTfcA32A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Oct 2025 08:16:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Enabled=True;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SetDate=2025-10-13T08:16:12.0000000Z;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Name=Open Source;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ContentBits=3;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Method=Privileged
  • Thread-index: AQHcLEQGdopGfovwgUWGl4QJnXlfibSg55+AgAATNQCAAnMfgIAcZtaw
  • Thread-topic: [PATCH v10 7/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Thursday, September 25, 2025 2:12 PM
> To: Andryuk, Jason <Jason.Andryuk@xxxxxxx>; Penny, Zheng
> <penny.zheng@xxxxxxx>
> Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Anthony PERARD
> <anthony.perard@xxxxxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>;
> Roger Pau Monné <roger.pau@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v10 7/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC
> xen_sysctl_pm_op for amd-cppc driver
>
> On 23.09.2025 18:47, Jason Andryuk wrote:
> > On 2025-09-23 11:38, Jan Beulich wrote:
> >> On 23.09.2025 06:38, Penny Zheng wrote:
> >>> @@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op
> *op)
> >>>       else
> >>>           strlcpy(op->u.get_para.scaling_driver, "Unknown",
> >>> CPUFREQ_NAME_LEN);
> >>>
> >>> +    /*
> >>> +     * In CPPC active mode, we are borrowing governor field to indicate
> >>> +     * policy info.
> >>> +     */
> >>> +    if ( policy->governor->name[0] )
> >>
> >> amd_cppc_prepare_policy() may leave ->governor set to NULL afaics, so
> >> I think you need to add a NULL check here alongside with pulling this
> >> out of ...
> >>
> >>> +        strlcpy(op->u.get_para.s.scaling_governor,
> >>> +                policy->governor->name, CPUFREQ_NAME_LEN);
> >>> +    else
> >>> +        strlcpy(op->u.get_para.s.scaling_governor, "Unknown",
> >>> +                CPUFREQ_NAME_LEN);
> >>> +
> >>>       if ( !cpufreq_is_governorless(op->cpuid) )
> >>>       {
> >>
> >> ... this conditional.
> >>
> >> The description also continues to not mention the effect for HWP. I'm
> >> actually somewhat confused, I suppose (Jason, question mainly to you):
> >> HWP falls in the governor-less category, iirc. Yet it doesn't supply
> >> a .setpolicy hook, hence __cpufreq_set_policy() goes through the
> >> normal governor setting logic. What's the deal here? The answer may
> >> affect whether I'd deem the pulling out of the conditional correct
> >> (or at least
> >> benign) here as to HWP.
> >
> > Hi,
> >
> > When I wrote HWP, I didn't realize using .setpolicy would bypass the
> > governor code.  Instead, I implemented the no-op HWP governor, since I
> > thought I needed something as a governor.
> >
> > set_hwp_para() actually changes the configuration.  HWP only
> > implements the equivalent of amd-cppc-epp autonomous (active) mode.
> >
> > So I think HWP could switch to .setpolicy and drop its governor.
> >
> > But looking at this hunk:
> >
> >  > @@ -321,10 +327,12 @@ static int set_cpufreq_cppc(struct  >
> > xen_sysctl_pm_op *op)
> >  >      if ( !policy || !policy->governor )
> >
> > Doesn't this !policy->governor prevent amd-cppc-epp from setting
> > parameters?
>
> Only if amd_cppc_prepare_policy() took the default case path of its switch(), 
> aiui.
> Penny?
>

Hmmm, I shall admit that I omitted the default case.
Actually, in current codes, no matter it is amd-cppc or amd-cppc-epp, or any 
other cpufreq driver(except hwp), in its .init(), we have:
```
policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
```
So we have CPUFREQ_DEFAULT_GOVERNOR when no specified governor set through 
cmfline, and it is ondemand... As long as .init() is executed successfully, we 
will never have NULL governor field right now.

> Jan
>
> >  >          return -ENOENT;
> >  >
> >  > -    if ( !hwp_active() )
> >  > -        return -EOPNOTSUPP;
> >  > +    if ( hwp_active() )
> >  > +        return set_hwp_para(policy, &op->u.set_cppc);
> >  > +    if ( processor_pminfo[op->cpuid]->init & XEN_CPPC_INIT )
> >  > +        return amd_cppc_set_para(policy, &op->u.set_cppc);
> >  >
> >  > -    return set_hwp_para(policy, &op->u.set_cppc);
> >  > +    return -EOPNOTSUPP;
> >  >  }
> >
> > So there may be other checks that would need dropping or adjusting to
> > support HWP without a governor.
> >
> > Thanks,
> > Jason


 


Rackspace

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