x86: fully honor "nolapic" (take 2)
PATCH 1/1 x86: fully honor "nolapic" (take 2)
"nolapic" should not only suppress SMP and use of the LAPIC, but it also ought to have the effect of disabling all IO-APIC related activity as well as PCI MSI and HT-IRQs.
--- arch/x86/kernel/apic.c | 9 ++++++++- arch/x86/kernel/io_apic.c | 6 ++++++ arch/x86/kernel/smpboot.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-)
arch/x86/kernel/apic.c +8 -1
@@ -1125,6 +1125,13 @@ void __cpuinit setup_local_APIC(void)unsigned int value;int i, j; +if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + } +#ifdef CONFIG_X86_32 /* Pound the ESR really hard over the head with a big hammer - mbligh */ if (lapic_is_integrated () && esr_disable) {
@@ -1565,11 +1570,11 @@ int apic_version[MAX_APICS];int __init APIC_init_uniprocessor (void ) { -#ifdef CONFIG_X86_64 if (disable_apic) {pr_info ("Apic disabled\n" );return -1 ; } +#ifdef CONFIG_X86_64 if (!cpu_has_apic) { disable_apic =1 ;pr_info ("Apic disabled by BIOS\n" );
arch/x86/kernel/io_apic.c +6 -0
@@ -3258,6 +3258,9 @@ static int msi_compose_msg(struct pci_deint err;unsigned dest; +if (disable_apic) +return -ENXIO ; + cfg =irq_cfg (irq); err =assign_irq_vector (irq, cfg,TARGET_CPUS );if (err)
@@ -3726,6 +3729,9 @@ int arch_setup_ht_irq(unsigned int irq,struct irq_cfg *cfg;int err; +if (disable_apic) +return -ENXIO ; + cfg =irq_cfg (irq); err =assign_irq_vector (irq, cfg,TARGET_CPUS );if (!err) {
arch/x86/kernel/smpboot.c +1 -0
@@ -1125,6 +1125,7 @@ static int __init smp_sanity_check(unsigprintk (KERN_ERR "... forcing use of dummy APIC emulation." "(tell your hw vendor)\n" );smpboot_clear_io_apic (); +disable_ioapic_setup ();return -1 ; }
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines · Jan Beulich
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }
Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
Ingo
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 13:45 >>>
* Jan Beulich <[email protected]> wrote:
Quoted 9 lines
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
That would make for a much bigger patch, since the io_apic.h doesn't (and imo shouldn't) be included without that config option.
Jan
Quoted 14 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 13:45 >>>
* Jan Beulich <[email protected]> wrote:
Quoted 9 lines
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
Quoted 2 lines
That would make for a much bigger patch, since the
io_apic.hdoesn't (and imo shouldn't) be included without that config option.
But we are using io-apic functionality in that file, so we should include io_apic.h, right?
Ingo
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 14:42 >>>
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 13:45 >>>
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines · Jan Beulich
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
Quoted 5 lines
Quoted 2 lines
That would make for a much bigger patch, since the
io_apic.hdoesn't (and imo shouldn't) be included without that config option.But we are using io-apic functionality in that file, so we should include
io_apic.h, right?
I don't generally (i.e. when !X86_IO_APIC) think so - anything accessing stuff from io_apic.c is guarded by a similar #ifdef.
Jan
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 14:42 >>>
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 13:45 >>>
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines · Jan Beulich
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
That would make for a much bigger patch, since the
io_apic.hdoesn't (and imo shouldn't) be included without that config option.But we are using io-apic functionality in that file, so we should include
io_apic.h, right?I don't generally (i.e. when !X86_IO_APIC) think so - anything accessing stuff from
io_apic.cis guarded by a similar #ifdef.
and wrongly so - it proliferates ugly #ifdefs and sets us up for build failures like that. Developers cannot be expected to keep every build option in mind - we should provide an as homogenic and kconfig-invariant environment as possible.
Ingo
Quoted 28 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 14:58 >>>
Quoted 24 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 14:42 >>>
Quoted 14 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Ingo Molnar <[email protected]> 16.01.09 13:45 >>>
* Jan Beulich <[email protected]> wrote:
Quoted 9 lines
arch/x86/kernel/apic.c void __cpuinit setup_local_APIC(void) · line 1133
Quoted 6 lines
arch/x86/kernel/apic.c +6
-0+if (disable_apic) { +#ifdef CONFIG_X86_IO_APIC +disable_ioapic_setup (); +#endif +return ; + }Shouldnt that #ifdef be avoided by always providing the function - just it is a NOP inline in the !CONFIG_X86_IO_APIC case?
Quoted 2 lines
That would make for a much bigger patch, since the
io_apic.hdoesn't (and imo shouldn't) be included without that config option.But we are using io-apic functionality in that file, so we should include
io_apic.h, right?
Quoted 7 lines
Quoted 2 lines
I don't generally (i.e. when !X86_IO_APIC) think so - anything accessing stuff from
io_apic.cis guarded by a similar #ifdef.and wrongly so - it proliferates ugly #ifdefs and sets us up for build failures like that. Developers cannot be expected to keep every build option in mind - we should provide an as homogenic and kconfig-invariant environment as possible.
I mostly agree here, but think that this ought to be a separate cleanup patch.
Jan