x86/boot: provide better diagnostics in AP boot failure
v3 cover x86/boot: provide better diagnostics in AP boot failure
Hello,
This series attempts to improve AP boot failure diagnosis by improving the printed failure messages (patch 1) and detecting AP getting stuck during bringup (patch 3). Patch 2 is preparatory changes for the work done in patch 3.
They should be non-functional changes for systems working correctly.
Thanks, Roger.
Roger Pau Monne (3):
x86/boot: print CPU and APIC ID in bring up failure x86/traps: split code to dump execution state to a separate helper x86/boot: attempt to print trace and panic on AP bring up stall
xen/arch/x86/include/asm/processor.h | 1 + xen/arch/x86/smpboot.c | 15 ++++++- xen/arch/x86/traps.c | 63 ++++++++++++++++++---------- 3 files changed, 54 insertions(+), 25 deletions(-)
Signature · 1 line
2.49.0
PATCH v3 1/3 x86/boot: print CPU and APIC ID in bring up failure
Print the CPU and APIC ID that fails to respond to the init sequence, or that didn't manage to reach the "callin" state. Expand a bit the printed error messages. Otherwise the "Not responding." message is not easy to understand by users.
---
Changes since v2:
- Adjust format string.
Changes since v1:
- Also print APIC ID.
--- xen/arch/x86/smpboot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
xen/arch/x86/smpboot.c +4 -2
@@ -618,10 +618,12 @@ static int do_boot_cpu(int apicid, int cpu)smp_mb ();if (bootsym (trampoline_cpu_started) ==0xA5 )/* trampoline started but...? */ -printk ("Stuck ??\n" ); +printk ("APIC ID %#x (CPU%u) didn't finish start sequence\n" , + apicid, cpu);else /* trampoline code not run */ -printk ("Not responding.\n" ); +printk ("APIC ID %#x (CPU%u) didn't respond to SIPI\n" , + apicid, cpu); } }
Signature · 1 line
2.49.0
Re: [PATCH v3 1/3] x86/boot: print CPU and APIC ID in bring up failure
Quoted 7 lines · Roger Pau Monne
Print the CPU and APIC ID that fails to respond to the init sequence, or that didn't manage to reach the "callin" state. Expand a bit the printed error messages. Otherwise the "Not responding." message is not easy to understand by users.
Reported-by Andrew Cooper <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
PATCH v3 2/3 x86/traps: split code to dump execution state to a separate helper
In reply to Roger Pau MonneSplit the code that triggers remote CPUs to dump stacks into a separate function. Also introduce a parameter that can be set by the caller of the newly introduced function to force CPUs to dump the full stack, rather than just dumping the current function name.
No functional change intended.
---
Changes since v2:
- Use parameter opt_show_all variable.
--- xen/arch/x86/include/asm/processor.h | 1 + xen/arch/x86/traps.c | 63 ++++++++++++++++++---------- 2 files changed, 41 insertions(+), 23 deletions(-)
xen/arch/x86/include/asm/processor.h +1 -0
@@ -371,6 +371,7 @@ void show_registers(const struct cpu_user_regs *regs);#define dump_execution_state () run_in_exception_handler(show_execution_state)void show_page_walk (unsigned long addr);void noreturnfatal_trap (const struct cpu_user_regs *regs,bool show_remote); +void show_execution_state_nmi (const cpumask_t *mask,bool show_all);extern void mtrr_ap_init (void );extern void mtrr_bp_init (void );
xen/arch/x86/traps.c +40 -23
77 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v3 2/3] x86/traps: split code to dump execution state to a separate helper
Quoted 8 lines · Roger Pau Monne
Split the code that triggers remote CPUs to dump stacks into a separate function. Also introduce a parameter that can be set by the caller of the newly introduced function to force CPUs to dump the full stack, rather than just dumping the current function name.
No functional change intended.
Signed-off-by Roger Pau Monné <[email protected]>
PATCH v3 3/3 x86/boot: attempt to print trace and panic on AP bring up stall
In reply to Roger Pau MonneWith the current AP bring up code, Xen can get stuck indefinitely if an AP freezes during boot after the 'callin' step. Introduce a 5s timeout while waiting for APs to finish startup.
On failure of an AP to complete startup, send an NMI to trigger the printing of a stack backtrace on the stuck AP and panic on the BSP.
This patch was done while investigating the issue caused by Intel erratum ICX143. It wasn't helpful in that case, but it's still and improvement when debugging AP bring up related issues.
---
Changes since v2:
- Adjust panic message to match the similar ones printed for AP start failures.
Changes since v1:
- Use 5s timeout.
- Print APICID.
- Split NMI dispatch code movement to a pre-patch.
- Reorder timeout check condition.
--- xen/arch/x86/smpboot.c | 9 +++++++++ 1 file changed, 9 insertions(+)
xen/arch/x86/smpboot.c +9 -0
@@ -1372,6 +1372,7 @@ int cpu_add(uint32_t apic_id, uint32_t acpi_id, uint32_t pxm)int __cpu_up (unsigned int cpu) {int apicid, ret; +s_time_t start;if ( (apicid = x86_cpu_to_apicid[cpu]) ==BAD_APICID )return -ENODEV ;
@@ -1390,10 +1391,18 @@ int __cpu_up(unsigned int cpu)time_latch_stamps ();set_cpu_state (CPU_STATE_ONLINE ); + start =NOW ();while ( !cpu_online (cpu) ) {cpu_relax ();process_pending_softirqs (); +if ( (NOW () - start) >SECONDS (5 ) ) + { +/* AP is stuck, send NMI and panic. */ +show_execution_state_nmi (cpumask_of (cpu), true); +panic ("APIC ID %#x (CPU%u) stuck while starting up\n" , + apicid, cpu); + } }return 0 ;
Signature · 1 line
2.49.0