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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Mar 22 18:37:48 2012 +0100

cobalt/nucleus: fix interrupt state of xnshadow_kick/demote() callers

---

 include/cobalt/nucleus/shadow.h |    4 ++++
 kernel/cobalt/nucleus/shadow.c  |   24 +++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/include/cobalt/nucleus/shadow.h b/include/cobalt/nucleus/shadow.h
index db44228..694f32d 100644
--- a/include/cobalt/nucleus/shadow.h
+++ b/include/cobalt/nucleus/shadow.h
@@ -111,8 +111,12 @@ void xnshadow_send_sig(struct xnthread *thread,
 
 void xnshadow_call_mayday(struct xnthread *thread, int sigtype);
 
+void __xnshadow_kick(struct xnthread *thread);
+
 void xnshadow_kick(struct xnthread *thread);
 
+void __xnshadow_demote(struct xnthread *thread);
+
 void xnshadow_demote(struct xnthread *thread);
 
 #endif /* !_XENO_NUCLEUS_SHADOW_H */
diff --git a/kernel/cobalt/nucleus/shadow.c b/kernel/cobalt/nucleus/shadow.c
index 0da8bc8..8ad8e17 100644
--- a/kernel/cobalt/nucleus/shadow.c
+++ b/kernel/cobalt/nucleus/shadow.c
@@ -745,7 +745,7 @@ int xnshadow_force_wakeup(struct xnthread *thread) /* 
nklock locked, irqs off */
        return ret;
 }
 
-void xnshadow_kick(struct xnthread *thread) /* nklock locked, irqs off */
+void __xnshadow_kick(struct xnthread *thread) /* nklock locked, irqs off */
 {
        struct task_struct *p = xnthread_archtcb(thread)->user_task;
 
@@ -786,16 +786,25 @@ void xnshadow_kick(struct xnthread *thread) /* nklock 
locked, irqs off */
        if (thread != xnpod_current_thread())
                xnarch_call_mayday(p);
 }
+
+void xnshadow_kick(struct xnthread *thread)
+{
+       spl_t s;
+
+       xnlock_get_irqsave(&nklock, s);
+       __xnshadow_kick(thread);
+       xnlock_put_irqrestore(&nklock, s);
+}
 EXPORT_SYMBOL_GPL(xnshadow_kick);
 
-void xnshadow_demote(struct xnthread *thread) /* nklock locked, irqs off */
+void __xnshadow_demote(struct xnthread *thread) /* nklock locked, irqs off */
 {
        /*
         * First we kick the thread out of primary mode, and have it
         * resume execution immediately over the regular linux
         * context.
         */
-       xnshadow_kick(thread);
+       __xnshadow_kick(thread);
        /*
         * Then we send it a renice action signal to demote it from
         * SCHED_FIFO to SCHED_OTHER. In effect, we turned that thread
@@ -806,6 +815,15 @@ void xnshadow_demote(struct xnthread *thread) /* nklock 
locked, irqs off */
        xnshadow_send_sig(thread, SIGSHADOW,
                          sigshadow_int(SIGSHADOW_ACTION_RENICE, 0));
 }
+
+void xnshadow_demote(struct xnthread *thread)
+{
+       spl_t s;
+
+       xnlock_get_irqsave(&nklock, s);
+       __xnshadow_demote(thread);
+       xnlock_put_irqrestore(&nklock, s);
+}
 EXPORT_SYMBOL_GPL(xnshadow_demote);
 
 void xnshadow_exit(void)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to