[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 06:38:14 +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=7JDAyhNEYcizKqFUk0EPOwdXCUxJGSSMjwEfXu2PTSQ=; b=qmhRPxTCyD2OmFD7+RcdEPdCgmfk6fG07vOMQAcu/zxAHdewOeodHRpGrR5r8liVusxWx36srrvQFLGulyxHJ4BS88Hpibf7lwSayZzXASfXLV7BMMY2/JNis6rHZBx9hRPvKyzw7+3/qCmJ6REvVnEeodEGtBS5J2EsuP3KYRF/wfmpA2sLdtNirSGlppYY8goKGDeGKACQJW3re2Dls1B1Uf5NWQdWYyVK8LFpQyR1zPNzYYYHVsSZxE5flaXDwEAlRWYeB57Sw8Ei0n6ODzftwTgKRlMKuHgoSpNf9kt6dvNiUtyc1+j5Z2EwJEgSIbC3QA5cz6uja5hS6g6e3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kqw0vJ1ZATPOB4u4TEakZradzWARhL4NaJt1Kq3B8CLQhPM34gBJDud2niipp+0U+Ih+8N+vI9wSA0f9P1Y6NjS/dYmE5EXb2KfxXlcurU1PjHxS9TetBgExy2UrMQXMhtAijFnL05vng1WxPKbUs/M0WPkGUcidWSsNRm5CjgZAFvd/n3i/NYVEixO7cUhZokvJ4namyEy5NKMsQogaJGTdbPpWxOqNpqRdcVXp8aqji6hkrq6Ss8J7yW8oSU74bSjsYwSLO2LV/0wTwGsCedG6QI+yFTNIgL+jzTOqBOOzSIAlCzcz8x00BHMRWVQRf/qcGdGyEb8R2BNh35Ri5w==
  • 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 06:38:35 +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-26T06:32:52.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+f0CssQOrRze76AgADdVjCAAB1GgIAABDZw
  • 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: Tuesday, August 26, 2025 1:59 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 26.08.2025 07:53, Penny, Zheng wrote:
> > [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/msg0
> > 1160.html
>
> Indeed I was thinking that we would have touched this before. As to your 
> reply:
> This explains the .state_count check (which imo wants a comment). It doesn't,

Understood, I'll complement

> however, explain the absence of a "have we got the data we need" part. Unless 
> of
> course there simply isn't anything to check for.
>

Yes, imo, there isn’t anything to check.
In get_cpufreq_para(). we are not accessing data specific to CPPC.

> Jan

 


Rackspace

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