@@ -281,14 +281,10 @@ 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
291286int cpe_vector = -1 ;
287+ int ia64_cpe_irq = -1 ;
292288
293289static irqreturn_t
294290ia64_mca_cpe_int_handler (int cpe_irq , void * arg , struct pt_regs * ptregs )
@@ -377,8 +373,6 @@ ia64_mca_register_cpev (int cpev)
377373}
378374#endif /* CONFIG_ACPI */
379375
380- #endif /* PLATFORM_MCA_HANDLERS */
381-
382376/*
383377 * ia64_mca_cmc_vector_setup
384378 *
@@ -630,6 +624,32 @@ copy_reg(const u64 *fr, u64 fnat, u64 *tr, u64 *tnat)
630624 * tnat |= (nat << tslot );
631625}
632626
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+
633653/* On entry to this routine, we are running on the per cpu stack, see
634654 * mca_asm.h. The original stack has not been touched by this event. Some of
635655 * the original stack's registers will be in the RBS on this stack. This stack
@@ -648,7 +668,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
648668 struct ia64_sal_os_state * sos ,
649669 const char * type )
650670{
651- char * p , comm [ sizeof ( current -> comm )] ;
671+ char * p ;
652672 ia64_va va ;
653673 extern char ia64_leave_kernel []; /* Need asm address, not function descriptor */
654674 const pal_min_state_area_t * ms = sos -> pal_min_state ;
@@ -721,6 +741,10 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
721741 /* Verify the previous stack state before we change it */
722742 if (user_mode (regs )) {
723743 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 );
724748 goto no_mod ;
725749 }
726750 if (r13 != sos -> prev_IA64_KR_CURRENT ) {
@@ -750,25 +774,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
750774 goto no_mod ;
751775 }
752776
753- /* Change the comm field on the MCA/INT task to include the pid that
754- * was interrupted, it makes for easier debugging. If that pid was 0
755- * (swapper or nested MCA/INIT) then use the start of the previous comm
756- * field suffixed with its cpu.
757- */
758- if (previous_current -> pid )
759- snprintf (comm , sizeof (comm ), "%s %d" ,
760- current -> comm , previous_current -> pid );
761- else {
762- int l ;
763- if ((p = strchr (previous_current -> comm , ' ' )))
764- l = p - previous_current -> comm ;
765- else
766- l = strlen (previous_current -> comm );
767- snprintf (comm , sizeof (comm ), "%s %*s %d" ,
768- current -> comm , l , previous_current -> comm ,
769- task_thread_info (previous_current )-> cpu );
770- }
771- memcpy (current -> comm , comm , sizeof (current -> comm ));
777+ ia64_mca_modify_comm (previous_current );
772778
773779 /* Make the original task look blocked. First stack a struct pt_regs,
774780 * describing the state at the time of interrupt. mca_asm.S built a
@@ -908,7 +914,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
908914static void
909915ia64_wait_for_slaves (int monarch )
910916{
911- int c , wait = 0 ;
917+ int c , wait = 0 , missing = 0 ;
912918 for_each_online_cpu (c ) {
913919 if (c == monarch )
914920 continue ;
@@ -919,15 +925,32 @@ ia64_wait_for_slaves(int monarch)
919925 }
920926 }
921927 if (!wait )
922- return ;
928+ goto all_in ;
923929 for_each_online_cpu (c ) {
924930 if (c == monarch )
925931 continue ;
926932 if (ia64_mc_info .imi_rendez_checkin [c ] == IA64_MCA_RENDEZ_CHECKIN_NOTDONE ) {
927933 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 ;
928936 break ;
929937 }
930938 }
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 ;
931954}
932955
933956/*
@@ -953,6 +976,10 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
953976 task_t * previous_current ;
954977
955978 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+
956983 previous_current = ia64_mca_modify_original_stack (regs , sw , sos , "MCA" );
957984 monarch_cpu = cpu ;
958985 if (notify_die (DIE_MCA_MONARCH_ENTER , "MCA" , regs , 0 , 0 , 0 )
@@ -1444,11 +1471,13 @@ void __devinit
14441471ia64_mca_cpu_init (void * cpu_data )
14451472{
14461473 void * pal_vaddr ;
1474+ static int first_time = 1 ;
14471475
1448- if (smp_processor_id () == 0 ) {
1476+ if (first_time ) {
14491477 void * mca_data ;
14501478 int cpu ;
14511479
1480+ first_time = 0 ;
14521481 mca_data = alloc_bootmem (sizeof (struct ia64_mca_cpu )
14531482 * NR_CPUS + KERNEL_STACK_SIZE );
14541483 mca_data = (void * )(((unsigned long )mca_data +
@@ -1704,6 +1733,7 @@ ia64_mca_late_init(void)
17041733 desc = irq_descp (irq );
17051734 desc -> status |= IRQ_PER_CPU ;
17061735 setup_irq (irq , & mca_cpe_irqaction );
1736+ ia64_cpe_irq = irq ;
17071737 }
17081738 ia64_mca_register_cpev (cpe_vector );
17091739 IA64_MCA_DEBUG ("%s: CPEI/P setup and enabled.\n" , __FUNCTION__ );
0 commit comments