[PATCH 2/3] x86: halt secondary CPU if master doesn't wait on it
From: Igor Mammedov
Date: Thu Mar 13 2014 - 10:26:31 EST
if during CPU hotplug master CPU had errors during
sending AP wake up IPIs, it fails hotplug operation.
But AP might start and spin on never set
cpu_callout_mask indefinitely, consuming power or
host VCPU resources needlessly.
On the other hand, master CPU marks AP with
BAD_APICID if hotplug attempt failed, so use this
fact to halt CPU to avoid needless spinning.
Signed-off-by: Igor Mammedov <imammedo@xxxxxxxxxx>
---
arch/x86/kernel/cpu/common.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index e048e87..9f07b8e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1242,8 +1242,11 @@ void cpu_init(void)
* wait till the master CPU completes it's STARTUP sequence,
* and decides to wait till this AP boots
*/
- while (!cpumask_test_cpu(cpu, cpu_callout_mask))
+ while (!cpumask_test_cpu(cpu, cpu_callout_mask)) {
cpu_relax();
+ if (per_cpu(x86_cpu_to_apicid, cpu) == BAD_APICID)
+ halt();
+ }
/*
* Load microcode on this cpu if a valid microcode is available.
@@ -1345,8 +1348,11 @@ void cpu_init(void)
* wait till the master CPU completes it's STARTUP sequence,
* and decides to wait till this AP boots
*/
- while (!cpumask_test_cpu(cpu, cpu_callout_mask))
+ while (!cpumask_test_cpu(cpu, cpu_callout_mask)) {
cpu_relax();
+ if (per_cpu(x86_cpu_to_apicid, cpu) == BAD_APICID)
+ halt();
+ }
show_ucode_info_early();
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/