]> Zhao Yanbai Git Server - minix.git/commitdiff
SMP - Print cpu of the process
authorTomas Hruby <tom@minix3.org>
Wed, 15 Sep 2010 14:11:01 +0000 (14:11 +0000)
committerTomas Hruby <tom@minix3.org>
Wed, 15 Sep 2010 14:11:01 +0000 (14:11 +0000)
- adds '4' to print processes assigned to each cpu without printing
  the process it is blocked on (a lightweight '1')

kernel/arch/i386/arch_system.c
kernel/debug.c
kernel/proc.c

index 5cc381adc4af7b1bf2ecdd826701f5f4b5423af9..971a189c8fbf1a118762f107c68c399f27489f7b 100644 (file)
@@ -48,6 +48,9 @@ extern void poweroff16_end();
 PUBLIC void * k_stacks;
 
 FORWARD _PROTOTYPE( void ser_debug, (int c));
+#ifdef CONFIG_SMP
+FORWARD _PROTOTYPE( void ser_dump_proc_cpu, (void));
+#endif
 
 PUBLIC __dead void arch_monitor(void)
 {
@@ -471,6 +474,11 @@ PRIVATE void ser_debug(const int c)
        case '3':
                ser_dump_segs();
                break;
+#ifdef CONFIG_SMP
+       case '4':
+               ser_dump_proc_cpu();
+               break;
+#endif
 #if DEBUG_TRACE
 #define TOGGLECASE(ch, flag)                           \
        case ch: {                                      \
@@ -495,7 +503,6 @@ PRIVATE void ser_debug(const int c)
        serial_debug_active = 0;
 }
 
-
 PUBLIC void ser_dump_proc()
 {
        struct proc *pp;
@@ -508,6 +515,23 @@ PUBLIC void ser_dump_proc()
        }
 }
 
+#ifdef CONFIG_SMP
+PRIVATE void ser_dump_proc_cpu(void)
+{
+       struct proc *pp;
+       unsigned cpu;
+
+       for (cpu = 0; cpu < ncpus; cpu++) {
+               printf("CPU %d processes : \n", cpu);
+               for (pp= BEG_USER_ADDR; pp < END_PROC_ADDR; pp++) {
+                       if (isemptyp(pp) || pp->p_cpu != cpu)
+                               continue;
+                       print_proc(pp);
+               }
+       }
+}
+#endif
+
 #if SPROFILE
 
 PUBLIC int arch_init_profile_clock(const u32_t freq)
index e476c543953568055cee748cab8b4154ddc234a6..9261d720ab5b728060f7ca30774bf6ca546b7f15 100644 (file)
@@ -258,10 +258,12 @@ PUBLIC void print_proc(struct proc *pp)
        struct proc *depproc = NULL;
        endpoint_t dep;
 
-       printf("%d: %s %d prio %d time %d/%d cycles 0x%x%08x cr3 0x%lx rts %s misc %s sched %s ",
-               proc_nr(pp), pp->p_name, pp->p_endpoint,
+       printf("%d: %s %d prio %d time %d/%d cycles 0x%x%08x cpu %2d "
+                       "cr3 0x%lx rts %s misc %s sched %s ",
+               proc_nr(pp), pp->p_name, pp->p_endpoint, 
                pp->p_priority, pp->p_user_time,
-               pp->p_sys_time, pp->p_cycles.hi, pp->p_cycles.lo, pp->p_seg.p_cr3,
+               pp->p_sys_time, pp->p_cycles.hi, pp->p_cycles.lo, pp->p_cpu,
+               pp->p_seg.p_cr3,
                rtsflagstr(pp->p_rts_flags), miscflagstr(pp->p_misc_flags),
                schedulerstr(pp->p_scheduler));
 
index 92415002daa828fb491eee1bc4f29fb08cef870d..be4ac1f67dbf3b9496b3b02bdf6fd42c8ea0e2f9 100644 (file)
@@ -329,8 +329,9 @@ check_misc_flags:
        if (!proc_is_runnable(p))
                goto not_runnable_pick_new;
 
-       TRACE(VF_SCHEDULING, printf("starting %s / %d\n",
-               p->p_name, p->p_endpoint););
+       TRACE(VF_SCHEDULING, printf("cpu %d starting %s / %d "
+                               "pc 0x%08x\n",
+               cpuid, p->p_name, p->p_endpoint, p->p_reg.pc););
 #if DEBUG_TRACE
        p->p_schedules++;
 #endif
@@ -1448,7 +1449,7 @@ PRIVATE struct proc * pick_proc(void)
   rdy_head = get_cpulocal_var(run_q_head);
   for (q=0; q < NR_SCHED_QUEUES; q++) {        
        if(!(rp = rdy_head[q])) {
-               TRACE(VF_PICKPROC, printf("queue %d empty\n", q););
+               TRACE(VF_PICKPROC, printf("cpu %d queue %d empty\n", cpuid, q););
                continue;
        }
        assert(proc_is_runnable(rp));