|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/sysctl: introduce CONFIG_PM_STATS
commit f1d4ca28de78937b0faa0031201a989744f70e8d
Author: Penny Zheng <Penny.Zheng@xxxxxxx>
AuthorDate: Wed Jul 9 10:55:49 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jul 9 10:55:49 2025 +0200
xen/sysctl: introduce CONFIG_PM_STATS
We introduce a new Kconfig CONFIG_PM_STATS for wrapping all operations
regarding performance management statistics.
The major codes reside in xen/drivers/acpi/pmstat.c, including the
pm-statistic-related sysctl op: do_get_pm_info().
CONFIG_PM_STATS also shall depend on CONFIG_SYSCTL
We shall also provide "# CONFIG_PM_STATS is not set" in preset configs for
PV shim on x86.
Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/x86/acpi/cpu_idle.c | 2 ++
xen/arch/x86/configs/pvshim_defconfig | 1 +
xen/common/Kconfig | 8 ++++++++
xen/common/sysctl.c | 2 +-
xen/drivers/acpi/Makefile | 2 +-
xen/include/acpi/cpufreq/processor_perf.h | 10 ++++++++++
6 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 423df3d316..19f710f0dd 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1489,6 +1489,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;
@@ -1608,6 +1609,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/configs/pvshim_defconfig
b/xen/arch/x86/configs/pvshim_defconfig
index bacd04c963..9dc91c33e3 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -27,3 +27,4 @@ CONFIG_EXPERT=y
# CONFIG_DEBUG is not set
# CONFIG_GDBSX is not set
# CONFIG_PM_OP is not set
+# CONFIG_PM_STATS is not set
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index ed907de268..65f07289dd 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -628,4 +628,12 @@ config PM_OP
This option shall enable userspace performance management control
to do power/performance analyzing and tuning.
+config PM_STATS
+ bool "Enable Performance Management Statistics"
+ depends on ACPI && HAS_CPUFREQ && SYSCTL
+ default y
+ help
+ Enable collection of performance management statistics to aid in
+ analyzing and tuning power/performance characteristics of the system
+
endmenu
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index daf57fbe56..5207664252 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -170,7 +170,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t)
u_sysctl)
op->u.availheap.avail_bytes <<= PAGE_SHIFT;
break;
-#if defined (CONFIG_ACPI) && defined (CONFIG_HAS_CPUFREQ)
+#ifdef CONFIG_PM_STATS
case XEN_SYSCTL_get_pmstat:
ret = do_get_pm_info(&op->u.get_pmstat);
break;
diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile
index 1d811a51a7..477408afbe 100644
--- a/xen/drivers/acpi/Makefile
+++ b/xen/drivers/acpi/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_X86) += apei/
obj-bin-y += tables.init.o
obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-y += osl.o
-obj-$(CONFIG_HAS_CPUFREQ) += pmstat.o
+obj-$(CONFIG_PM_STATS) += pmstat.o
obj-$(CONFIG_PM_OP) += pm-op.o
obj-$(CONFIG_X86) += hwregs.o
diff --git a/xen/include/acpi/cpufreq/processor_perf.h
b/xen/include/acpi/cpufreq/processor_perf.h
index fa28b14faf..caa768626c 100644
--- a/xen/include/acpi/cpufreq/processor_perf.h
+++ b/xen/include/acpi/cpufreq/processor_perf.h
@@ -9,9 +9,19 @@
unsigned int powernow_register_driver(void);
unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
+#ifdef CONFIG_PM_STATS
void cpufreq_statistic_update(unsigned int cpu, uint8_t from, uint8_t to);
int cpufreq_statistic_init(unsigned int cpu);
void cpufreq_statistic_exit(unsigned int cpu);
+#else
+static inline void cpufreq_statistic_update(unsigned int cpu, uint8_t from,
+ uint8_t to) {}
+static inline int cpufreq_statistic_init(unsigned int cpu)
+{
+ return 0;
+}
+static inline void cpufreq_statistic_exit(unsigned int cpu) {}
+#endif /* CONFIG_PM_STATS */
int cpufreq_limit_change(unsigned int cpu);
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |