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

RE: [PATCH v9 1/8] xen/cpufreq: embed hwp into struct cpufreq_policy{}


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Mon, 15 Sep 2025 03:49:26 +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=SkSSqu4YI08dqY4Va5eTOo1UDxeCudbje/fjLRUGmNw=; b=ZLMyQkIQ4MB0XrG9gJdAXwghQgkW44sB5xb+Vwn8jOCf534Q8yz0jqwjXoko0+3mVd++Ge39VshPH+l6lVsjusnbFqmTfa5fTjOixctS2t2W3zjgh34pJYu7scv3H2EcjOUmfoh9qTB2FM57DN804F2VxdhM5+4aymIe3thQG6EV9NjnMBfJ2O4i+sz41v+gdkQN9YfCNe2UeBDcR/LxRm+vJ23wPNKkFjvi5vzoAVqp0QRXkQmjkyWkpg9UMBbwlN5c7XbU/eiYqbA4bUYzdm+W0ZpEaxtTWqLwE3gz1O1DfCHxinXx6hX+dc7L8m6HZK6q/YNasRgOBXd437XgsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U+IeRCbPZZ7ngm4APNBQIleokgnNXTSOgBnWBQX7Y0qz0grUD+09T6nCPraFMfvColTWzkVPMKMavU6O2P+uEkLv7J+bSt3VfDgOSegXCqD/aSCwsvEfTq2Xep1Jgk3lmn/CiPPk0TL8FWJjzwcHhZuezeVPGJfGXbKykJQ/WexbG4DObkxTtjKHZbDVobYg7RSFN5YKCM+yeNN7tbaTjoLoTEXoP/yYYtR2ocVbqcvzY3VwEP7E6qUGMCRxIHbn0vzC2zOYkT3ffqQKRhaaSNgPq5qW5oU4SZwP4ZY5uBlq3R5U+ASiar9mo+dm9OVQ1t/QeBjTCrjiDBGfZJDquA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Andryuk, Jason" <Jason.Andryuk@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 15 Sep 2025 03:49:48 +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-09-15T03:30: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: AQHcHWYoX5yLBs91qkCeYarmDUxFSLSC6XqAgAD6+DCABTACAIAKkulw
  • Thread-topic: [PATCH v9 1/8] xen/cpufreq: embed hwp into struct cpufreq_policy{}

[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Monday, September 8, 2025 6:02 PM
> To: Penny, Zheng <penny.zheng@xxxxxxx>
> Cc: Andryuk, Jason <Jason.Andryuk@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v9 1/8] xen/cpufreq: embed hwp into struct 
> cpufreq_policy{}
>
> (re-adding the list)
>
> On 05.09.2025 06:58, Penny, Zheng wrote:
> > [Public]
> >
> >> -----Original Message-----
> >> From: Jan Beulich <jbeulich@xxxxxxxx>
> >> Sent: Thursday, September 4, 2025 7:51 PM
> >> To: Penny, Zheng <penny.zheng@xxxxxxx>; Andryuk, Jason
> >> <Jason.Andryuk@xxxxxxx>
> >> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Roger Pau Monné
> >> <roger.pau@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> >> Subject: Re: [PATCH v9 1/8] xen/cpufreq: embed hwp into struct
> >> cpufreq_policy{}
> >>
> >> On 04.09.2025 08:35, Penny Zheng wrote:
> >>> For cpus sharing one cpufreq domain, cpufreq_driver.init() is only
> >>> invoked on the firstcpu, so current per-CPU hwp driver data struct
> >>> hwp_drv_data{} actually fails to be allocated for cpus other than
> >>> the first one. There is no need to make it per-CPU.
> >>> We embed struct hwp_drv_data{} into struct cpufreq_policy{}, then
> >>> cpus could share the hwp driver data allocated for the firstcpu,
> >>> like the way they share struct cpufreq_policy{}. We also make it a
> >>> union, with "hwp", and later "amd-cppc" as a sub-struct.
> >>
> >> And ACPI, as per my patch (which then will need re-basing).
> >>
> >>> Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
> >>
> >> Not quite, this really is Reported-by: as it's a bug you fix, and in
> >> turn it also wants to gain a Fixes: tag. This also will need backporting.
> >>
> >> It would also have been nice if you had Cc-ed Jason right away,
> >> seeing that this code was all written by him.
> >>
> >>> @@ -259,7 +258,7 @@ static int cf_check hwp_cpufreq_target(struct
> >> cpufreq_policy *policy,
> >>>                                         unsigned int relation)  {
> >>>      unsigned int cpu = policy->cpu;
> >>> -    struct hwp_drv_data *data = per_cpu(hwp_drv_data, cpu);
> >>> +    struct hwp_drv_data *data = policy->u.hwp;
> >>>      /* Zero everything to ensure reserved bits are zero... */
> >>>      union hwp_request hwp_req = { .raw = 0 };
> >>
> >> Further down in this same function we have
> >>
> >>     on_selected_cpus(cpumask_of(cpu), hwp_write_request, policy, 1);
> >>
> >> That's similarly problematic when the CPU denoted by policy->cpu
> >> isn't online anymore. (It's not quite clear whether all related
> >> issues would want fixing together, or in multiple patches.)
> >
> > Checking the logic in cpufreq_del_cpu(), once any processor in the
> > domain gets offline, the governor will stop.
>
> Yet with HWP and CPPC drivers being governor-less, how would that matter?
>
> > That is to say, only all processors in the domain are online, cpufreq 
> > driver could
> still be effective. Which is also complies to the description in _PSD ACPI 
> SPEC
> for "Num Processors" [1]:
> > ```
> > The number of processors belonging to the domain for this logical 
> > processor’s
> P-states. OSPM will not start performing power state transitions to a 
> particular P-
> state until this number of processors belonging to the same domain have been
> detected and started.
> > ```
> > [1]
> > https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control
> > .html?highlight=cppc#pstatedependency-package-values
> >
> > I know that AMD CPPC is obeying the _PSD dependency relation too, even if
> both CPPC Request register (ccd[15:0]_lthree0_core[7:0]_thread[1:0];
> MSRC001_02B3) and CPPC Capability Register
> (_ccd[15:0]_lthree0_core[7:0]_thread[1:0]; MSRC001_02B0) is Per-thread MSR.
> > I don't have the hardware to test "sharing" logic. All my platform says
> "HW_ALL" in _PSD.
>
> Aiui that's not mandated by the CPU spec, though. Plus HW_ALL still doesn't 
> say
> anything about the scope/size of each domain.
>

Sorry for the late reply.
I have discussed this with hardware team now, they said that we shall not 
expect any value other than "HW_ALL" from _PSD, if we have _CPC table, aka, 
CPPC enabled. Maybe except for some initial implementations, which may or may 
have not reached product release, this may still need a few time to look for 
conclusion
And if it is HW_ALL, it means, in codes, we are invoking per-cpu 
cpufreq_driver.init, allocating per-cpu copufreq_policy, and etc. In HW_ALL, 
OSPM can make different state requests for processors in the domain, while 
hardware determines the resulting state for all processors in the domain.

>

> Jan

 


Rackspace

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