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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-ae6a8a2ed721ecdbc15d32b2089af5ed2190adc7@git.kernel.org>
Date:	Tue, 19 Jul 2016 00:26:26 -0700
From:	tip-bot for Richard Cochran <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	anna-maria@...utronix.de, tglx@...utronix.de,
	richard.l.maliszewski@...el.com, hpa@...or.com, mingo@...nel.org,
	linux-kernel@...r.kernel.org, ning.sun@...el.com,
	gang.wei@...el.com, rcochran@...utronix.de,
	torvalds@...ux-foundation.org, bigeasy@...utronix.de,
	shane.wang@...el.com, peterz@...radead.org
Subject: [tip:smp/hotplug] x86/tboot: Convert to hotplug state machine

Commit-ID:  ae6a8a2ed721ecdbc15d32b2089af5ed2190adc7
Gitweb:     http://git.kernel.org/tip/ae6a8a2ed721ecdbc15d32b2089af5ed2190adc7
Author:     Richard Cochran <rcochran@...utronix.de>
AuthorDate: Wed, 13 Jul 2016 17:16:57 +0000
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 15 Jul 2016 10:40:30 +0200

x86/tboot: Convert to hotplug state machine

Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.

Signed-off-by: Richard Cochran <rcochran@...utronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@...utronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Gang Wei <gang.wei@...el.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Ning Sun <ning.sun@...el.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Richard L Maliszewski <richard.l.maliszewski@...el.com>
Cc: Shane Wang <shane.wang@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: rt@...utronix.de
Cc: tboot-devel@...ts.sourceforge.net
Link: http://lkml.kernel.org/r/20160713153337.400227322@linutronix.de
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/kernel/tboot.c    | 25 ++++++++-----------------
 include/linux/cpuhotplug.h |  1 +
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index 9b0185f..654f6c6 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -323,25 +323,16 @@ static int tboot_wait_for_aps(int num_aps)
 	return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
 }
 
-static int tboot_cpu_callback(struct notifier_block *nfb, unsigned long action,
-			      void *hcpu)
+static int tboot_dying_cpu(unsigned int cpu)
 {
-	switch (action) {
-	case CPU_DYING:
-		atomic_inc(&ap_wfs_count);
-		if (num_online_cpus() == 1)
-			if (tboot_wait_for_aps(atomic_read(&ap_wfs_count)))
-				return NOTIFY_BAD;
-		break;
+	atomic_inc(&ap_wfs_count);
+	if (num_online_cpus() == 1) {
+		if (tboot_wait_for_aps(atomic_read(&ap_wfs_count)))
+			return -EBUSY;
 	}
-	return NOTIFY_OK;
+	return 0;
 }
 
-static struct notifier_block tboot_cpu_notifier =
-{
-	.notifier_call = tboot_cpu_callback,
-};
-
 #ifdef CONFIG_DEBUG_FS
 
 #define TBOOT_LOG_UUID	{ 0x26, 0x25, 0x19, 0xc0, 0x30, 0x6b, 0xb4, 0x4d, \
@@ -417,8 +408,8 @@ static __init int tboot_late_init(void)
 	tboot_create_trampoline();
 
 	atomic_set(&ap_wfs_count, 0);
-	register_hotcpu_notifier(&tboot_cpu_notifier);
-
+	cpuhp_setup_state(CPUHP_AP_X86_TBOOT_DYING, "AP_X86_TBOOT_DYING", NULL,
+			  tboot_dying_cpu);
 #ifdef CONFIG_DEBUG_FS
 	debugfs_create_file("tboot_log", S_IRUSR,
 			arch_debugfs_dir, NULL, &tboot_log_fops);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index c5b96d0..070cc7f 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -53,6 +53,7 @@ enum cpuhp_state {
 	CPUHP_AP_ARM_CORESIGHT4_STARTING,
 	CPUHP_AP_ARM64_ISNDEP_STARTING,
 	CPUHP_AP_LEDTRIG_STARTING,
+	CPUHP_AP_X86_TBOOT_DYING,
 	CPUHP_AP_NOTIFY_STARTING,
 	CPUHP_AP_ONLINE,
 	CPUHP_TEARDOWN_CPU,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ