Skip to content

Commit dc5cdd8

Browse files
committed
Pull mca-cleanup into release branch
2 parents ae02e96 + 2730c92 commit dc5cdd8

1 file changed

Lines changed: 55 additions & 29 deletions

File tree

‎arch/ia64/kernel/mca.c‎

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ ia64_mca_log_sal_error_record(int sal_info_type)
281281
ia64_sal_clear_state_info(sal_info_type);
282282
}
283283

284-
/*
285-
* platform dependent error handling
286-
*/
287-
#ifndef PLATFORM_MCA_HANDLERS
288-
289284
#ifdef CONFIG_ACPI
290285

291286
int cpe_vector = -1;
@@ -378,8 +373,6 @@ ia64_mca_register_cpev (int cpev)
378373
}
379374
#endif /* CONFIG_ACPI */
380375

381-
#endif /* PLATFORM_MCA_HANDLERS */
382-
383376
/*
384377
* ia64_mca_cmc_vector_setup
385378
*
@@ -631,6 +624,32 @@ copy_reg(const u64 *fr, u64 fnat, u64 *tr, u64 *tnat)
631624
*tnat |= (nat << tslot);
632625
}
633626

627+
/* Change the comm field on the MCA/INT task to include the pid that
628+
* was interrupted, it makes for easier debugging. If that pid was 0
629+
* (swapper or nested MCA/INIT) then use the start of the previous comm
630+
* field suffixed with its cpu.
631+
*/
632+
633+
static void
634+
ia64_mca_modify_comm(const task_t *previous_current)
635+
{
636+
char *p, comm[sizeof(current->comm)];
637+
if (previous_current->pid)
638+
snprintf(comm, sizeof(comm), "%s %d",
639+
current->comm, previous_current->pid);
640+
else {
641+
int l;
642+
if ((p = strchr(previous_current->comm, ' ')))
643+
l = p - previous_current->comm;
644+
else
645+
l = strlen(previous_current->comm);
646+
snprintf(comm, sizeof(comm), "%s %*s %d",
647+
current->comm, l, previous_current->comm,
648+
task_thread_info(previous_current)->cpu);
649+
}
650+
memcpy(current->comm, comm, sizeof(current->comm));
651+
}
652+
634653
/* On entry to this routine, we are running on the per cpu stack, see
635654
* mca_asm.h. The original stack has not been touched by this event. Some of
636655
* the original stack's registers will be in the RBS on this stack. This stack
@@ -649,7 +668,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
649668
struct ia64_sal_os_state *sos,
650669
const char *type)
651670
{
652-
char *p, comm[sizeof(current->comm)];
671+
char *p;
653672
ia64_va va;
654673
extern char ia64_leave_kernel[]; /* Need asm address, not function descriptor */
655674
const pal_min_state_area_t *ms = sos->pal_min_state;
@@ -722,6 +741,10 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
722741
/* Verify the previous stack state before we change it */
723742
if (user_mode(regs)) {
724743
msg = "occurred in user space";
744+
/* previous_current is guaranteed to be valid when the task was
745+
* in user space, so ...
746+
*/
747+
ia64_mca_modify_comm(previous_current);
725748
goto no_mod;
726749
}
727750
if (r13 != sos->prev_IA64_KR_CURRENT) {
@@ -751,25 +774,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
751774
goto no_mod;
752775
}
753776

754-
/* Change the comm field on the MCA/INT task to include the pid that
755-
* was interrupted, it makes for easier debugging. If that pid was 0
756-
* (swapper or nested MCA/INIT) then use the start of the previous comm
757-
* field suffixed with its cpu.
758-
*/
759-
if (previous_current->pid)
760-
snprintf(comm, sizeof(comm), "%s %d",
761-
current->comm, previous_current->pid);
762-
else {
763-
int l;
764-
if ((p = strchr(previous_current->comm, ' ')))
765-
l = p - previous_current->comm;
766-
else
767-
l = strlen(previous_current->comm);
768-
snprintf(comm, sizeof(comm), "%s %*s %d",
769-
current->comm, l, previous_current->comm,
770-
task_thread_info(previous_current)->cpu);
771-
}
772-
memcpy(current->comm, comm, sizeof(current->comm));
777+
ia64_mca_modify_comm(previous_current);
773778

774779
/* Make the original task look blocked. First stack a struct pt_regs,
775780
* describing the state at the time of interrupt. mca_asm.S built a
@@ -909,7 +914,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
909914
static void
910915
ia64_wait_for_slaves(int monarch)
911916
{
912-
int c, wait = 0;
917+
int c, wait = 0, missing = 0;
913918
for_each_online_cpu(c) {
914919
if (c == monarch)
915920
continue;
@@ -920,15 +925,32 @@ ia64_wait_for_slaves(int monarch)
920925
}
921926
}
922927
if (!wait)
923-
return;
928+
goto all_in;
924929
for_each_online_cpu(c) {
925930
if (c == monarch)
926931
continue;
927932
if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE) {
928933
udelay(5*1000000); /* wait 5 seconds for slaves (arbitrary) */
934+
if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE)
935+
missing = 1;
929936
break;
930937
}
931938
}
939+
if (!missing)
940+
goto all_in;
941+
printk(KERN_INFO "OS MCA slave did not rendezvous on cpu");
942+
for_each_online_cpu(c) {
943+
if (c == monarch)
944+
continue;
945+
if (ia64_mc_info.imi_rendez_checkin[c] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE)
946+
printk(" %d", c);
947+
}
948+
printk("\n");
949+
return;
950+
951+
all_in:
952+
printk(KERN_INFO "All OS MCA slaves have reached rendezvous\n");
953+
return;
932954
}
933955

934956
/*
@@ -954,6 +976,10 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
954976
task_t *previous_current;
955977

956978
oops_in_progress = 1; /* FIXME: make printk NMI/MCA/INIT safe */
979+
console_loglevel = 15; /* make sure printks make it to console */
980+
printk(KERN_INFO "Entered OS MCA handler. PSP=%lx cpu=%d monarch=%ld\n",
981+
sos->proc_state_param, cpu, sos->monarch);
982+
957983
previous_current = ia64_mca_modify_original_stack(regs, sw, sos, "MCA");
958984
monarch_cpu = cpu;
959985
if (notify_die(DIE_MCA_MONARCH_ENTER, "MCA", regs, 0, 0, 0)

0 commit comments

Comments
 (0)