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

Re: [PATCH v10 7/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 23 Sep 2025 12:47:00 -0400
  • 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=etSRuqcxug86BJLSlFeargc1Q+LCaWnLDyhcA0MdyGg=; b=KdEEYzGe4ysoIGrprFPW981icbzWsOl+mo4lWcetunztIvgw0R3h/ioGeJFokhnsNRSulYaEMbbQMXQqGDw+3LjC1jwEpJdNai8Ssjhx7RTM2AHLAieMHCrKJrcsq6cGRC8eKKR+S7SWzKZQjD5chv81cIsTtXP7LiBqkSYr1Dk131ZPuCugo5iyM3cxWUbcNhvfVDLC6g7mYMwdjf0uepwWGHlWVq1ddHGdIjKTL7gXwcYVMw0lfF63SD5wfL22ZWlPASjnR7uTUaADsYFlBUBlDCQJvYDuxjf2N127zP/csuXAJwEffbY/hFUGEr3m57S288R1EtRCEqFn6sSUBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rwsrvIxavi2kwdodbPVo1N2iGMqK3f8+sRw1Gu6KyGFs2MMZRE1TOIhxk20HZ6w+owOQYJ7RyCgZc4K70odLXBWY4LyJLSBz2UR197XOON6zFOXzpA9/3OrJJ/Qkiw3F1E4CsbXfgumQiD00Md46Y7DrzmnsH55TaZfc/9ivUumbEueVxyXC6jgr5TTJVoqabNgdEH5xBms2qJE3CFgL5uuVgtHua2CUC1TBqJ3w6Rm8ZOMSZeOSGyBgUDFrKwiKRimoD0bEVNfdZ3rV6ZoIU5W5AGCKH0eoZ6WKBs4Or/xxLaKANDA1m2yFOJGQ2gnRQiD3fDH8FPHu7WiDdZ0nlw==
  • Cc: <ray.huang@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Sep 2025 16:47:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-09-23 11:38, Jan Beulich wrote:
On 23.09.2025 06:38, Penny Zheng wrote:
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
      else
          strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
+ /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )

amd_cppc_prepare_policy() may leave ->governor set to NULL afaics, so I
think you need to add a NULL check here alongside with pulling this out
of ...

+        strlcpy(op->u.get_para.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);
+
      if ( !cpufreq_is_governorless(op->cpuid) )
      {

... this conditional.

The description also continues to not mention the effect for HWP. I'm
actually somewhat confused, I suppose (Jason, question mainly to you):
HWP falls in the governor-less category, iirc. Yet it doesn't supply
a .setpolicy hook, hence __cpufreq_set_policy() goes through the normal
governor setting logic. What's the deal here? The answer may affect
whether I'd deem the pulling out of the conditional correct (or at least
benign) here as to HWP.

Hi,

When I wrote HWP, I didn't realize using .setpolicy would bypass the governor code. Instead, I implemented the no-op HWP governor, since I thought I needed something as a governor.

set_hwp_para() actually changes the configuration. HWP only implements the equivalent of amd-cppc-epp autonomous (active) mode.

So I think HWP could switch to .setpolicy and drop its governor.

But looking at this hunk:

> @@ -321,10 +327,12 @@ static int set_cpufreq_cppc(struct
> xen_sysctl_pm_op *op)
>      if ( !policy || !policy->governor )

Doesn't this !policy->governor prevent amd-cppc-epp from setting parameters?

>          return -ENOENT;
>
> -    if ( !hwp_active() )
> -        return -EOPNOTSUPP;
> +    if ( hwp_active() )
> +        return set_hwp_para(policy, &op->u.set_cppc);
> +    if ( processor_pminfo[op->cpuid]->init & XEN_CPPC_INIT )
> +        return amd_cppc_set_para(policy, &op->u.set_cppc);
>
> -    return set_hwp_para(policy, &op->u.set_cppc);
> +    return -EOPNOTSUPP;
>  }

So there may be other checks that would need dropping or adjusting to support HWP without a governor.

Thanks,
Jason



 


Rackspace

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