diff mbox series

[v2,1/2] pmstat: Limit hypercalls under HWP

Message ID 20240124205922.67266-2-jandryuk@gmail.com (mailing list archive)
State Superseded
Headers show
Series Improve xenpm output under HWP | expand

Commit Message

Jason Andryuk Jan. 24, 2024, 8:59 p.m. UTC
When HWP is active, the cpufreq P-state information is not updated.  In
that case, return -EOPNOTSUPP instead of bogus, incomplete info.

Similarly, set_cpufreq_para() is not applicable when HWP is active.
Many of the options already checked the governor and were inaccessible,
but SCALING_MIN/MAX_FREQ was still accessible (though it would do
nothing).  Add an ealier HWP check to handle all cases.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
v2:
Use -EOPNOTSUPP in both places

 xen/drivers/acpi/pmstat.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jan Beulich Jan. 25, 2024, 2:21 p.m. UTC | #1
On 24.01.2024 21:59, Jason Andryuk wrote:
> When HWP is active, the cpufreq P-state information is not updated.  In
> that case, return -EOPNOTSUPP instead of bogus, incomplete info.
> 
> Similarly, set_cpufreq_para() is not applicable when HWP is active.
> Many of the options already checked the governor and were inaccessible,
> but SCALING_MIN/MAX_FREQ was still accessible (though it would do
> nothing).  Add an ealier HWP check to handle all cases.
> 
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 85097d463c..86588ddd42 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -66,6 +66,8 @@  int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
             return -ENODEV;
         if ( !cpufreq_driver.init )
             return -ENODEV;
+        if ( hwp_active() )
+            return -EOPNOTSUPP;
         if ( !pmpt || !(pmpt->perf.init & XEN_PX_INIT) )
             return -EINVAL;
         break;
@@ -329,6 +331,9 @@  static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     if ( !policy || !policy->governor )
         return -EINVAL;
 
+    if ( hwp_active() )
+        return -EOPNOTSUPP;
+
     switch(op->u.set_para.ctrl_type)
     {
     case SCALING_MAX_FREQ: