summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-04-15 05:02:42 +0000
committermarcel <marcel@FreeBSD.org>2008-04-15 05:02:42 +0000
commitda8b8894d683ec3f26ce38b603369f619be61bab (patch)
tree1bafe616b3bca7ae415958235e380da504e790ae /sys/ia64
parentf6323acd497cd1d4ce7101c195f5995cb83bc5b1 (diff)
downloadFreeBSD-src-da8b8894d683ec3f26ce38b603369f619be61bab.zip
FreeBSD-src-da8b8894d683ec3f26ce38b603369f619be61bab.tar.gz
Support and switch to the ULE scheduler:
o Implement IPI_PREEMPT, o Set td_lock for the thread being switched out, o For ULE & SMP, loop while td_lock points to blocked_lock for the thread being switched in, o Enable ULE by default in GENERIC and SKI,
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/conf/GENERIC2
-rw-r--r--sys/ia64/conf/SKI4
-rw-r--r--sys/ia64/ia64/interrupt.c4
-rw-r--r--sys/ia64/ia64/machdep.c11
4 files changed, 18 insertions, 3 deletions
diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC
index 8c4a0af..6a4baee 100644
--- a/sys/ia64/conf/GENERIC
+++ b/sys/ia64/conf/GENERIC
@@ -48,7 +48,7 @@ options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as root device
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework
-options SCHED_4BSD # 4BSD scheduler
+options SCHED_ULE # ULE scheduler
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options SCTP # Stream Control Transmission Protocol
options SMP # Symmetric Multi-Processor support
diff --git a/sys/ia64/conf/SKI b/sys/ia64/conf/SKI
index 6e2a4ba..377ee93 100644
--- a/sys/ia64/conf/SKI
+++ b/sys/ia64/conf/SKI
@@ -35,8 +35,8 @@ options KTRACE # ktrace(1) syscall trace support
options MD_ROOT # MD usable as root device
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework
-options SCHED_4BSD # 4BSD scheduler
-#options SCHED_ULE # ULE scheduler
+#options SCHED_4BSD # 4BSD scheduler
+options SCHED_ULE # ULE scheduler
options SKI # Include SKI support code
options SOFTUPDATES # Enable FFS soft updates support
options SYSVMSG # SYSV-style message queues
diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c
index c3dd83d..15783c9 100644
--- a/sys/ia64/ia64/interrupt.c
+++ b/sys/ia64/ia64/interrupt.c
@@ -47,6 +47,7 @@
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
@@ -241,6 +242,9 @@ interrupt(struct trapframe *tf)
} else if (vector == ipi_vector[IPI_TEST]) {
CTR1(KTR_SMP, "IPI_TEST, cpuid=%d", PCPU_GET(cpuid));
mp_ipi_test++;
+ } else if (vector == ipi_vector[IPI_PREEMPT]) {
+ CTR1(KTR_SMP, "IPI_PREEMPT, cpuid=%d", PCPU_GET(cpuid));
+ sched_preempt(curthread);
#endif
} else {
ints[PCPU_GET(cpuid)]++;
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 149c704..7ce78b8 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
#include "opt_kstack_pages.h"
#include "opt_msgbuf.h"
+#include "opt_sched.h"
#include <sys/param.h>
#include <sys/proc.h>
@@ -370,6 +371,12 @@ cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx)
if (PCPU_GET(fpcurthread) == old)
old->td_frame->tf_special.psr |= IA64_PSR_DFH;
if (!savectx(oldpcb)) {
+ old->td_lock = mtx;
+#if defined(SCHED_ULE) && defined(SMP)
+ /* td_lock is volatile */
+ while (new->td_lock == &blocked_lock)
+ ;
+#endif
newpcb = new->td_pcb;
oldpcb->pcb_current_pmap =
pmap_switch(newpcb->pcb_current_pmap);
@@ -890,12 +897,16 @@ DELAY(int n)
{
u_int64_t start, end, now;
+ sched_pin();
+
start = ia64_get_itc();
end = start + (itc_frequency * n) / 1000000;
/* printf("DELAY from 0x%lx to 0x%lx\n", start, end); */
do {
now = ia64_get_itc();
} while (now < end || (now > start && end < start));
+
+ sched_unpin();
}
/*
OpenPOWER on IntegriCloud