[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251204175405.1511340-18-srikar@linux.ibm.com>
Date: Thu, 4 Dec 2025 23:24:05 +0530
From: Srikar Dronamraju <srikar@...ux.ibm.com>
To: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
Peter Zijlstra <peterz@...radead.org>
Cc: Ben Segall <bsegall@...gle.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Ingo Molnar <mingo@...nel.org>, Juri Lelli <juri.lelli@...hat.com>,
K Prateek Nayak <kprateek.nayak@....com>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Mel Gorman <mgorman@...e.de>, Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Shrikanth Hegde <sshegde@...ux.ibm.com>,
Srikar Dronamraju <srikar@...ux.ibm.com>,
Steven Rostedt <rostedt@...dmis.org>,
Swapnil Sapkal <swapnil.sapkal@....com>,
Thomas Huth <thuth@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
virtualization@...ts.linux.dev, Yicong Yang <yangyicong@...ilicon.com>,
Ilya Leoshkevich <iii@...ux.ibm.com>
Subject: [PATCH 17/17] pseries/lpar: Add debug interface to set steal interval
Currently steal metrics are processed on CPU 0 at a 2 second interval.
However the right value for processing the steal interval has yet to be
discovered. If a too small value is provided, LPAR may end up adjusting
too frequently and also the steal metrics may also be unreliable. If
too large value is provided, LPAR may lose the opportunity for soft
online and offline. Hence enable a debug interface for privileged users to
specify steal interval.
Signed-off-by: Srikar Dronamraju <srikar@...ux.ibm.com>
---
arch/powerpc/platforms/pseries/lpar.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f5caf1137707..4f7b217a4eb3 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -660,8 +660,8 @@ machine_device_initcall(pseries, vcpudispatch_stats_procfs_init);
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
#define STEAL_MULTIPLE (STEAL_RATIO * STEAL_RATIO)
-#define PURR_UPDATE_TB tb_ticks_per_sec
+static u8 steal_interval = 1;
static bool should_cpu_process_steal(int cpu)
{
@@ -674,8 +674,8 @@ static bool should_cpu_process_steal(int cpu)
extern bool process_steal_enable;
static void process_steal(int cpu)
{
+ unsigned long steal_ratio, delta_tb, interval_tb;
static unsigned long next_tb, prev_steal;
- unsigned long steal_ratio, delta_tb;
unsigned long tb = mftb();
unsigned long steal = 0;
unsigned int i;
@@ -696,14 +696,18 @@ static void process_steal(int cpu)
steal += be64_to_cpu(READ_ONCE(lppaca->enqueue_dispatch_tb));
}
+ if (!steal_interval)
+ steal_interval = 1;
+
+ interval_tb = steal_interval * tb_ticks_per_sec;
if (next_tb && prev_steal) {
- delta_tb = max(tb - (next_tb - PURR_UPDATE_TB), 1);
+ delta_tb = max(tb - (next_tb - interval_tb), 1);
steal_ratio = (steal - prev_steal) * STEAL_MULTIPLE;
steal_ratio /= (delta_tb * num_online_cpus());
trigger_softoffline(steal_ratio);
}
- next_tb = tb + PURR_UPDATE_TB;
+ next_tb = tb + interval_tb;
prev_steal = steal;
}
@@ -2081,6 +2085,9 @@ static int __init vpa_debugfs_init(void)
debugfs_create_file(name, 0400, vpa_dir, (void *)i, &vpa_fops);
}
+#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
+ debugfs_create_u8("steal_interval_secs", 0600, arch_debugfs_dir, &steal_interval);
+#endif
return 0;
}
machine_arch_initcall(pseries, vpa_debugfs_init);
--
2.43.7
Powered by blists - more mailing lists