Date: Tue, 10 Feb 2015 00:55:42 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278481 - in head/sys/powerpc: aim include Message-ID: <201502100055.t1A0tgiK048210@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Tue Feb 10 00:55:42 2015 New Revision: 278481 URL: https://svnweb.freebsd.org/changeset/base/278481 Log: 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. Modified: head/sys/powerpc/aim/machdep.c head/sys/powerpc/include/cpu.h Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Tue Feb 10 00:48:51 2015 (r278480) +++ head/sys/powerpc/aim/machdep.c Tue Feb 10 00:55:42 2015 (r278481) @@ -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 */ Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Tue Feb 10 00:48:51 2015 (r278480) +++ head/sys/powerpc/include/cpu.h Tue Feb 10 00:55:42 2015 (r278481) @@ -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[];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502100055.t1A0tgiK048210>