SMP - CPU local run queues

- each CPU has its own runqueues

- processes on BSP are put on the runqueues later after a switch to
  the final stack when cpuid works to avoid special cases

- enqueue() and dequeue() use the run queues of the cpu the process is
  assigned to

- pick_proc() uses the local run queues

- printing of per-CPU run queues ('2') on serial console
This commit is contained in:
Tomas Hruby
2010-09-15 14:10:18 +00:00
parent ad73a4f50c
commit fac5fbfdbf
10 changed files with 134 additions and 60 deletions

View File

@@ -215,8 +215,12 @@ PRIVATE void ap_finish_booting(void)
}
printf("CPU %d local APIC timer is ticking\n", cpu);
/* FIXME assign CPU local idle structure */
get_cpulocal_var(proc_ptr) = proc_addr(IDLE);
get_cpulocal_var(bill_ptr) = proc_addr(IDLE);
BKL_UNLOCK();
ap_boot_finished(cpu);
spinlock_unlock(&boot_lock);
for(;;);

View File

@@ -370,19 +370,38 @@ PUBLIC void do_ser_debug()
ser_debug(c);
}
PRIVATE void ser_dump_queues(void)
PRIVATE void ser_dump_queue_cpu(unsigned cpu)
{
int q;
struct proc ** rdy_head;
rdy_head = get_cpu_var(cpu, run_q_head);
for(q = 0; q < NR_SCHED_QUEUES; q++) {
struct proc *p;
if(rdy_head[q])
if(rdy_head[q]) {
printf("%2d: ", q);
for(p = rdy_head[q]; p; p = p->p_nextready) {
printf("%s / %d ", p->p_name, p->p_endpoint);
for(p = rdy_head[q]; p; p = p->p_nextready) {
printf("%s / %d ", p->p_name, p->p_endpoint);
}
printf("\n");
}
printf("\n");
}
}
PRIVATE void ser_dump_queues(void)
{
#ifdef CONFIG_SMP
unsigned cpu;
printf("--- run queues ---\n");
for (cpu = 0; cpu < ncpus; cpu++) {
printf("CPU %d :\n", cpu);
ser_dump_queue_cpu(cpu);
}
#else
ser_dump_queue_cpu(0);
#endif
}
PRIVATE void ser_dump_segs(void)

View File

@@ -2,7 +2,7 @@
#define __GLO_X86_H__
#include "kernel/kernel.h"
#include "proto.h"
#include "arch_proto.h"
EXTERN int cpu_has_tsc; /* signal whether this cpu has time stamp register. This
feature was introduced by Pentium */