@@ -376,38 +376,42 @@ static void uv_nmi_wait(int master)
376
376
atomic_read (& uv_nmi_cpus_in_nmi ), num_online_cpus ());
377
377
}
378
378
379
+ /* Dump Instruction Pointer header */
379
380
static void uv_nmi_dump_cpu_ip_hdr (void )
380
381
{
381
- printk (KERN_DEFAULT
382
- "\nUV: %4s %6s %-32s %s (Note: PID 0 not listed)\n" ,
382
+ pr_info ("\nUV: %4s %6s %-32s %s (Note: PID 0 not listed)\n" ,
383
383
"CPU" , "PID" , "COMMAND" , "IP" );
384
384
}
385
385
386
+ /* Dump Instruction Pointer info */
386
387
static void uv_nmi_dump_cpu_ip (int cpu , struct pt_regs * regs )
387
388
{
388
- printk (KERN_DEFAULT "UV: %4d %6d %-32.32s " ,
389
- cpu , current -> pid , current -> comm );
390
-
389
+ pr_info ("UV: %4d %6d %-32.32s " , cpu , current -> pid , current -> comm );
391
390
printk_address (regs -> ip );
392
391
}
393
392
394
- /* Dump this cpu's state */
393
+ /*
394
+ * Dump this CPU's state. If action was set to "kdump" and the crash_kexec
395
+ * failed, then we provide "dump" as an alternate action. Action "dump" now
396
+ * also includes the show "ips" (instruction pointers) action whereas the
397
+ * action "ips" only displays instruction pointers for the non-idle CPU's.
398
+ * This is an abbreviated form of the "ps" command.
399
+ */
395
400
static void uv_nmi_dump_state_cpu (int cpu , struct pt_regs * regs )
396
401
{
397
402
const char * dots = " ................................. " ;
398
403
399
- if (uv_nmi_action_is ("ips" )) {
400
- if (cpu == 0 )
401
- uv_nmi_dump_cpu_ip_hdr ();
404
+ if (cpu == 0 )
405
+ uv_nmi_dump_cpu_ip_hdr ();
402
406
403
- if (current -> pid != 0 )
404
- uv_nmi_dump_cpu_ip (cpu , regs );
407
+ if (current -> pid != 0 || ! uv_nmi_action_is ( "ips" ) )
408
+ uv_nmi_dump_cpu_ip (cpu , regs );
405
409
406
- } else if (uv_nmi_action_is ("dump" )) {
407
- printk (KERN_DEFAULT
408
- "UV:%sNMI process trace for CPU %d\n" , dots , cpu );
410
+ if (uv_nmi_action_is ("dump" )) {
411
+ pr_info ("UV:%sNMI process trace for CPU %d\n" , dots , cpu );
409
412
show_regs (regs );
410
413
}
414
+
411
415
this_cpu_write (uv_cpu_nmi .state , UV_NMI_STATE_DUMP_DONE );
412
416
}
413
417
@@ -469,8 +473,7 @@ static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master)
469
473
uv_nmi_trigger_dump (tcpu );
470
474
}
471
475
if (ignored )
472
- printk (KERN_DEFAULT "UV: %d CPUs ignored NMI\n" ,
473
- ignored );
476
+ pr_alert ("UV: %d CPUs ignored NMI\n" , ignored );
474
477
475
478
console_loglevel = saved_console_loglevel ;
476
479
pr_alert ("UV: process trace complete\n" );
@@ -492,8 +495,9 @@ static void uv_nmi_touch_watchdogs(void)
492
495
touch_nmi_watchdog ();
493
496
}
494
497
495
- #if defined(CONFIG_KEXEC_CORE )
496
498
static atomic_t uv_nmi_kexec_failed ;
499
+
500
+ #if defined(CONFIG_KEXEC_CORE )
497
501
static void uv_nmi_kdump (int cpu , int master , struct pt_regs * regs )
498
502
{
499
503
/* Call crash to dump system state */
@@ -502,10 +506,9 @@ static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
502
506
crash_kexec (regs );
503
507
504
508
pr_emerg ("UV: crash_kexec unexpectedly returned, " );
509
+ atomic_set (& uv_nmi_kexec_failed , 1 );
505
510
if (!kexec_crash_image ) {
506
511
pr_cont ("crash kernel not loaded\n" );
507
- atomic_set (& uv_nmi_kexec_failed , 1 );
508
- uv_nmi_sync_exit (1 );
509
512
return ;
510
513
}
511
514
pr_cont ("kexec busy, stalling cpus while waiting\n" );
@@ -514,16 +517,14 @@ static void uv_nmi_kdump(int cpu, int master, struct pt_regs *regs)
514
517
/* If crash exec fails the slaves should return, otherwise stall */
515
518
while (atomic_read (& uv_nmi_kexec_failed ) == 0 )
516
519
mdelay (10 );
517
-
518
- /* Crash kernel most likely not loaded, return in an orderly fashion */
519
- uv_nmi_sync_exit (0 );
520
520
}
521
521
522
522
#else /* !CONFIG_KEXEC_CORE */
523
523
static inline void uv_nmi_kdump (int cpu , int master , struct pt_regs * regs )
524
524
{
525
525
if (master )
526
526
pr_err ("UV: NMI kdump: KEXEC not supported in this kernel\n" );
527
+ atomic_set (& uv_nmi_kexec_failed , 1 );
527
528
}
528
529
#endif /* !CONFIG_KEXEC_CORE */
529
530
@@ -613,9 +614,14 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
613
614
master = (atomic_read (& uv_nmi_cpu ) == cpu );
614
615
615
616
/* If NMI action is "kdump", then attempt to do it */
616
- if (uv_nmi_action_is ("kdump" ))
617
+ if (uv_nmi_action_is ("kdump" )) {
617
618
uv_nmi_kdump (cpu , master , regs );
618
619
620
+ /* Unexpected return, revert action to "dump" */
621
+ if (master )
622
+ strncpy (uv_nmi_action , "dump" , strlen (uv_nmi_action ));
623
+ }
624
+
619
625
/* Pause as all cpus enter the NMI handler */
620
626
uv_nmi_wait (master );
621
627
@@ -640,6 +646,7 @@ int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
640
646
atomic_set (& uv_nmi_cpus_in_nmi , -1 );
641
647
atomic_set (& uv_nmi_cpu , -1 );
642
648
atomic_set (& uv_in_nmi , 0 );
649
+ atomic_set (& uv_nmi_kexec_failed , 0 );
643
650
}
644
651
645
652
uv_nmi_touch_watchdogs ();
0 commit comments