Skip to contentSkip to conversation

x86/apic: Disable I/O APIC before shutdown local APIC

PATCH In review Fenghua Yu 3 participants 4 messages Oct 24, 2013 – Nov 7, 2013 x86

lore
Share & tools
lore

Fenghua Yu

author
#0 lore raw

PATCH 1/1 x86/apic: Disable I/O APIC before shutdown local APIC

From: Fenghua Yu <[email protected]>

In reboot and crash path, when shutdown local APIC, I/O APIC is still active. This may cause issues because external interrupts can still come in and disturb local APIC during shutdown process. To quiet external interrupts, disable I/O APIC before shutdown local APIC.

---
 arch/x86/kernel/crash.c  |    2 +-
 arch/x86/kernel/reboot.c |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/kernel/crash.c +1 -1
index e0e0841..18677a9 100644
@@ -127,12 +127,12 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
 	cpu_emergency_vmxoff();
 	cpu_emergency_svm_disable();
 
-	lapic_shutdown();
 #ifdef CONFIG_X86_IO_APIC
 	/* Prevent crash_kexec() from deadlocking on ioapic_lock. */
 	ioapic_zap_locks();
 	disable_IO_APIC();
 #endif
+	lapic_shutdown();
 #ifdef CONFIG_HPET_TIMER
 	hpet_disable();
 #endif
arch/x86/kernel/reboot.c +4 -4
index 7e920bf..618ce26 100644
@@ -550,6 +550,10 @@ static void native_machine_emergency_restart(void)
 void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
+#ifdef CONFIG_X86_IO_APIC
+	disable_IO_APIC();
+#endif
+
 #ifdef CONFIG_SMP
 	/*
 	 * Stop all of the others. Also disable the local irq to
@@ -562,10 +566,6 @@ void native_machine_shutdown(void)
 
 	lapic_shutdown();
 
-#ifdef CONFIG_X86_IO_APIC
-	disable_IO_APIC();
-#endif
-
 #ifdef CONFIG_HPET_TIMER
 	hpet_disable();
 #endif
Signature · 1 line
1.6.0.3
#1 lore raw
Quoted 6 lines · Fenghua Yu

From: Fenghua Yu <[email protected]>

In reboot and crash path, when shutdown local APIC, I/O APIC is still active. This may cause issues because external interrupts can still come in and disturb local APIC during shutdown process. To quiet external interrupts, disable I/O APIC before shutdown local APIC.

What specific 'issues' were observed, on what kind of systems?

Thanks,

Ingo

#2 lore raw
Quoted 8 lines

Ingo Molnar [mailto:[email protected]] wrote:
Friday, October 25, 2013 3:58 AM

Quoted 3 lines · Fenghua Yu

From: Fenghua Yu <[email protected]>

In reboot and crash path, when shutdown local APIC, I/O APIC is still

Quoted 9 lines

active.

Quoted 1 line

This may cause issues because external interrupts can still come in

and

Quoted 1 line

disturb local APIC during shutdown process. To quiet external

interrupts,

Quoted 1 line

disable I/O APIC before shutdown local APIC.

What specific 'issues' were observed, on what kind of systems?

This patch is a workaround for a to-be-published erratum; the erratum will be published in a few weeks.

Thanks.

-Fenghua

#3 lore raw

[tip:x86/apic] x86/apic: Disable I/ O APIC before shutdown of the local APIC

In reply to Fenghua Yu
x86/apic: Disable I/O APIC before shutdown of the local APIC
Commit-ID:  522e66464467543c0d88d023336eec4df03ad40b
Gitweb:     http://git.kernel.org/tip/522e66464467543c0d88d023336eec4df03ad40b
Author:     Fenghua Yu <[email protected]>
AuthorDate: Wed, 23 Oct 2013 18:30:12 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 7 Nov 2013 10:12:37 +0100

x86/apic: Disable I/O APIC before shutdown of the local APIC

In reboot and crash path, when we shut down the local APIC, the I/O APIC is still active. This may cause issues because external interrupts can still come in and disturb the local APIC during shutdown process.

To quiet external interrupts, disable I/O APIC before shutdown local APIC.

[ I suppose the 'issue' is a hang during shutdown. It's a fine change nevertheless. ]
---
 arch/x86/kernel/crash.c  | 2 +-
 arch/x86/kernel/reboot.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/kernel/crash.c +1 -1
index e0e0841..18677a9 100644
@@ -127,12 +127,12 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
 	cpu_emergency_vmxoff();
 	cpu_emergency_svm_disable();
 
-	lapic_shutdown();
 #ifdef CONFIG_X86_IO_APIC
 	/* Prevent crash_kexec() from deadlocking on ioapic_lock. */
 	ioapic_zap_locks();
 	disable_IO_APIC();
 #endif
+	lapic_shutdown();
 #ifdef CONFIG_HPET_TIMER
 	hpet_disable();
 #endif
arch/x86/kernel/reboot.c +4 -4
index 7e920bf..618ce26 100644
@@ -550,6 +550,10 @@ static void native_machine_emergency_restart(void)
 void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
+#ifdef CONFIG_X86_IO_APIC
+	disable_IO_APIC();
+#endif
+
 #ifdef CONFIG_SMP
 	/*
 	 * Stop all of the others. Also disable the local irq to
@@ -562,10 +566,6 @@ void native_machine_shutdown(void)
 
 	lapic_shutdown();
 
-#ifdef CONFIG_X86_IO_APIC
-	disable_IO_APIC();
-#endif
-
 #ifdef CONFIG_HPET_TIMER
 	hpet_disable();
 #endif