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

RE: [PATCH v2 10/19] xen/sysctl: introduce CONFIG_PM_STATS


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Wed, 16 Apr 2025 03:54:23 +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=c07+tqiNnwSTosVgWyuCrtj+bsNxAKuROUQ/E9k2O9g=; b=LVyLGrUoEeRmIQPwdwO5rS+ca24gxQfgy9getYlpPAisxEA1cQuiJR89ly5hjumPFszKxUtflClbw5RhKv0eBEKxAhjTI3joBjH74BwNsOnCNk9aaYWoeN9rfBl3aGkBTb7nbigJWl3bpLv1qOhRee+g8pyZIS2owGn0iKIYn7+504koeD9XNK2hmutQPYx+REFKRMeOmcr5FUjJuwdK2jBHAxAn7PnVTz54a4H2AHc3bSKvYHM9TXAFntKrKa1I6QcYjQEW5o7makjARwlsoj7tPfiwLXSQ8MCUUlS1O0HvllYbVd4qc7HbdWkIYVMh4ZD+9W9/bm9lKtaP8ZeTzQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d4kyl9/r9Zl+jU4XBez4Lk/GGlclZvz7fJuHkEK+A4GYz/DO2hoOwO8H0O4X5yNNd3kqLLY7UO+ANxS40tjCsJS+RdGGG46ZWr+l7G9CyhelDB6K+iC82NzRbe1Ee2mzlL8EhRVL3X5p+8qdJzLBexM10yAn50Ns/cCJaA9Qh0jdiffG+XKUFaxYx/A4kYVJS0TvBGlUt9si494/4x1m0Kgiu7CTvwdU5rY/jhb0UpcZL+jEs6PnpEtV+U06gA90/l5Aha9OPnF4F/yGoAeVYupRk15SRjJwsX8sz6SGVaaixr267PQ60LBQqVg0rYEj4MKmeR/cstqTgeE/qdDSqA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Stabellini, Stefano" <stefano.stabellini@xxxxxxx>
  • Delivery-date: Wed, 16 Apr 2025 03:54:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ActionId=8bd29732-aed8-4ef7-b226-d4447684affd;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ContentBits=0;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Enabled=true;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Method=Privileged;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Name=Open Source;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SetDate=2025-04-16T03:53:37Z;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Tag=10, 0, 1, 1;
  • Thread-index: AQHbnhN0GO5sSI+g2kqtQPzlgrAUG7OO0pKAgBbuLcA=
  • Thread-topic: [PATCH v2 10/19] xen/sysctl: introduce CONFIG_PM_STATS

[Public]

Hi,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, April 1, 2025 9:10 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 v2 10/19] xen/sysctl: introduce CONFIG_PM_STATS
>
> On 26.03.2025 06:50, Penny Zheng wrote:
> > We intend to introduce CONFIG_PM_STATS for wrapping all operations
> > regarding performance management statistics.
> > The major codes reside in xen/drivers/acpi/pmstat.c, including two
> > main pm-related sysctl op: do_get_pm_info() and do_pm_op().
> > So This commit also makes CONFIG_PM_STATS depend on
> CONFIG_SYSCTL
> >
> > Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
> > ---
> > v1 -> v2:
> > - rename to CONFIG_PM_STATS
> > - fix indention and stray semicolon
> > - make code movements into a new commit
> > - No need to wrap inline functions and declarations
> > ---
> >  xen/arch/x86/acpi/cpu_idle.c                 |  2 ++
> >  xen/arch/x86/acpi/cpufreq/hwp.c              |  6 ++++++
> >  xen/arch/x86/acpi/cpufreq/powernow.c         |  4 ++++
> >  xen/common/Kconfig                           |  5 +++++
> >  xen/common/sysctl.c                          |  4 ++--
> >  xen/drivers/acpi/Makefile                    |  2 +-
> >  xen/drivers/cpufreq/cpufreq_misc_governors.c |  2 ++
> >  xen/drivers/cpufreq/cpufreq_ondemand.c       |  2 ++
> >  xen/include/acpi/cpufreq/processor_perf.h    | 14 ++++++++++++++
> >  9 files changed, 38 insertions(+), 3 deletions(-)
> >
> > diff --git a/xen/arch/x86/acpi/cpu_idle.c
> > b/xen/arch/x86/acpi/cpu_idle.c index 420198406d..b537ac4cd6 100644
> > --- a/xen/arch/x86/acpi/cpu_idle.c
> > +++ b/xen/arch/x86/acpi/cpu_idle.c
> > @@ -1487,6 +1487,7 @@ static void amd_cpuidle_init(struct
> acpi_processor_power *power)
> >          vendor_override = -1;
> >  }
> >
> > +#ifdef CONFIG_PM_STATS
> >  uint32_t pmstat_get_cx_nr(unsigned int cpu)  {
> >      return processor_powers[cpu] ? processor_powers[cpu]->count : 0;
> > @@ -1606,6 +1607,7 @@ int pmstat_reset_cx_stat(unsigned int cpu)  {
> >      return 0;
> >  }
> > +#endif /* CONFIG_PM_STATS */
> >
> >  void cpuidle_disable_deep_cstate(void)  { diff --git
> > a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c
> > index d5fa3d47ca..98e9d46890 100644
> > --- a/xen/arch/x86/acpi/cpufreq/hwp.c
> > +++ b/xen/arch/x86/acpi/cpufreq/hwp.c
> > @@ -466,6 +466,7 @@ static int cf_check hwp_cpufreq_cpu_exit(struct
> cpufreq_policy *policy)
> >      return 0;
> >  }
> >
> > +#ifdef CONFIG_PM_STATS
> >  /*
> >   * The SDM reads like turbo should be disabled with MSR_IA32_PERF_CTL
> and
> >   * PERF_CTL_TURBO_DISENGAGE, but that does not seem to actually work,
> > at least @@ -508,6 +509,7 @@ static int cf_check
> > hwp_cpufreq_update(unsigned int cpu, struct cpufreq_policy *
> >
> >      return per_cpu(hwp_drv_data, cpu)->ret;  }
> > +#endif /* CONFIG_PM_STATS */
> >
> >  static const struct cpufreq_driver __initconst_cf_clobber
> > hwp_cpufreq_driver = { @@ -516,9 +518,12 @@ hwp_cpufreq_driver = {
> >      .target = hwp_cpufreq_target,
> >      .init   = hwp_cpufreq_cpu_init,
> >      .exit   = hwp_cpufreq_cpu_exit,
> > +#ifdef CONFIG_PM_STATS
> >      .update = hwp_cpufreq_update,
> > +#endif
> >  };
>
> Something's wrong here: The .update hook is actually making changes, so is
> definitely not (only) about statistics. Same for the powernow driver.
>
> > +#ifdef CONFIG_PM_STATS
> >  int get_hwp_para(unsigned int cpu,
> >                   struct xen_cppc_para *cppc_para)  { @@ -639,6 +644,7
> > @@ int set_hwp_para(struct cpufreq_policy *policy,
> >
> >      return hwp_cpufreq_target(policy, 0, 0);  }
> > +#endif /* CONFIG_PM_STATS */
>
> This also isn't about statistics, but about getting / setting parameters.
>
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -557,4 +557,9 @@ config SYSCTL
> >       to reduce Xen footprint.
> >  endmenu
> >
> > +config PM_STATS
> > +   bool "Enable Performance Management Statistics"
> > +   depends on ACPI && HAS_CPUFREQ && SYSCTL
> > +   default y
>
> As per above - either name, prompt and the description that Stefano suggested
> are wrong, or it is too much that is being covered by this new control.
>

We have two sysctl-op on performance, do_get_pm_info() and do_pm_op().
I think do_get_pm_info() is to collect PM statistic info, which could be 
wrapped with
CONFIG_PM_STATS, while maybe do_pm_op() is more focusing on performance tuning.
How about we introduce another Kconfig CONFIG_PM_TUNE to wrap  do_pm_op()
and related helpers? I suggest to introduce a new file pmtune.c to contain.
Or any better suggestion?

>
> Jan

 


Rackspace

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