Module: xenomai-forge
Branch: master
Commit: c833a8b0e8254cfcb95d1e16139efb89e3121da3
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c833a8b0e8254cfcb95d1e16139efb89e3121da3

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Jan 18 20:08:51 2013 +0100

cobalt/nucleus: Move XNINLOCK to xnsched::lflags

Via RTDM spin locks, XNINLOCK is set/cleared outside of the nklock
protection. Thus it has to be carried by lflags, not status which could
concurrently be manipulated by a different CPU.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/cobalt/nucleus/sched.h |    2 +-
 kernel/cobalt/nucleus/pod.c    |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/cobalt/nucleus/sched.h b/include/cobalt/nucleus/sched.h
index 185537f..bfbabe0 100644
--- a/include/cobalt/nucleus/sched.h
+++ b/include/cobalt/nucleus/sched.h
@@ -42,12 +42,12 @@
 #define XNINTCK                0x40000000      /* In master tick handler 
context */
 #define XNINSW         0x20000000      /* In context switch */
 #define XNRESCHED      0x10000000      /* Needs rescheduling */
-#define XNINLOCK       0x08000000      /* Scheduler locked */
 
 /* Sched local flags */
 #define XNHTICK                0x00008000      /* Host tick pending  */
 #define XNINIRQ                0x00004000      /* In IRQ handling context */
 #define XNHDEFER       0x00002000      /* Host tick deferred */
+#define XNINLOCK       0x00001000      /* Scheduler locked */
 
 struct xnsched_rt {
        xnsched_queue_t runnable;       /*!< Runnable thread queue. */
diff --git a/kernel/cobalt/nucleus/pod.c b/kernel/cobalt/nucleus/pod.c
index fbd6aa8..1605dea 100644
--- a/kernel/cobalt/nucleus/pod.c
+++ b/kernel/cobalt/nucleus/pod.c
@@ -1326,7 +1326,7 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t 
mask,
                thread->wchan = wchan;
 
        if (thread == sched->curr) {
-               __clrbits(sched->status, XNINLOCK);
+               __clrbits(sched->lflags, XNINLOCK);
                /*
                 * If the current thread is being relaxed, we must
                 * have been called from xnshadow_relax(), in which
@@ -2161,7 +2161,7 @@ reschedule:
                goto reschedule;
 
        if (xnthread_lock_count(curr))
-               __setbits(sched->status, XNINLOCK);
+               __setbits(sched->lflags, XNINLOCK);
 
        xnlock_put_irqrestore(&nklock, s);
 
@@ -2196,7 +2196,7 @@ void ___xnpod_lock_sched(xnsched_t *sched)
        struct xnthread *curr = sched->curr;
 
        if (xnthread_lock_count(curr)++ == 0) {
-               __setbits(sched->status, XNINLOCK);
+               __setbits(sched->lflags, XNINLOCK);
                xnthread_set_state(curr, XNLOCK);
        }
 }
@@ -2211,7 +2211,7 @@ void ___xnpod_unlock_sched(xnsched_t *sched)
 
        if (--xnthread_lock_count(curr) == 0) {
                xnthread_clear_state(curr, XNLOCK);
-               __clrbits(sched->status, XNINLOCK);
+               __clrbits(sched->lflags, XNINLOCK);
                xnpod_schedule();
        }
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to