lkml.org 
[lkml]   [2013]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 30/40] x86: tboot: Convert to hotplug state machine
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/tboot.c | 23 +++++++----------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 8 insertions(+), 16 deletions(-)

Index: linux-2.6/arch/x86/kernel/tboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/tboot.c
+++ linux-2.6/arch/x86/kernel/tboot.c
@@ -319,25 +319,16 @@ static int tboot_wait_for_aps(int num_ap
return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
}

-static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
+static int __cpuinit 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 __cpuinitdata =
-{
- .notifier_call = tboot_cpu_callback,
-};
-
static __init int tboot_late_init(void)
{
if (!tboot_enabled())
@@ -346,7 +337,7 @@ 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, NULL, tboot_dying_cpu);

acpi_os_set_prepare_sleep(&tboot_sleep);
return 0;
Index: linux-2.6/include/linux/cpuhotplug.h
===================================================================
--- linux-2.6.orig/include/linux/cpuhotplug.h
+++ linux-2.6/include/linux/cpuhotplug.h
@@ -27,6 +27,7 @@ enum cpuhp_states {
CPUHP_AP_ARM64_TIMER_STARTING,
CPUHP_AP_KVM_STARTING,
CPUHP_AP_NOTIFY_DYING,
+ CPUHP_AP_X86_TBOOT_DYING,
CPUHP_AP_S390_VTIME_DYING,
CPUHP_AP_SCHED_MIGRATE_DYING,
CPUHP_AP_MAX,



\
 
 \ /
  Last update: 2013-01-31 14:21    [W:0.324 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site