On Thu, Jan 15, 2015 at 09:22:26PM -0000, Thomas Gleixner wrote: > enable_x2apic() is a convoluted unreadable mess because it is used for > both enablement in early boot and for setup in cpu_init(). > > Split the code into x2apic_enable() for enablement and x2apic_setup() > for setup of (secondary cpus). Make use of the new state tracking to > simplify the logic. > > Signed-off-by: Thomas Gleixner <t...@linutronix.de> > ---
... > @@ -1517,6 +1528,21 @@ static int __init setup_nox2apic(char *s > } > early_param("nox2apic", setup_nox2apic); > > +/* Called from cpu_init() to enable x2apic on (secondary) cpus */ > +void x2apic_setup(void) > +{ > + /* > + * If x2apic is not in ON state, disable it if already enabled > + * from BIOS. > + */ > + if (x2apic_state != X2APIC_ON) { > + if (cpu_has_apic) Let's move this test into disable_x2apic() so that callers don't have to pay attention. > + disable_x2apic(); > + return; > + } > + enable_x2apic(); > +} > + > static __init void x2apic_disable(void) > { > u64 msr; ... > Index: tip/arch/x86/kernel/cpu/common.c > =================================================================== > --- tip.orig/arch/x86/kernel/cpu/common.c > +++ tip/arch/x86/kernel/cpu/common.c > @@ -1332,7 +1332,7 @@ void cpu_init(void) > barrier(); > > x86_configure_nx(); > - enable_x2apic(); > + x2apic_setup(); 64-bit only? I'd guess so since the original call enable_x2apic() is 64-bit only too but why? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/