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

[PATCH 2/2] xen/cpufreq: fix usages of align_timer() in the on-demand governor


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 27 Feb 2026 08:32:59 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=Urh8wr5J46bIDyHt/VSWqgUO0+Dn2AXVKCUHBxW0PlI=; b=N/3gGoM22qw4iRM+01htD4ZWlfXSqflL+6M2cLi8XZouushhXf0A22CvbN13gXy8Ah28qS2CHRpXUyW82kWlX1iNU51JuRfnHN3wZS0ynUyFLxBaMBEd0OVRVLRDGo2voPACdAj3X1LVUTMC905SifKwCKGvZBRGInH4BFvbWkYHi+2M/jxugQysrx+ba0cN3lyxhCAz6cgq7amB0+0msrBu9h/I8lG1g7ummpNhJdUtx/qc10ZBCIJS/WwFkcJ6y0c/lXVaDbFe7TDPEBTvZFF/WeMPX8+u2QifULPdk1GKKhQT9nbdnoOLKKIGawbrS8yWYbmPyFyQqIeALVr0HA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rJtoW1Cz720HUTRBe4380NcJfkeNk7MLnBfapSa6fb00CieE+F5jS2m/Ik0842Y8JlKQJutJz1ComPTXzRY9/KzEEHPC8v4NDKgi8UD808yYtK9sssC3qQqO7oQyLFUBclqob01sWnvk7FBdzPb2cqZOXP3GMkSd9aM/+fhTcovKeXMTxAkYmDnL98fJO+D0EyFgiOSCdUWOeHPZal7lqI3YdfjT0DGqjLoU9sbm80HVdk6JEjYRoDQ73L+dKhfLSAv/vwp9enzXGzy6smjF3CPvNMpF8fhRqxea1E9HQvINShSe1HGVvih0+g32sg6xiovZWA8od37CrLGnMA2zOQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 27 Feb 2026 07:33:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The first parameter passed to align_timer() is the timer expiration, not
the current time.  Adjust the calls to align_timer() in the on-demand
governor to pass the expected timer expiration as the first parameter.

Fixes: af74e3a15a83 ("cpufreq: align dbs timer for better package C state 
residency")
Fixes: 382b95f627a9 ("Fix cpufreq HW-ALL coordination handle")
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c 
b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 537695eaab19..0d94c0e464a6 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,7 +185,8 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-            align_timer(NOW() , dbs_tuners_ins.sampling_rate));
+              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
+                          dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -400,6 +401,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(t->expires, 
dbs_tuners_ins.sampling_rate));
     }
 }
-- 
2.51.0




 


Rackspace

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