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

Re: [PATCH v5 14/18] xen/cpufreq: introduce GET_CPUFREQ_CPPC sub-cmd


  • To: "Penny, Zheng" <penny.zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 7 Jul 2025 11:56:30 -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=okXk5k2UJP5iiXDt2G9BsFtUQNf5wy8eqsO2l6uORhM=; b=ff8HdMlU3cMM9HfTw6rniU/l40EOUKbg19wvQ3de0PMXBTlQO8YarqJ5yCwHs3MjvIi6xqkLgE1ErrrMFLGZAscXdRu/hAkXvNY6t32TBnjld6T88dFucC131vSZXUafImLO9nnmh6Y11LLdECx7i1tcDUkMNJiD7bLZBflM25yJOnrdgvHNITZpvTHlMQ5P2yZyK91d249/G21Ll3jaNZV/HzjhrZNmTofXKszebXkyqbMTXjGKYvIFn5Rc8EshSzLskwb7UBBlOM8Hl2osy3rg8eB5jdWC7+u5fv5T3v3OXzgs1No904CLE+96QU+xhDOMaGu5IO22q8CI/KTQbQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Yq1oRz9PTaxnTNbItLU2xtHUe7XWJlE/25CPl15LJp4FheOlr8JdS/oMqXVKkFmDAvliE/Ts6/9vdOey3a2gv9nRH+PE5qxMBayqXfiitkY2M/fd9Yyh2fYTlrz2qGSmyK7PJpCp2UmVKDBMAgre6JOhvQFxTO8iQjTs19Ps1wl6mWczDeqKNuHYvr4QrtY67uUtjjbqyXFOMkJkeq/X7+Mt2AuBPeRoV1mShYJb1qOLGmSwjVolp4urxgLaZCwA0hm3bSdrSW+gsEMcmu3Wdoy0fArrdAH2YeeypDaq3n6uwtiH/5dk+4xLUBOpBYsfoNy4pkARPiGBDXuRCem9lg==
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Orzel, Michal" <Michal.Orzel@xxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 07 Jul 2025 15:56:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 2025-07-06 23:31, Penny, Zheng wrote:
[Public]

-----Original Message-----
From: Jan Beulich <jbeulich@xxxxxxxx>
Sent: Friday, July 4, 2025 5:46 PM
To: Penny, Zheng <penny.zheng@xxxxxxx>
Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Anthony PERARD
<anthony.perard@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>; Andrew
Cooper <andrew.cooper3@xxxxxxxxxx>; Orzel, Michal <Michal.Orzel@xxxxxxx>;
Julien Grall <julien@xxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>; Stefano
Stabellini <sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx; Andryuk, 
Jason
<Jason.Andryuk@xxxxxxx>
Subject: Re: [PATCH v5 14/18] xen/cpufreq: introduce GET_CPUFREQ_CPPC sub-
cmd

On 04.07.2025 10:56, Penny, Zheng wrote:
[Public]

-----Original Message-----
From: Jan Beulich <jbeulich@xxxxxxxx>
Sent: Friday, July 4, 2025 4:33 PM
To: Penny, Zheng <penny.zheng@xxxxxxx>; Andryuk, Jason
<Jason.Andryuk@xxxxxxx>
Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Anthony PERARD
<anthony.perard@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>; Andrew
Cooper <andrew.cooper3@xxxxxxxxxx>; Orzel, Michal
<Michal.Orzel@xxxxxxx>; Julien Grall <julien@xxxxxxx>; Roger Pau
Monné <roger.pau@xxxxxxxxxx>; Stefano Stabellini
<sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 14/18] xen/cpufreq: introduce GET_CPUFREQ_CPPC
sub- cmd

On 04.07.2025 10:13, Penny, Zheng wrote:
[Public]

-----Original Message-----
From: Jan Beulich <jbeulich@xxxxxxxx>
Sent: Tuesday, June 17, 2025 6:08 PM
To: Penny, Zheng <penny.zheng@xxxxxxx>
Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Anthony PERARD
<anthony.perard@xxxxxxxxxx>; Juergen Gross <jgross@xxxxxxxx>;
Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Orzel, Michal
<Michal.Orzel@xxxxxxx>; Julien Grall <julien@xxxxxxx>; Roger Pau
Monné <roger.pau@xxxxxxxxxx>; Stefano Stabellini
<sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH v5 14/18] xen/cpufreq: introduce
GET_CPUFREQ_CPPC
sub- cmd

On 27.05.2025 10:48, Penny Zheng wrote:
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -69,6 +69,7 @@ void show_help(void)
              " set-max-cstate        <num>|'unlimited' [<num2>|'unlimited']\n"
              "                                     set the C-State limitation 
(<num> >= 0)
and\n"
              "                                     optionally the C-sub-state 
limitation
(<num2> >= 0)\n"
+            " get-cpufreq-cppc      [cpuid]       list cpu cppc parameter of 
CPU
<cpuid> or all\n"
              " set-cpufreq-cppc      [cpuid] [balance|performance|powersave]
<param:val>*\n"
              "                                     set Hardware P-State (HWP)
parameters\n"
              "                                     on CPU <cpuid> or all if 
omitted.\n"
@@ -812,33 +813,7 @@ static void print_cpufreq_para(int cpuid,
struct xc_get_cpufreq_para *p_cpufreq)

      printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);

-    if ( hwp )
-    {
-        const xc_cppc_para_t *cppc = &p_cpufreq->u.cppc_para;
-
-        printf("cppc variables       :\n");
-        printf("  hardware limits    : lowest [%"PRIu32"] lowest nonlinear
[%"PRIu32"]\n",
-               cppc->lowest, cppc->lowest_nonlinear);
-        printf("                     : nominal [%"PRIu32"] highest 
[%"PRIu32"]\n",
-               cppc->nominal, cppc->highest);
-        printf("  configured limits  : min [%"PRIu32"] max [%"PRIu32"] energy
perf
[%"PRIu32"]\n",
-               cppc->minimum, cppc->maximum, cppc->energy_perf);
-
-        if ( cppc->features & XEN_SYSCTL_CPPC_FEAT_ACT_WINDOW )
-        {
-            unsigned int activity_window;
-            const char *units;
-
-            activity_window = calculate_activity_window(cppc, &units);
-            printf("                     : activity_window [%"PRIu32" %s]\n",
-                   activity_window, units);
-        }
-
-        printf("                     : desired [%"PRIu32"%s]\n",
-               cppc->desired,
-               cppc->desired ? "" : " hw autonomous");
-    }
-    else
+    if ( !hwp )
      {
          if ( p_cpufreq->gov_num )
              printf("scaling_avail_gov    : %s\n",

I'm not sure it is a good idea to alter what is being output for 
get-cpufreq-para.
People may simply miss that output then, without having any
indication where it went.

Hwp is more like amd-cppc in active mode. It also does not rely on
Xen governor to do performance tuning, so in previous design, we
could borrow
governor filed to output cppc info However after introducing amd-cppc
passive mode, we have request to output both governor and CPPC info.
And if continuing expanding get-cpufreq-para to include CPPC info, it
will make the parent stuct xen_sysctl.u exceed exceed 128 bytes.

How is the xenpm command "get-cpufreq-para" related to the sysctl
interface struct size? If you need to invoke two sysctl sub-ops to
produce all relevant "get-cpufreq- para" output, so be it I would say.


Because we are limiting each sysctl-subcmd-struct, such as " struct
xen_sysctl_pm_op ", 128 bytes in "struct xen_sysctl",They are all combined as a
union.
Also, in "struct xen_sysctl_pm_op", its descending sub-op structs,
including "struct xen_get_cpufreq_para", are all combined as union too
``` struct xen_sysctl_pm_op {
     ... ...
     union {
         struct xen_get_cpufreq_para get_para;
         struct xen_set_cpufreq_gov  set_gov;
         struct xen_set_cpufreq_para set_para;
         struct xen_set_cppc_para    set_cppc;
         uint64_aligned_t get_avgfreq;
         uint32_t                    set_sched_opt_smt;
#define XEN_SYSCTL_CX_UNLIMITED 0xffffffffU
         uint32_t                    get_max_cstate;
         uint32_t                    set_max_cstate;
     } u;
}
```
It could deduce that "struct xen_get_cpufreq_para" is limited to 128 bytes (I 
think
actual limit is smaller than 128)....

And that implies what? In my earlier reply I already said that you may then 
simply
need to invoke more than one sysctl to get all the data you need. (As one of the
options, that is.)


Okay, I only explained why I couldn't use one command "get-cpufreq-para" to 
output all info

I think Jan's suggestion to make `xenpm get-cpufreq-para` keep outputting cppc/hwp information is good. That way users get the cpufreq information without having to know what driver is running. So you will have to issue the additional hypercall as necessary to retrieve the data.

Regards,
Jason



 


Rackspace

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