mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arch/x86/mm/kmemcheck/kmemcheck.c: use max cpus
@ 2015-10-31  9:34 Sudip Mukherjee
  0 siblings, 0 replies; only message in thread
From: Sudip Mukherjee @ 2015-10-31  9:34 UTC (permalink / raw)
  To: Vegard Nossum, Pekka Enberg, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin
  Cc: linux-kernel, x86, Sudip Mukherjee

If SMP is enabled then to use kmemcheck we are limiting to one CPU. And
if kmemcheck selftest fails, we are disabling kmemcheck and returning. But
we are still using single CPU even though kmemcheck is disabled.
Use the original max cpu value if kmemcheck selftest fails.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 arch/x86/mm/kmemcheck/kmemcheck.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b4f2e7e..4f09508 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -52,8 +52,12 @@ int __init kmemcheck_init(void)
 #ifdef CONFIG_SMP
 	/*
 	 * Limit SMP to use a single CPU. We rely on the fact that this code
-	 * runs before SMP is set up.
+	 * runs before SMP is set up. Save the original value so that if
+	 * kmemcheck_selftest() fails we can use the original value
+	 * instead of using single CPU.
 	 */
+	unsigned int orig_max_cpu = setup_max_cpus;
+
 	if (setup_max_cpus > 1) {
 		printk(KERN_INFO
 			"kmemcheck: Limiting number of CPUs to 1.\n");
@@ -64,6 +68,9 @@ int __init kmemcheck_init(void)
 	if (!kmemcheck_selftest()) {
 		printk(KERN_INFO "kmemcheck: self-tests failed; disabling\n");
 		kmemcheck_enabled = 0;
+#ifdef CONFIG_SMP
+		setup_max_cpus = orig_max_cpu;
+#endif
 		return -EINVAL;
 	}
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-31  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-31  9:34 [PATCH] arch/x86/mm/kmemcheck/kmemcheck.c: use max cpus Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®