@@ -569,7 +569,7 @@ void *kernel_int11_handler;
569569void * kernel_int13_handler ;
570570void * kernel_double_fault_handler ;
571571void * kernel_page_fault_handler ;
572- int ipi_vector = 0 ; // 0xea; // very temp hack - need to find a new interrupt
572+ int ipi_vector = 0xea ; // very temp hack - need to find a new interrupt
573573
574574/**********************************************************************/
575575/* Kernel independent gate definitions. */
@@ -1114,9 +1114,10 @@ dtrace_linux_init(void)
11141114set_bit(ipi_vector, used_vectors);
11151115if (*first_v > ipi_vector)
11161116 *first_v = ipi_vector;
1117- set_idt_entry(ipi_vector, (unsigned long) dtrace_int_ipi);
11181117}
11191118*/
1119+ if (ipi_vector )
1120+ set_idt_entry (ipi_vector , (unsigned long ) dtrace_int_ipi );
11201121 }
11211122
11221123 /***********************************************/
@@ -1167,6 +1168,34 @@ dtrace_linux_fini(void)
11671168 return ret ;
11681169}
11691170/**********************************************************************/
1171+ /* Utility function to dump stacks for all cpus. */
1172+ /**********************************************************************/
1173+ static void dump_cpu_stack (void )
1174+ {
1175+ printk ("This is CPU#%d\n" , smp_processor_id ());
1176+ dump_stack ();
1177+ }
1178+ void
1179+ dump_all_stacks (void )
1180+ {
1181+ static void (* arch_trigger_all_cpu_backtrace )(void );
1182+ /***********************************************/
1183+ /* arch_trigger_all_cpu_backtrace works */
1184+ /* using NMI and will work even if the CPUs */
1185+ /* have interrupts disabled. Our IPI call */
1186+ /* wont work. */
1187+ /***********************************************/
1188+ if (arch_trigger_all_cpu_backtrace == NULL )
1189+ arch_trigger_all_cpu_backtrace = get_proc_addr ("arch_trigger_all_cpu_backtrace" );
1190+ if (arch_trigger_all_cpu_backtrace )
1191+ arch_trigger_all_cpu_backtrace ();
1192+ else {
1193+ set_console_on (0 );
1194+ dump_stack ();
1195+ smp_call_function_single (smp_processor_id () == 0 ? 1 : 0 , dump_cpu_stack , 0 , FALSE);
1196+ }
1197+ }
1198+ /**********************************************************************/
11701199/* Call here to disarm dtrace so we can debug unexpected */
11711200/* scenarios. In production dtrace, nothing calls this, but we may */
11721201/* put temporary enablers in, for example the GPF handler. We dont */
@@ -1181,10 +1210,8 @@ dtrace_linux_panic(void)
11811210
11821211 dtrace_shutdown = TRUE;
11831212 set_console_on (1 );
1184- printk ("dtrace_linux_panic called. Dumping cpu stacks\n" );
1185- set_console_on (0 );
1186- dump_stack ();
1187- smp_call_function_single (smp_processor_id () == 0 ? 1 : 0 , dump_stack , 0 , FALSE);
1213+ printk ("[cpu%d] dtrace_linux_panic called. Dumping cpu stacks\n" , smp_processor_id ());
1214+ dump_all_stacks ();
11881215 printk ("dtrace_linux_panic: finished\n" );
11891216}
11901217/**********************************************************************/
@@ -1417,10 +1444,31 @@ dtrace_sync_func(void)
14171444{
14181445}
14191446
1447+ /**********************************************************************/
1448+ /* Synchronise the cpus. This really means make sure they are not */
1449+ /* in a critical section. The source of so much heartache for me. */
1450+ /* But, allow us to make life really bad by ramping up the repeat */
1451+ /* count. */
1452+ /**********************************************************************/
14201453void
14211454dtrace_sync (void )
1422- {
1423- dtrace_xcall (DTRACE_CPUALL , (dtrace_xcall_t )dtrace_sync_func , NULL );
1455+ { int i ;
1456+ int repeat = 1 ;
1457+
1458+ /*static int levels[NCPU];
1459+ static int lev;
1460+ if (lev++) {
1461+ printk("%d - nested invocation to dtrace_sync\n", smp_processor_id());
1462+ }
1463+ if (levels[smp_processor_id()]++) {
1464+ printk("%d starting -- nested\n", smp_processor_id());
1465+ dump_stack();
1466+ }*/
1467+ for (i = 0 ; i < repeat ; i ++ ) {
1468+ dtrace_xcall (DTRACE_CPUALL , (dtrace_xcall_t )dtrace_sync_func , NULL );
1469+ }
1470+ /*levels[smp_processor_id()]--;
1471+ lev--;*/
14241472}
14251473void
14261474dtrace_vtime_enable (void )
0 commit comments