diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-10 00:55:42 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2015-02-10 00:55:42 +0000 |
commit | 1e4a004e9c5e8ea54a16473be220e6f044656a91 (patch) | |
tree | 6e2dc9672717d16ef3f5f7dec0b257992320a802 | |
parent | 6e510e4312342b25c6283096dbbc31b5a13c37a1 (diff) | |
download | FreeBSD-src-1e4a004e9c5e8ea54a16473be220e6f044656a91.zip FreeBSD-src-1e4a004e9c5e8ea54a16473be220e6f044656a91.tar.gz |
Set thread priorities on multithreaded CPUs so that threads holding a
spinlock are high-priority and threads waiting for a spinlock are set to
low priority.
-rw-r--r-- | sys/powerpc/aim/machdep.c | 5 | ||||
-rw-r--r-- | sys/powerpc/include/cpu.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 2980b09..92a06d2 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -750,6 +750,7 @@ spinlock_enter(void) td = curthread; if (td->td_md.md_spinlock_count == 0) { + __asm __volatile("or 2,2,2"); /* Set high thread priority */ msr = intr_disable(); td->td_md.md_spinlock_count = 1; td->td_md.md_saved_msr = msr; @@ -768,8 +769,10 @@ spinlock_exit(void) critical_exit(); msr = td->td_md.md_saved_msr; td->td_md.md_spinlock_count--; - if (td->td_md.md_spinlock_count == 0) + if (td->td_md.md_spinlock_count == 0) { intr_restore(msr); + __asm __volatile("or 6,6,6"); /* Set normal thread priority */ + } } int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */ diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h index 6ef9882..65358a6 100644 --- a/sys/powerpc/include/cpu.h +++ b/sys/powerpc/include/cpu.h @@ -88,7 +88,7 @@ get_cyclecount(void) } #define cpu_getstack(td) ((td)->td_frame->fixreg[1]) -#define cpu_spinwait() /* nothing */ +#define cpu_spinwait() __asm __volatile("or 27,27,27") /* yield */ extern char btext[]; extern char etext[]; |