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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jun 24 15:52:03 2013 +0200

cobalt/kernel: drop support for ASRs

We have no in-tree users anymore for ASRs. Besides, this
infrastructure would be overkill for running internal switch
handlers. Just drop it.

At this chance, we also fix the thread state label string, which was
fairly broken due to previous (mode bit) updates.

---

 include/cobalt/kernel/pod.h    |    2 -
 include/cobalt/kernel/thread.h |   32 ++++---------------
 kernel/cobalt/pod.c            |   65 ++++------------------------------------
 kernel/cobalt/shadow.c         |    3 --
 kernel/cobalt/thread.c         |    5 ---
 5 files changed, 13 insertions(+), 94 deletions(-)

diff --git a/include/cobalt/kernel/pod.h b/include/cobalt/kernel/pod.h
index f554e73..2840d2d 100644
--- a/include/cobalt/kernel/pod.h
+++ b/include/cobalt/kernel/pod.h
@@ -209,8 +209,6 @@ int xnpod_set_thread_schedparam(struct xnthread *thread,
 
 int xnpod_migrate_thread(int cpu);
 
-void xnpod_dispatch_signals(void);
-
 static inline void xnpod_schedule(void)
 {
        struct xnsched *sched;
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 7028263..5ea23e7 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -48,12 +48,11 @@
 #define XNDEBUG   0x00002000 /**< Hit a debugger breakpoint */
 #define XNLOCK    0x00004000 /**< Holds the scheduler lock (i.e. not 
preemptible) */
 #define XNRRB     0x00008000 /**< Undergoes a round-robin scheduling */
-#define XNASDI    0x00010000 /**< ASR are disabled */
-#define XNTRAPSW  0x00020000 /**< Trap execution mode switches */
-#define XNFPU     0x00040000 /**< Thread uses FPU */
-#define XNROOT    0x00080000 /**< Root thread (that is, Linux/IDLE) */
-#define XNWEAK    0x00100000 /**< Non real-time shadow (from the WEAK class) */
-#define XNUSER    0x00200000 /**< Shadow thread running in userland */
+#define XNTRAPSW  0x00010000 /**< Trap execution mode switches */
+#define XNFPU     0x00020000 /**< Thread uses FPU */
+#define XNROOT    0x00040000 /**< Root thread (that is, Linux/IDLE) */
+#define XNWEAK    0x00080000 /**< Non real-time shadow (from the WEAK class) */
+#define XNUSER    0x00100000 /**< Shadow thread running in userland */
 
 /*! @} */ /* Ends doxygen comment group: nucleus_state_flags */
 
@@ -73,10 +72,10 @@
   'r' -> Undergoes round-robin.
   't' -> Mode switches trapped.
 */
-#define XNTHREAD_STATE_LABELS  "SWDRU....X.HbTlr...t....."
+#define XNTHREAD_STATE_LABELS  "SWDRU...X.HbTlrt...."
 
 #define XNTHREAD_BLOCK_BITS   
(XNSUSP|XNPEND|XNDELAY|XNDORMANT|XNRELAX|XNMIGRATE|XNHELD)
-#define XNTHREAD_MODE_BITS    (XNLOCK|XNRRB|XNASDI|XNTRAPSW)
+#define XNTHREAD_MODE_BITS    (XNLOCK|XNRRB|XNTRAPSW)
 
 /* These state flags are available to the real-time interfaces */
 #define XNTHREAD_STATE_SPARE0  0x10000000
@@ -153,8 +152,6 @@ struct xnthread_user_window {
 #include <asm/xenomai/machine.h>
 #include <asm/xenomai/thread.h>
 
-#define XNTHREAD_INVALID_ASR  ((void (*)(xnsigmask_t))0)
-
 struct xnthread;
 struct xnsynch;
 struct xnsched;
@@ -182,8 +179,6 @@ struct xnthread_wait_context {
        /* anchor object */
 };
 
-typedef void (*xnasr_t)(xnsigmask_t sigs);
-
 typedef struct xnthread {
 
        struct xnarchtcb tcb;           /* Architecture-dependent block -- Must 
be first */
@@ -254,8 +249,6 @@ typedef struct xnthread {
 
        xntimer_t rrbtimer;             /* Round-robin timer */
 
-       xnsigmask_t signals;            /* Pending core signals */
-
        xnticks_t rrperiod;             /* Allotted round-robin period (ns) */
 
        struct xnthread_wait_context *wcontext; /* Active wait context. */
@@ -271,14 +264,6 @@ typedef struct xnthread {
 
        struct xnselector *selector;    /* For select. */
 
-       xnasr_t asr;                    /* Asynchronous service routine */
-
-       xnflags_t asrmode;              /* Thread's mode for ASR */
-
-       int asrimask;                   /* Thread's interrupt mask for ASR */
-
-       unsigned asrlevel;              /* ASR execution level (ASRs are 
reentrant) */
-
        int imode;                      /* Initial mode */
 
        struct xnsched_class *init_class; /* Initial scheduling class */
@@ -329,14 +314,11 @@ typedef struct xnthread {
 #define xnthread_sched_class(thread)       ((thread)->sched_class)
 #define xnthread_time_slice(thread)        ((thread)->rrperiod)
 #define xnthread_archtcb(thread)           (&((thread)->tcb))
-#define xnthread_asr_level(thread)         ((thread)->asrlevel)
-#define xnthread_pending_signals(thread)  ((thread)->signals)
 #define xnthread_timeout(thread)           
xntimer_get_timeout(&(thread)->rtimer)
 #define xnthread_stack_size(thread)        
xnarch_stack_size(xnthread_archtcb(thread))
 #define xnthread_stack_base(thread)        
xnarch_stack_base(xnthread_archtcb(thread))
 #define xnthread_stack_end(thread)         
xnarch_stack_end(xnthread_archtcb(thread))
 #define xnthread_handle(thread)            ((thread)->registry.handle)
-#define xnthread_signaled_p(thread)        ((thread)->signals != 0)
 #define xnthread_host_task(thread)         
(xnthread_archtcb(thread)->core.host_task)
 #define xnthread_host_pid(thread)         
(xnthread_test_state((thread),XNROOT) ? 0 : \
                                            
xnthread_archtcb(thread)->core.host_task->pid)
diff --git a/kernel/cobalt/pod.c b/kernel/cobalt/pod.c
index f83f3ce..caff4d7 100644
--- a/kernel/cobalt/pod.c
+++ b/kernel/cobalt/pod.c
@@ -500,9 +500,6 @@ EXPORT_SYMBOL_GPL(xnpod_init_thread);
  * block, in which case, the lock is reasserted when the thread is
  * scheduled back in.
  *
- *   - XNASDI disables the asynchronous signal handling for this
- * thread.  See xnpod_schedule() for more on this.
- *
  *   - XNSUSP makes the thread start in a suspended state. In such a
  * case, the thread will have to be explicitly resumed using the
  * xnpod_resume_thread() service for its execution to actually begin.
@@ -618,9 +615,6 @@ static void __xnpod_reset_thread(struct xnthread *thread)
        xnsched_set_policy(thread, thread->init_class,
                           &thread->init_schedparam);
 
-       /* Clear pending signals. */
-       thread->signals = 0;
-
        if (xnthread_test_state(thread, XNLOCK)) {
                xnthread_clear_state(thread, XNLOCK);
                xnthread_lock_count(thread) = 0;
@@ -687,9 +681,8 @@ EXPORT_SYMBOL_GPL(xnpod_stop_thread);
  * thread can be forcibly released by passing the XNLOCK bit in this
  * mask. In this case, the lock nesting count is also reset to zero.
  *
- * @param setmask The new thread mode. The following flags can be part
- * of this bitmask, each of them affecting the nucleus behaviour
- * regarding the thread:
+ * @param setmask The new thread mode. The following flags may be set
+ * in this bitmask:
  *
  * - XNLOCK causes the thread to lock the scheduler.  The target
  * thread will have to call the xnpod_unlock_sched() service to unlock
@@ -697,8 +690,9 @@ EXPORT_SYMBOL_GPL(xnpod_stop_thread);
  * service. A non-preemptible thread may still block, in which case,
  * the lock is reasserted when the thread is scheduled back in.
  *
- * - XNASDI disables the asynchronous signal handling for this thread.
- * See xnpod_schedule() for more on this.
+ * - XNTRAPSW causes the thread to receive a SIGDEBUG signal when it
+ * switches to secondary mode. This is a debugging aid for detecting
+ * spurious relaxes.
  *
  * Environments:
  *
@@ -1622,51 +1616,6 @@ int xnpod_migrate_thread(int cpu)
 }
 EXPORT_SYMBOL_GPL(xnpod_migrate_thread);
 
-/*!
- * @internal
- * \fn void xnpod_dispatch_signals(void)
- * \brief Deliver pending asynchronous signals to the running thread.
- *
- * This internal routine checks for the presence of asynchronous
- * signals directed to the running thread, and attempts to start the
- * asynchronous service routine (ASR) if any. Called with nklock
- * locked, interrupts off.
- */
-
-void xnpod_dispatch_signals(void)
-{
-       xnthread_t *thread = xnpod_current_thread();
-       xnflags_t oldmode;
-       xnsigmask_t sigs;
-       xnasr_t asr;
-
-       /* Process user-defined signals if the ASR is enabled for this
-          thread. */
-
-       if (thread->signals == 0 || xnthread_test_state(thread, XNASDI)
-           || thread->asr == XNTHREAD_INVALID_ASR)
-               return;
-
-       trace_mark(xn_nucleus, sched_sigdispatch, "signals %lu",
-                  thread->signals);
-
-       /* Start the asynchronous service routine */
-       oldmode = xnthread_test_state(thread, XNTHREAD_MODE_BITS);
-       sigs = thread->signals;
-       asr = thread->asr;
-
-       /* Clear pending signals mask since an ASR can be reentrant */
-       thread->signals = 0;
-
-       xnthread_clear_state(thread, XNTHREAD_MODE_BITS);
-       xnthread_set_state(thread, thread->asrmode);
-       thread->asrlevel++;
-       asr(sigs);
-       thread->asrlevel--;
-       xnthread_clear_state(thread, XNTHREAD_MODE_BITS);
-       xnthread_set_state(thread, oldmode);
-}
-
 static inline void xnpod_switch_to(xnsched_t *sched,
                                   xnthread_t *prev, xnthread_t *next)
 {
@@ -1894,9 +1843,7 @@ reschedule:
 
        __xnpod_switch_fpu(sched);
 
- signal_unlock_and_exit:
-       if (xnthread_signaled_p(curr))
-               xnpod_dispatch_signals();
+signal_unlock_and_exit:
 
        if (switched &&
            xnsched_maybe_resched_after_unlocked_switch(sched))
diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index 65d4bea..fe9829c 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -459,9 +459,6 @@ int xnshadow_harden(void)
        xnpod_switch_fpu(sched);
 #endif /* CONFIG_XENO_HW_FPU */
 
-       if (xnthread_signaled_p(thread))
-               xnpod_dispatch_signals();
-
        xnlock_clear_irqon(&nklock);
 
        trace_mark(xn_nucleus, shadow_hardened, "thread %p name %s",
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 71921e0..dc8af95 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -160,11 +160,6 @@ int xnthread_init(struct xnthread *thread,
        thread->state = flags;
        thread->info = 0;
        thread->schedlck = 0;
-       thread->signals = 0;
-       thread->asrmode = 0;
-       thread->asrimask = 0;
-       thread->asr = XNTHREAD_INVALID_ASR;
-       thread->asrlevel = 0;
 
        thread->rrperiod = XN_INFINITE;
        thread->wchan = NULL;


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

Reply via email to