Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/include Add basic support for __HAVE_PREEMPTION.



details:   https://anonhg.NetBSD.org/src/rev/2daabcf5b104
branches:  trunk
changeset: 337270:2daabcf5b104
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Apr 08 18:10:44 2015 +0000

description:
Add basic support for __HAVE_PREEMPTION.
Use atomic ops for ci_astpending if __HAVE_PREEMPTION is defined.

diffstat:

 sys/arch/arm/include/cpu.h |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 05b594066f86 -r 2daabcf5b104 sys/arch/arm/include/cpu.h
--- a/sys/arch/arm/include/cpu.h        Wed Apr 08 18:10:08 2015 +0000
+++ b/sys/arch/arm/include/cpu.h        Wed Apr 08 18:10:44 2015 +0000
@@ -137,6 +137,7 @@
 #ifdef _KMEMUSER
 #include <sys/intr.h>
 #endif
+#include <sys/atomic.h>
 #include <sys/cpu_data.h>
 #include <sys/device_if.h>
 #include <sys/evcnt.h>
@@ -150,7 +151,7 @@
        uint32_t ci_arm_cpurev;         /* CPU revision */
        uint32_t ci_ctrl;               /* The CPU control register */
        int ci_cpl;                     /* current processor level (spl) */
-       int ci_astpending;              /* */
+       volatile int ci_astpending;     /* */
        int ci_want_resched;            /* resched() was called */
        int ci_intr_depth;              /* */
        struct cpu_softc *ci_softc;     /* platform softc */
@@ -276,7 +277,12 @@
  * Scheduling glue
  */
 
-#define setsoftast()                   (curcpu()->ci_astpending = 1)
+#ifdef __HAVE_PREEMPTION
+#define setsoftast()           atomic_or_uint(&curcpu()->ci_astpending, \
+                                   __BIT(0))
+#else
+#define setsoftast()           (curcpu()->ci_astpending = __BIT(0))
+#endif
 
 /*
  * Notify the current process (p) that it has a signal pending,
@@ -292,6 +298,9 @@
  */
 #define        cpu_need_proftick(l)    ((l)->l_pflag |= LP_OWEUPC, setsoftast())
 
+/* for preeemption. */
+void   cpu_set_curpri(int);
+
 /*
  * We've already preallocated the stack for the idlelwps for additional CPUs.  
  * This hook allows to return them.



Home | Main Index | Thread Index | Old Index