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

Re: [PATCH 2/5] cpufreq/hwp: move driver data into policy


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 26 Jan 2026 15:17:33 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=7SGNS4TjEI76EVNKrBmF4O5g2Si1KJyHIqW2yyloj+A=; b=H7vKkhb15Va6k9Wnru6XPqM1LiRRyOAPn0mZ1+oAYF4fCm89vRsWR69qarI0Or0iRkEGfqVWxJTZaPzROF4s84iO1zsfGXfjBLc1f0QOPqtN4h+GEJtjbvdxYz2N3Gnp2SJep/o3ssSeC0gUT5wICZ7v6W+utxyg/Aw/7wzLfkbkWpgQ4p2C1n/0DOFiVrlHMviLhGcMXXbmasjHnnai8OCcvxOzYnMKnK8uOP6zzTiuUT50udlgSm2zRdNWlYBu9BA09cx0Q36hbzN8Kvu39bPzyKTGbntcqotlfqPiHUpyQPLOm9FstvgKyUFWFntoHDjE1uPmiOYe6IZ2SeJW9g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DHtJ5x+LImKxqnnfw4NEozBRklfHhaevgrdAS7NLiSSHlSJLddMXqQVhVJEWoqFBPkRdXBbSsytGsCzwV6ye7e/lpFW7bWX4RbjMOpGxqD3Rf9odd1b2VzAztdz7MvwS7cEKupvj2M/MX8e9NfoYTuxLXALnJd0RiFKnSa5lI5sGGAhvlyGkiaf7XtD3zt8+3Fz7eqsoeVoE2/WgdA6snHu1yQx/3eOKJ7+Oq/RRZ8LNyjxvDXVNPYA1/4IAveWU9BnfrWdoEFTo6WQOXKVdPJBwO/9DphM4ajVtY+RGYBsJQz2M5VmtPRY8DuZwsJGdFc2pa7rK73sFIoWUPK3aPA==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 26 Jan 2026 20:53:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-01-26 04:08, Jan Beulich wrote:
On 23.01.2026 23:35, Jason Andryuk wrote:
On 2026-01-22 04:42, Jan Beulich wrote:
Share space with the ACPI and powernow drivers, avoiding a separate
allocation for each CPU. Except for get_hwp_para() all use sites already
have the policy available, and this one function can simply be brought
closer to its sibling set_hwp_para().

Minor, but maybe 's/function/function's signature/'.  The original
phrasing made me think it was code movement.

I don't see an issue there, but I've adjusted as you asked for.

Thank you.

This then also eliminates the concern over hwp_cpufreq_cpu_init() being
called for all CPUs

We expect hwp_cpufreq_cpu_init() to be called for each CPU, so I am
confused by this statement.  The data...

Well, "expect" is the problem. Recall my pointing out of the problem when
having noticed the same pattern in the amd-cppc driver patches. My
recollection from the discussion is that there's no formal statement of
...

  >, or a CPU going offline that's recorded in> policy->cpu (which would
result in accesses of per-CPU data of offline
CPUs).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
hwp_cpufreq_target() still requires policy->cpu to be online, though.

--- a/xen/arch/x86/acpi/cpufreq/hwp.c
+++ b/xen/arch/x86/acpi/cpufreq/hwp.c

-static DEFINE_PER_CPU_READ_MOSTLY(struct hwp_drv_data *, hwp_drv_data);

... here is tracked and filled per-CPU.

Do we need cpufreq_add_cpu() to force hw_all = 1 for HWP (and maybe
AMD-CPPC) to ensure that policy is allocated per-CPU?

... this being a correct thing to do, hence our code imo would better be
resilient to it being different somewhere.

Are we implicitly relying on shared_type == CPUFREQ_SHARED_TYPE_HW to do
that for us?

Right now we do, I believe, without - as said above - this being actually
mandated by the spec.

HWP doesn't need ACPI data. I wrote the driver according to the SDM, which is just MSRs. It's Xen that needs ACPI data to initialize and use cpufreq.

Regardless of that, it looks like the checks for cpu_online() and performance_pminfo[] would constrain CPU accesses, so:

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Thanks,
Jason



 


Rackspace

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