Add support for IPI_PREEMPT in order to enable use of the ULE scheduler

This commit is contained in:
Kip Macy 2007-02-02 05:00:21 +00:00
parent d5ab3ef787
commit 6d449d27d9
4 changed files with 21 additions and 1 deletions

View File

@ -46,6 +46,7 @@
#define PIL_RENDEZVOUS 3 /* smp rendezvous ipi */
#define PIL_AST 4 /* ast ipi */
#define PIL_STOP 5 /* stop cpu ipi */
#define PIL_PREEMPT 6 /* preempt idle thread cpu ipi */
#define PIL_FAST 13 /* fast interrupts */
#define PIL_TICK 14

View File

@ -44,6 +44,8 @@
#define IPI_AST PIL_AST
#define IPI_RENDEZVOUS PIL_RENDEZVOUS
#define IPI_STOP PIL_STOP
#define IPI_PREEMPT PIL_PREEMPT
#define IPI_RETRIES 5000
@ -79,6 +81,7 @@ void cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
void cpu_ipi_ast(struct trapframe *tf);
void cpu_ipi_stop(struct trapframe *tf);
void cpu_ipi_preempt(struct trapframe *tf);
void ipi_selected(u_int cpus, u_int ipi);
void ipi_all(u_int ipi);

View File

@ -114,7 +114,8 @@ static char *pil_names[] = {
"rndzvs", /* PIL_RENDEZVOUS */
"ast", /* PIL_AST */
"stop", /* PIL_STOP */
"stray", "stray", "stray", "stray", "stray", "stray", "stray",
"preempt", /* PIL_PREEMPT */
"stray", "stray", "stray", "stray", "stray", "stray",
"fast", /* PIL_FAST */
"tick", /* PIL_TICK */
};
@ -266,6 +267,7 @@ intr_init(void)
intr_handlers[PIL_AST] = cpu_ipi_ast;
intr_handlers[PIL_RENDEZVOUS] = (ih_func_t *)smp_rendezvous_action;
intr_handlers[PIL_STOP]= cpu_ipi_stop;
intr_handlers[PIL_PREEMPT]= cpu_ipi_preempt;
#endif
mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN);
cpu_intrq_alloc();

View File

@ -455,6 +455,20 @@ cpu_ipi_stop(struct trapframe *tf)
CTR1(KTR_SMP, "cpu_ipi_stop: restarted %d", curcpu);
}
void
cpu_ipi_preempt(struct trapframe *tf)
{
struct thread *running_thread = curthread;
mtx_lock_spin(&sched_lock);
if (running_thread->td_critnest > 1)
running_thread->td_owepreempt = 1;
else
mi_switch(SW_INVOL | SW_PREEMPT, NULL);
mtx_unlock_spin(&sched_lock);
}
void
cpu_ipi_selected(int cpu_count, uint16_t *cpulist, u_long d0, u_long d1, u_long d2, uint64_t *ackmask)
{