lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251204175405.1511340-16-srikar@linux.ibm.com>
Date: Thu,  4 Dec 2025 23:24:03 +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 15/17] pseries/hotplug: Update available_cores on a dlpar event

Everytime, a DLPAR CPU event happens on a shared LPAR, the number of
entitled_cores, and virtual processors allotted to the LPAR can change.
Hence available_cores has to be updated to be in sync.

Signed-off-by: Srikar Dronamraju <srikar@...ux.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 6 ++++++
 arch/powerpc/platforms/pseries/pseries.h     | 1 +
 arch/powerpc/platforms/pseries/smp.c         | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index bc6926dbf148..4ba8cc049b5b 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -284,6 +284,9 @@ static int pseries_add_processor(struct device_node *np)
 
 out:
 	cpu_maps_update_done();
+#ifdef CONFIG_PPC_SPLPAR
+	pseries_num_available_cores();
+#endif
 	free_cpumask_var(cpu_mask);
 	return rc;
 }
@@ -323,6 +326,9 @@ static void pseries_remove_processor(struct device_node *np)
 			       "with physical id 0x%x\n", thread);
 	}
 	cpu_maps_update_done();
+#ifdef CONFIG_PPC_SPLPAR
+	pseries_num_available_cores();
+#endif
 }
 
 static int dlpar_offline_cpu(struct device_node *dn)
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 2527c2049e74..1eed08752a03 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -121,6 +121,7 @@ extern u32 pseries_security_flavor;
 void pseries_setup_security_mitigations(void);
 #ifdef CONFIG_PPC_SPLPAR
 void trigger_softoffline(unsigned long steal_ratio);
+unsigned int pseries_num_available_cores(void);
 #endif
 
 #ifdef CONFIG_PPC_64S_HASH_MMU
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 69e209880b6f..a3daac4c3e1e 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -293,7 +293,7 @@ static unsigned int entitled_cores __read_mostly;
 static unsigned int available_cores;
 
 /* Get pseries soft entitlement limit */
-static unsigned int pseries_num_available_cores(void)
+unsigned int pseries_num_available_cores(void)
 {
 	unsigned int present_cores = num_present_cpus() / threads_per_core;
 	unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
-- 
2.43.7


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ