Before processing steal metrics, system also needs to know the number of
entitled CPUs. Till that time, delay the steal processing till the time
entitlement information is available.

Signed-off-by: Srikar Dronamraju <[email protected]>
---
 arch/powerpc/kernel/smp.c             | 8 ++++++++
 arch/powerpc/platforms/pseries/lpar.c | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c33e9928a2b0..016dc7dc5bbc 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -82,6 +82,9 @@ bool has_big_cores __ro_after_init;
 bool coregroup_enabled __ro_after_init;
 bool thread_group_shares_l2 __ro_after_init;
 bool thread_group_shares_l3 __ro_after_init;
+#ifdef CONFIG_PPC_SPLPAR
+bool process_steal_enable __ro_after_init;
+#endif
 
 DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
 DEFINE_PER_CPU(cpumask_var_t, cpu_smallcore_map);
@@ -1736,6 +1739,11 @@ void __init smp_cpus_done(unsigned int max_cpus)
 #ifdef CONFIG_PPC_SPLPAR
        if (smp_ops->num_available_cores)
                smp_ops->num_available_cores();
+
+       if (is_shared_processor() && !is_kvm_guest())
+               process_steal_enable = true;
+       else
+               process_steal_enable = false;
 #endif
 }
 
diff --git a/arch/powerpc/platforms/pseries/lpar.c 
b/arch/powerpc/platforms/pseries/lpar.c
index 3431730a10ea..f8e049ac9364 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -674,6 +674,7 @@ static bool should_cpu_process_steal(int cpu)
        return false;
 }
 
+extern bool process_steal_enable;
 static void process_steal(int cpu)
 {
        static unsigned long next_tb, prev_steal;
@@ -682,6 +683,9 @@ static void process_steal(int cpu)
        unsigned long steal = 0;
        unsigned int i;
 
+       if (!process_steal_enable)
+               return;
+
        if (!should_cpu_process_steal(cpu))
                return;
 
-- 
2.43.7


Reply via email to