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

RE: [PATCH v7 06/13] xen/cpufreq: introduce new sub-hypercall to propagate CPPC data


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Tue, 26 Aug 2025 05:53:55 +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=9/pvuoUkyIetcbeS94/7fQhgXtwCEExSJ2XyU+rjjrQ=; b=QU+Xt4CRZYX9uzTtv7pGqjPjDugIq46GKXV/RZWJ9Jy5rSTRJpRBlc8lcn04onrBX5tTGZ0fLagz0CCK3GSe1S4OEy3u2L9iNkZITfOBiM17PFJPSt899LvmVY5VOJ+FZ+Gb7gNFN7RLl/c0FYHcWcBPC/7VKVPuCbhqvEwIGQtpJFV92BUMnLLA1Yx4saalPlVCP3oc4UeP4ev5lVuUUmw3gO7aoti51AmHMAtAb9Jasqm0xzriklDo8HhlGU0gRnik+RGBktDaIL6mrdaJDdUjpFCEAZtqnJ+M7PP1478SLKcXj0kNvIP1BXkLAPRIvSkfjOpEkDODzJ5I+EdNKg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H8VWQB2+ZpltoTFerdR0LlfSbabv0OWDL+N0hzyI3kI6MRHwUGTNYURJkEtcksurtQqeWOql8lYEV617jsZPg8QMuzcxtE42GTTvbgpDDr9c+yDLHm1JPXAQc3QzesguF5wG35J2SeUXV/moyZhEavJDsWoUnuv8wTB7dIyRTtxjrT6QoyWOD5y25nScghzPnqIFYxe93zYmAHeODDGDZSL+8dp9giUYAlO1B6DgZ0Kn8Hw/xHyrCAuZf0lbhLeK5JDH/z/x+FlLcdDl4u8AViitZLMNdHoaWqEQXFxUlH8pm28tnoD+mWc6Aso4veo8S5OLHOgv7/6Jb9+gsVSgyA==
  • 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>, 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: Tue, 26 Aug 2025 05:54:24 +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-08-26T05:53:49.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: AQHcE1LptmiQN44PAkOVJ+f0CssQOrRze76AgADdVjA=
  • Thread-topic: [PATCH v7 06/13] xen/cpufreq: introduce new sub-hypercall to propagate CPPC data

[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Monday, August 25, 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>;
> Anthony PERARD <anthony.perard@xxxxxxxxxx>; Orzel, Michal
> <Michal.Orzel@xxxxxxx>; Julien Grall <julien@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v7 06/13] xen/cpufreq: introduce new sub-hypercall to
> propagate CPPC data
>
> On 22.08.2025 12:52, Penny Zheng wrote:
> > --- a/xen/arch/x86/x86_64/cpufreq.c
> > +++ b/xen/arch/x86/x86_64/cpufreq.c
> > @@ -54,3 +54,22 @@ int compat_set_px_pminfo(uint32_t acpi_id,
> >
> >      return set_px_pminfo(acpi_id, xen_perf);  }
> > +
> > +int compat_set_cppc_pminfo(unsigned int acpi_id,
> > +                           const struct compat_processor_cppc
> > +*cppc_data)
> > +
> > +{
> > +    struct xen_processor_cppc *xen_cppc;
> > +    unsigned long xlat_page_current;
> > +
> > +    xlat_malloc_init(xlat_page_current);
> > +
> > +    xen_cppc = xlat_malloc_array(xlat_page_current,
> > +                                 struct xen_processor_cppc, 1);
> > +    if ( unlikely(xen_cppc == NULL) )
> > +        return -EFAULT;
>
> I think we want to avoid repeating the earlier mistake with using a wrong 
> error code.
> It's ENOMEM or ENOSPC or some such.
>

Understood, I'll change it to -ENOMEM

> > --- a/xen/drivers/acpi/pm-op.c
> > +++ b/xen/drivers/acpi/pm-op.c
> > @@ -91,7 +91,9 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
> >      pmpt = processor_pminfo[op->cpuid];
> >      policy = per_cpu(cpufreq_cpu_policy, op->cpuid);
> >
> > -    if ( !pmpt || !pmpt->perf.states ||
> > +    if ( !pmpt ||
> > +         ((pmpt->init & XEN_PX_INIT) && !pmpt->perf.states) ||
> > +         ((pmpt->init & XEN_CPPC_INIT) && pmpt->perf.state_count) ||
>
> I fear I don't understand this: In the PX case we check whether necessary 
> data is
> lacking. In the CPPC case you check that some data was provided that we don't
> want to use? Why not similarly check that data we need was provided?
>

We are introducing another checking line for CPPC is actually to avoid NULL 
deref of state[i]:
```
        for ( i = 0; i < op->u.get_para.freq_num; i++ )
                data[i] = pmpt->perf.states[i].core_frequency * 1000;
```
We want to ensure "op->u.get_para.freq_num" is always zero in CPPC mode, which 
is validated against pmpt->perf.state_count.
We have similar discussion in here 
https://old-list-archives.xen.org/archives/html/xen-devel/2025-06/msg01160.html


>
> Jan

 


Rackspace

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