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]
Date:	Wed,  9 May 2012 12:25:01 +0200
From:	Igor Mammedov <imammedo@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	rob@...dley.net, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, x86@...nel.org, luto@....edu,
	suresh.b.siddha@...el.com, avi@...hat.com, imammedo@...hat.com,
	a.p.zijlstra@...llo.nl, johnstul@...ibm.com, arjan@...ux.intel.com,
	linux-doc@...r.kernel.org
Subject: [PATCH 4/5] Cancel secondary CPU bringup if boot cpu abandoned this effort

Instead go to idle without setting cpu online, which results in calling play_dead()

Signed-off-by: Igor Mammedov <imammedo@...hat.com>
---
 arch/x86/include/asm/tsc.h |    2 +-
 arch/x86/kernel/smpboot.c  |   12 +++++++++++-
 arch/x86/kernel/tsc_sync.c |   10 ++++++----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
index c91e8b9..b2491fc 100644
--- a/arch/x86/include/asm/tsc.h
+++ b/arch/x86/include/asm/tsc.h
@@ -58,7 +58,7 @@ extern int tsc_clocksource_reliable;
  * all CPUs/cores:
  */
 extern void check_tsc_sync_source(int cpu);
-extern void check_tsc_sync_target(void);
+extern bool check_tsc_sync_target(void);
 
 extern int notsc_setup(char *);
 extern void tsc_save_sched_clock_state(void);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index ae19d90..af63cab 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -264,7 +264,16 @@ notrace static void __cpuinit start_secondary(void *unused)
 	/*
 	 * Check TSC synchronization with the BP:
 	 */
-	check_tsc_sync_target();
+	if (!check_tsc_sync_target()) {
+		clear_local_APIC();
+
+		/* was set by cpu_init() */
+		cpumask_clear_cpu(smp_processor_id(), cpu_initialized_mask);
+		/* was set by smp_callin() */
+		cpumask_clear_cpu(smp_processor_id(), cpu_callin_mask);
+
+		goto do_idle;
+	}
 
 	notify_cpu_starting(smp_processor_id());
 
@@ -296,6 +305,7 @@ notrace static void __cpuinit start_secondary(void *unused)
 
 	x86_cpuinit.setup_percpu_clockev();
 
+do_idle:
 	wmb();
 	cpu_idle();
 }
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 1741385..45a593e 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -180,22 +180,22 @@ void __cpuinit check_tsc_sync_source(int cpu)
 /*
  * Freshly booted CPUs call into this:
  */
-void __cpuinit check_tsc_sync_target(void)
+bool __cpuinit check_tsc_sync_target(void)
 {
 	if (unsynchronized_tsc() || tsc_clocksource_reliable)
-		return;
+		return true;
 
 	/*
 	 * Wait for the source CPU to start the measurement
 	 */
 	while (!atomic_read(&start_tsc_sync)) {
 		if (!cpumask_test_cpu(smp_processor_id(), cpu_callout_mask))
-			return;
+			return false;
 		cpu_relax();
 	}
 
 	if (!cpumask_test_cpu(smp_processor_id(), cpu_callout_mask))
-		return;
+		return false;
 
 	atomic_set(&start_tsc_sync, 0);
 
@@ -211,4 +211,6 @@ void __cpuinit check_tsc_sync_target(void)
 	 */
 	while (atomic_read(&stop_tsc_sync))
 		cpu_relax();
+
+	return true;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ