x86/traps: make panic and reboot paths safe during early boot
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 16 May 2014 15:36:40 +0000 (17:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 May 2014 15:36:40 +0000 (17:36 +0200)
commit415738e2f6e5635b537cbf93a5a1620b15afff6f
treee312c28c8fbcb204b10de446a072dea2f1a6961a
parentc783c5b14d78f316e9bfb6ed770c492b6c8ce801
x86/traps: make panic and reboot paths safe during early boot

Reverse two conditions in show_registers().  For an early crash, it is not
safe to dereference 'current' for its HVM status before knowing that it is a
guest vcpu.

Introduce SYS_STATE_smp_boot to distinguish the point at which APs need
considering before boot is complete.  There is one code change required as a
result; .init.text symbols are still in use before Xen is active, so alter its
predicate in is_active_kernel_text().

Make use of SYS_STATE_smp_boot in machine_{halt,restart}().  Before Xen starts
booting the APs, any execution here is certainly the BSP.

When halting or rebooting particularly early, this avoids the risks of a #PF
or #GP when accessing the LAPIC before generic_apic_probe(), as well as trying
to enable interrupts before init_IRQ() is complete.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/setup.c
xen/arch/x86/shutdown.c
xen/arch/x86/x86_64/traps.c
xen/common/symbols.c
xen/include/xen/kernel.h