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

RE: [PATCH v2 02/11] xen/x86: introduce new sub-hypercall to propagate CPPC data


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Mon, 17 Feb 2025 07:20:25 +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=A4tPE/2EUEHa2uRIx1pH0B5mjbU6MmEVTnwVpS3f2cs=; b=VDfwQQhf3XEN8v+uVp180nB+ejcyFiQP79QZviBwgyvpriqy+bxRBCjTp2yU0i1aMLTy9Xh8ekAO2A1ifRmqmCFMhE/n2fC48CFCVnmgTlLuQqPXHtB4RnGpCzfK8c6laBvUfUMLS8HOfQqfH6I2UjF/U4U3oALRxsFcQCGwt7D3uETautzsr2PwKK6n/HY0/vKdqPQs000ntnFKuc5EKLRk4Nf5Hab1OHOaHKeaDrH/biOsu3vQ3hfwJOPjNsdjaOxHPQ9C5TDgcv3fjz/UM0Y/e3kGat5ZM7cfYCTuvZtQGyKjT+ndCxnwArJ2NgP8ibUAMSYWZrn32NVgzpE8jQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F7HXGWjRQe6nQtg7QmaytU2HejAroWMnJPtUKSJYui1AiwWlg3P0ydSrcQyB6TUe3ZkiJEr8L324ym/6awbxjq5hKLt19s5GdZiRwghaCPQ4FtpPtSPlH+Dd4wdI58ZExoZaAPGBsvL/MUM9iYLqVu0NHRWrap2aR0c4ME+GIyMNEZGrvsybMlwHCP3Jq6PgfVcl4Odp0h1MVjW9fZQkEu5Nhk2GLxll3w0PlE9hqhfnBqOTcK19s+ivrIkmu/dvuXyzZPvrOuIrhOhLTaXR3kh+VSuiXZAZ0usLO+UUCWcnQUU3VtJzDI4QU7SxRoXD3xkV2aULF0KN4QJeAVGR9Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, "Andryuk, Jason" <Jason.Andryuk@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Orzel, Michal" <Michal.Orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 17 Feb 2025 07:20:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=ab1f372a-c186-4f49-b62d-3d11421aa028;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2025-02-17T04:24:05Z;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Tag=10, 3, 0, 1;
  • Thread-index: AQHbeHHLxWVIgPijWEedM19MLd/Q4rNB+imAgAj8gkA=
  • Thread-topic: [PATCH v2 02/11] xen/x86: introduce new sub-hypercall to propagate CPPC data

[AMD Official Use Only - AMD Internal Distribution Only]

Hi,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, February 11, 2025 7:10 PM
> To: Penny, Zheng <penny.zheng@xxxxxxx>
> Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Andryuk, Jason
> <Jason.Andryuk@xxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>;
> Roger Pau Monné <roger.pau@xxxxxxxxxx>; Anthony PERARD
> <anthony.perard@xxxxxxxxxx>; Orzel, Michal <Michal.Orzel@xxxxxxx>; Julien
> Grall <julien@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 02/11] xen/x86: introduce new sub-hypercall to 
> propagate
> CPPC data
>
> On 06.02.2025 09:32, Penny Zheng wrote:
> > --- a/xen/arch/x86/platform_hypercall.c
> > +++ b/xen/arch/x86/platform_hypercall.c
> > @@ -572,6 +572,10 @@ ret_t do_platform_op(
> >              break;
> >          }
> >
> > +        case XEN_PM_CPPC:
> > +            ret = set_cppc_pminfo(op->u.set_pminfo.id,
> > + &op->u.set_pminfo.u.cppc_data);
>
> Nit: Too long line.
>
> > --- a/xen/arch/x86/x86_64/cpufreq.c
> > +++ b/xen/arch/x86/x86_64/cpufreq.c
> > @@ -26,6 +26,8 @@
> >  #include <xen/pmstat.h>
> >  #include <compat/platform.h>
> >
> > +CHECK_processor_cppc;
> > +
> >  CHECK_processor_px;
>
> May I ask that you insert below the pre-existing CHECK_* rather than above?
> Or wait - maybe you were aiming at sorting these alphabetically? That would
> perhaps be fine then.
>

Yes, I intended to sort these alphabetically

> > +{
> > +    int ret = 0, cpuid;
> > +    struct processor_pminfo *pm_info;
> > +
> > +    cpuid = get_cpu_id(acpi_id);
> > +    if ( cpuid < 0 || !cppc_data )
> > +    {
> > +        ret = -EINVAL;
> > +        goto out;
> > +    }
> > +    if ( cpufreq_verbose )
> > +        printk("Set CPU acpi_id(%d) cpuid(%d) CPPC State info:\n",
> > +               acpi_id, cpuid);
> > +
> > +    pm_info = processor_pminfo[cpuid];
> > +    if ( !pm_info )
> > +    {
> > +        pm_info = xvzalloc(struct processor_pminfo);
> > +        if ( !pm_info )
> > +        {
> > +            ret = -ENOMEM;
> > +            goto out;
> > +        }
> > +        processor_pminfo[cpuid] = pm_info;
> > +    }
> > +    pm_info->acpi_id = acpi_id;
> > +    pm_info->id = cpuid;
> > +    pm_info->cppc_data = *cppc_data;
> > +
> > +    if ( cpufreq_verbose )
> > +        print_CPPC(&pm_info->cppc_data);
> > +
> > + out:
> > +    return ret;
> > +}
>
> What's the interaction between the data set by set_px_pminfo() and the data 
> set
> here? In particular, what's going to happen if both functions come into play 
> for the
> same CPU? Shouldn't there be some sanity checks?

Yes, I've considered this and checked ACPI spec. I'll refer them here:
```
If the platform supports CPPC, the _CPC object must exist under all processor 
objects.
That is, OSPM is not expected to support mixed mode (CPPC & legacy PSS, _PCT, 
_PPC) operation.
```
See 
https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html?highlight=cppc#power-performance-and-throttling-state-dependencies
So CPUs could have both _CPC and legacy P-state info in ACPI for each entry, 
they just can't have mixed-mode
Maybe we shall add sanity check to see if _CPC exists, it shall exist for all 
pcpus?

> Will consumers be able to tell which of the two were correctly invoked, 
> before using
> respective data? Even in the event of no code changes at all to address this, 
> it will
> want discussing in the patch description.
>

I have checked the relevant spec. it shall be the following logic:
```
Software enables Collaborative Processor Performance Control by setting
CPPC_ENABLE[CPPC_En] (bit 0) = 1. Once it gets enabled, the processor ignores 
the legacy P-state control interface.
```
Hmmm, I shall add relevant comment in Doc?

>
> Jan

Many thanks,
Penny

 


Rackspace

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