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

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

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/nucleus/sched.h |    2 +-
 ksrc/nucleus/pod.c      |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
index b9d0f01..8db23cc 100644
--- a/include/nucleus/sched.h
+++ b/include/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 */
 
 /* Sched RPI status flags */
 #define XNRPICK                0x80000000      /* Check RPI state */
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index cf6c9de..a5afaa5 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -1200,7 +1200,7 @@ void xnpod_delete_thread(xnthread_t *thread)
                 * thread zombie state to go through the rescheduling
                 * procedure then actually destroy the thread object.
                 */
-               __clrbits(sched->status, XNINLOCK);
+               __clrbits(sched->lflags, XNINLOCK);
                xnsched_set_resched(sched);
                xnpod_schedule();
 #ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH
@@ -1453,7 +1453,7 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t 
mask,
 #endif /* __XENO_SIM__ */
 
        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
@@ -2312,7 +2312,7 @@ reschedule:
                goto reschedule;
 
        if (xnthread_lock_count(curr))
-               __setbits(sched->status, XNINLOCK);
+               __setbits(sched->lflags, XNINLOCK);
 
        xnlock_put_irqrestore(&nklock, s);
 
@@ -2345,7 +2345,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);
        }
 }
@@ -2360,7 +2360,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