summaryrefslogtreecommitdiffstats
path: root/sys/sun4v
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2007-02-02 05:00:21 +0000
committerkmacy <kmacy@FreeBSD.org>2007-02-02 05:00:21 +0000
commitbcdd0af22de2dbd82c69a8bd5407fefcd56fea3e (patch)
treeea849460886fa7a7ef21bb29fde785b44eb77e54 /sys/sun4v
parentefb054426a289fed831fa455155054250177ff35 (diff)
downloadFreeBSD-src-bcdd0af22de2dbd82c69a8bd5407fefcd56fea3e.zip
FreeBSD-src-bcdd0af22de2dbd82c69a8bd5407fefcd56fea3e.tar.gz
Add support for IPI_PREEMPT in order to enable use of the ULE scheduler
Diffstat (limited to 'sys/sun4v')
-rw-r--r--sys/sun4v/include/intr_machdep.h1
-rw-r--r--sys/sun4v/include/smp.h3
-rw-r--r--sys/sun4v/sun4v/intr_machdep.c4
-rw-r--r--sys/sun4v/sun4v/mp_machdep.c14
4 files changed, 21 insertions, 1 deletions
diff --git a/sys/sun4v/include/intr_machdep.h b/sys/sun4v/include/intr_machdep.h
index 4c8111c..9788e39 100644
--- a/sys/sun4v/include/intr_machdep.h
+++ b/sys/sun4v/include/intr_machdep.h
@@ -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
diff --git a/sys/sun4v/include/smp.h b/sys/sun4v/include/smp.h
index b562c2b..7335981 100644
--- a/sys/sun4v/include/smp.h
+++ b/sys/sun4v/include/smp.h
@@ -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);
diff --git a/sys/sun4v/sun4v/intr_machdep.c b/sys/sun4v/sun4v/intr_machdep.c
index edb5efe..6f17a69 100644
--- a/sys/sun4v/sun4v/intr_machdep.c
+++ b/sys/sun4v/sun4v/intr_machdep.c
@@ -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();
diff --git a/sys/sun4v/sun4v/mp_machdep.c b/sys/sun4v/sun4v/mp_machdep.c
index d3cea9d..e9c7d43 100644
--- a/sys/sun4v/sun4v/mp_machdep.c
+++ b/sys/sun4v/sun4v/mp_machdep.c
@@ -456,6 +456,20 @@ cpu_ipi_stop(struct trapframe *tf)
}
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)
{
OpenPOWER on IntegriCloud