Skip to contentSkip to conversation

x86: avoid early crash in disable_local_APIC()

PATCH Applied Jan Beulich 3 participants 7 messages Jan 14, 2009 – Jan 16, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: avoid early crash in disable_local_APIC()

E.g. when called due to an early panic.

---
 arch/x86/kernel/apic.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kernel/apic.c +4 -0
@@ -894,6 +894,10 @@ void disable_local_APIC(void)
 {
 	unsigned int value;
 
+	/* APIC hasn't been mapped yet */
+	if (!apic_phys)
+		return;
+
 	clear_local_APIC();
 
 	/*
Applied
#1 lore raw
Quoted 7 lines · Jan Beulich

E.g. when called due to an early panic.

---
 arch/x86/kernel/apic.c |    4 ++++
 1 file changed, 4 insertions(+)

applied to tip/x86/urgent, thanks!

Ingo

#2 lore raw

hm, this gives a build failure on latest -tip:

arch/x86/kernel/apic.c: In function 'setup_local_APIC':
arch/x86/kernel/apic.c:1135: error: implicit declaration of function 'disable_ioapic_setup'

Ingo

#3 lore raw
Quoted 4 lines · Ingo Molnar

hm, this gives a build failure on latest -tip:

arch/x86/kernel/apic.c: In function 'setup_local_APIC':
arch/x86/kernel/apic.c:1135: error: implicit declaration of function 'disable_ioapic_setup'

i mean this one caused it:

commit f11826385b63566d98c02d35f592232ee77cd791

Author: Jan Beulich <[email protected]>
Date:   Wed Jan 14 12:27:35 2009 +0000

x86: fully honor "nolapic"

Ingo

#4 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Ingo Molnar <[email protected]> 15.01.09 23:47 >>>

Quoted 4 lines · Ingo Molnar

hm, this gives a build failure on latest -tip:

arch/x86/kernel/apic.c: In function 'setup_local_APIC':
arch/x86/kernel/apic.c:1135: error: implicit declaration of function 'disable_ioapic_setup'

Is this with a config that has X86_IO_APIC off (i.e. one the practical use of which I never understood, and hence easily forget to consider)? Otherwise I can't see how that could happen.

Jan

#5 lore raw
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Ingo Molnar <[email protected]> 15.01.09 23:47 >>>

* Ingo Molnar <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

hm, this gives a build failure on latest -tip:

arch/x86/kernel/apic.c: In function 'setup_local_APIC':
arch/x86/kernel/apic.c:1135: error: implicit declaration of function 'disable_ioapic_setup'

Is this with a config that has X86_IO_APIC off (i.e. one the practical use of which I never understood, and hence easily forget to consider)? Otherwise I can't see how that could happen.

yeah. Such build failures are reminders to define such functions in a .config-invariant way: i.e. an extern prototype plus an inline NOP-wrapper for the !IO_APIC case.

Ingo

#6 lore raw
In reply to Jan Beulich
Quoted 3 lines · Jan Beulich

Is this with a config that has X86_IO_APIC off (i.e. one the practical use of which I never understood, and hence easily forget to consider)? Otherwise I can't see how that could happen.

A lot of systems have a P6-class CPU which has a local APIC and no I/O
APIC in the chipset. My old laptop was an example of one. It saves some memory to have X86_IO_APIC disabled on such systems, while still being able to use the local APIC for the NMI watchdog and PeMo.

Maciej