Skip to contentSkip to conversation

reorganise XENO_OPT_DEBUG switches

PATCH In review Jan Kiszka 1 participant 2 messages Nov 20, 2006 – Nov 22, 2006 Generic include/asm header files

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/3 reorganise XENO_OPT_DEBUG switches

This reorganises the debugging switches of Xenomai in so far that:

- XENO_OPT_DEBUG_NUCLEUS controls debugging checks in the nucleus + spinlock debugging / lock length tracking

- XENO_OPT_DEBUG_QUEUES controls both queue and binary heap debugging

- XENO_OPT_WATCHDOG depends on XENO_OPT_DEBUG - for pure organisational reasons. It's a debugging feature, so put it in this category.

To control code generation that depends on the debug switch of a particular subsystem, the macro XENO_DEBUG(subsystem) is introduced. It evaluates to true if the related switch is set during kernel configuration, but also allows to use the related config options for XENO_ASSERT or XENO_BUGON. As the new macro is defined in include/nucleus/assert.h that header should actually be renamed as debug.h - but this is not yet performed by the patch.

Jan

---
 include/asm-generic/system.h |   53 ++++++++++++++------------
 include/nucleus/assert.h     |    2 
 include/nucleus/bheap.h      |   12 +++--
 include/nucleus/queue.h      |   36 ++++++++++-------
 ksrc/nucleus/Config.in       |    4 -
 ksrc/nucleus/Kconfig         |   87 ++++++++++++++++++++++---------------------
 ksrc/nucleus/module.c        |   12 ++---
 ksrc/nucleus/pod.c           |   43 ++++++++++++---------
 ksrc/nucleus/shadow.c        |   38 ++++++++----------
 9 files changed, 155 insertions(+), 132 deletions(-)
include/nucleus/assert.h +2 -0
Index: xenomai/include/nucleus/assert.h
===================================================================
@@ -22,6 +22,8 @@
 
 #include <nucleus/compiler.h>
 
+#define XENO_DEBUG(subsystem)   (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
+
 #define XENO_ASSERT(subsystem,cond,action)  do { \
     if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && !(cond))) { \
         xnarch_trace_panic_freeze(); \
include/nucleus/bheap.h +7 -5
Index: xenomai/include/nucleus/bheap.h
===================================================================
@@ -21,8 +21,14 @@
 #define _XENO_NUCLEUS_BHEAP_H
 
 #include <nucleus/compiler.h>
+
+/* debug support */
 #include <nucleus/assert.h>
 
+#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
+#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
+#endif
+
 /* Priority queue implementation, using a binary heap. */
 
 typedef unsigned long long bheap_key_t;
@@ -53,11 +59,7 @@ typedef struct bheap {
         bheaph_t *elems[sz];                    \
     } name
 
-#ifdef CONFIG_XENO_OPT_DEBUG_BHEAP
-#define BHEAP_CHECK(heap)   XENO_BUGON(BHEAP, ((heap)->sz == 0))
-#else /* !CONFIG_XENO_OPT_DEBUG_BHEAP */
-#define BHEAP_CHECK(heap)   do { } while (0)
-#endif /* CONFIG_XENO_OPT_DEBUG_BHEAP */
+#define BHEAP_CHECK(heap)   XENO_BUGON(QUEUES, ((heap)->sz == 0))
 
 #define bheap_gethead(heap)                     \
 ({                                              \
ksrc/nucleus/Kconfig +46 -41

210 lines not on this page · raw message

ksrc/nucleus/shadow.c +17 -21
Index: xenomai/ksrc/nucleus/shadow.c
===================================================================
@@ -55,6 +55,13 @@
 #include <asm/xenomai/syscall.h>
 #include <asm/xenomai/bits/shadow.h>
 
+/* debug support */
+#include <nucleus/assert.h>
+
+#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
+#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
+#endif
+
 int nkthrptd;
 
 int nkerrptd;
@@ -486,12 +493,11 @@ static void schedule_linux_call(int type
 	struct __lostagerq *rq = &lostagerq[cpuid];
 	spl_t s;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (!p)
+	XENO_ASSERT(NUCLEUS, p,
 		xnpod_fatal("schedule_linux_call() invoked "
 			    "with NULL task pointer (req=%d, arg=%d)?!", type,
 			    arg);
-#endif /* CONFIG_XENO_OPT_DEBUG */
+		);
 
 	splhigh(s);
 	reqnum = rq->in;
@@ -628,13 +634,11 @@ int xnshadow_harden(void)
 	   fail; the caller will have to process this signal anyway. */
 
 	if (rthal_current_domain == rthal_root_domain) {
-#ifdef CONFIG_XENO_OPT_DEBUG
-		if (!signal_pending(this_task)
-		    || this_task->state != TASK_RUNNING)
+		if (XENO_DEBUG(NUCLEUS) && (!signal_pending(this_task)
+		    || this_task->state != TASK_RUNNING))
 			xnpod_fatal
 			    ("xnshadow_harden() failed for thread %s[%d]",
 			     thread->name, xnthread_user_pid(thread));
-#endif /* CONFIG_XENO_OPT_DEBUG */
 		return -ERESTARTSYS;
 	}
 
@@ -688,10 +692,7 @@ void xnshadow_relax(int notify)
 	int cprio;
 	spl_t s;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (testbits(thread->status, XNROOT))
-		xnpod_fatal("xnshadow_relax() called from the Linux domain");
-#endif /* CONFIG_XENO_OPT_DEBUG */
+	XENO_BUGON(NUCLEUS, testbits(thread->status, XNROOT));
 
 	/* Enqueue the request to move the running shadow from the Xenomai
 	   domain to the Linux domain.  This will cause the Linux task
@@ -721,11 +722,9 @@ void xnshadow_relax(int notify)
 
 	splexit(s);
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (rthal_current_domain != rthal_root_domain)
+	if (XENO_DEBUG(NUCLEUS) && rthal_current_domain != rthal_root_domain)
 		xnpod_fatal("xnshadow_relax() failed for thread %s[%d]",
 			    thread->name, xnthread_user_pid(thread));
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 	cprio = thread->cprio < MAX_RT_PRIO ? thread->cprio : MAX_RT_PRIO - 1;
 	rthal_reenter_root(get_switch_lock_owner(),
@@ -883,10 +882,9 @@ void xnshadow_unmap(xnthread_t *thread)
 	struct task_struct *p;
 	unsigned muxid, magic;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (!testbits(xnpod_current_sched()->status, XNKCOUT))
+	if (XENO_DEBUG(NUCLEUS) &&
+	    !testbits(xnpod_current_sched()->status, XNKCOUT))
 		xnpod_fatal("xnshadow_unmap() called from invalid context");
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 	p = xnthread_archtcb(thread)->user_task;	/* May be != current */
 
@@ -1708,8 +1706,7 @@ static inline void do_schedule_event(str
 #endif /* CONFIG_XENO_OPT_RPIDISABLE */
 			newrprio = XNPOD_ROOT_PRIO_BASE;	/* Decouple priority scales. */
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-		{
+		if (XENO_DEBUG(NUCLEUS)) {
 			xnflags_t status = threadin->status;
 			int sigpending = signal_pending(next);
 
@@ -1717,7 +1714,7 @@ static inline void do_schedule_event(str
 				xnarch_trace_panic_freeze();
 				show_stack(xnthread_user_task(threadin), NULL);
 				xnpod_fatal
-				    ("Hardened thread %s[%d] running in Linux domain?! (status=0x%lx, sig=%d, prev=%s[%d])",
+				    ("Hardened thread %s[%d] running in Linux"" domain?! (status=0x%lx, sig=%d, prev=%s[%d])",
 				     threadin->name, next->pid, status,
 				     sigpending, prev->comm, prev->pid);
 			} else if (!(next->ptrace & PT_PTRACED) &&
@@ -1733,7 +1730,6 @@ static inline void do_schedule_event(str
 				     sigpending, prev->comm, prev->pid);
 			}
 		}
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 #ifdef CONFIG_XENO_OPT_ISHIELD
 		reset_shield(threadin);
include/nucleus/queue.h +21 -15
Index: xenomai/include/nucleus/queue.h
===================================================================
@@ -24,6 +24,13 @@
 #include <nucleus/types.h>
 #include <nucleus/core.h>
 
+/* debug support */
+#include <nucleus/assert.h>
+
+#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
+#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
+#endif
+
 /* Basic element holder */
 
 typedef struct xnholder {
@@ -62,28 +69,28 @@ typedef struct xnqueue {
 
     xnholder_t head;
     int elems;
-#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if defined(__KERNEL__) && XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
     xnlock_t lock;
-#endif /* __KERNEL__ && CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* __KERNEL__ && XENO_DEBUG(QUEUES) && CONFIG_SMP */
 
 } xnqueue_t;
 
-#if defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
 #define DECLARE_XNQUEUE(q) xnqueue_t q = { { &(q).head, &(q).head }, 0, XNARCH_LOCK_UNLOCKED }
-#else /* !(CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP) */
+#else /* !(XENO_DEBUG(QUEUES) && CONFIG_SMP) */
 #define DECLARE_XNQUEUE(q) xnqueue_t q = { { &(q).head, &(q).head }, 0 }
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* XENO_DEBUG(QUEUES) && CONFIG_SMP */
 
 static inline void initq (xnqueue_t *qslot)
 {
     inith(&qslot->head);
     qslot->elems = 0;
-#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if defined(__KERNEL__) && XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
     xnlock_init(&qslot->lock);
-#endif /* __KERNEL__ && CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* __KERNEL__ && XENO_DEBUG(QUEUES) && CONFIG_SMP */
 }
 
-#ifdef CONFIG_XENO_OPT_DEBUG_QUEUES
+#if XENO_DEBUG(QUEUES)
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
@@ -178,7 +185,7 @@ do { \
    dth(__holder);				\
    --(__qslot)->elems; })
 
-#else /* !CONFIG_XENO_OPT_DEBUG_QUEUES */
+#else /* !XENO_DEBUG(QUEUES) */
 
 static inline void insertq (xnqueue_t *qslot,
 			    xnholder_t *head,
@@ -212,7 +219,7 @@ static inline void removeq (xnqueue_t *q
     --qslot->elems;
 }
 
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
+#endif /* XENO_DEBUG(QUEUES) */
 
 static inline xnholder_t *getheadq (xnqueue_t *qslot)
 {
@@ -762,13 +769,12 @@ static inline xnpholder_t *getmlq(xnmlqu
     queue = &mlqslot->queue[idx];
     holder = getq(queue);
 
-#ifdef CONFIG_XENO_OPT_DEBUG_QUEUES
-    if (!holder)
+    XENO_ASSERT(QUEUES, holder,
         xnpod_fatal("corrupted multi-level queue, qslot=%p at %s:%d",
                     mlqslot,
 		    __FILE__,__LINE__);
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
-        
+        );
+
     hi = idx / BITS_PER_LONG;
     lo = idx % BITS_PER_LONG;
 
@@ -779,7 +785,7 @@ static inline xnpholder_t *getmlq(xnmlqu
 	if (mlqslot->lomap[hi] == 0)
 	    __clrbits(mlqslot->himap,1 << hi);
     }
-    
+
     return (xnpholder_t *)holder;
 }
 
ksrc/nucleus/Config.in +2 -2
Index: xenomai/ksrc/nucleus/Config.in
===================================================================
@@ -32,10 +32,10 @@ if [ "$CONFIG_XENO_OPT_NUCLEUS" != "n" ]
 	bool 'Statistics collection' CONFIG_XENO_OPT_STATS
 	bool 'Debug support' CONFIG_XENO_OPT_DEBUG
 	if [ "$CONFIG_XENO_OPT_DEBUG" = "y" ]; then
+		bool 'Nucleus Debugging support' CONFIG_XENO_OPT_DEBUG_NUCLEUS
 		bool 'Queue Debugging support' CONFIG_XENO_OPT_DEBUG_QUEUES
-		define_bool CONFIG_XENO_OPT_DEBUG_BHEAP y
+		bool 'Watchdog support' CONFIG_XENO_OPT_WATCHDOG
 	fi
-	bool 'Watchdog support' CONFIG_XENO_OPT_WATCHDOG
 
 	bool 'Enable periodic timer support' CONFIG_XENO_OPT_TIMING_PERIODIC
 	if [ "$CONFIG_XENO_OPT_TIMING_PERIODIC" = "y" ]; then
ksrc/nucleus/pod.c +25 -18

135 lines not on this page · raw message

include/asm-generic/system.h +29 -24

154 lines not on this page · raw message

ksrc/nucleus/module.c +6 -6
Index: xenomai/ksrc/nucleus/module.c
===================================================================
@@ -474,7 +474,7 @@ static struct file_operations stat_seq_o
 
 #endif /* CONFIG_XENO_OPT_STATS */
 
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if defined(CONFIG_SMP) && XENO_DEBUG(NUCLEUS)
 
 xnlockinfo_t xnlock_stats[RTHAL_NR_CPUS];
 
@@ -522,7 +522,7 @@ static int lock_read_proc(char *page,
 
 EXPORT_SYMBOL(xnlock_stats);
 
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 
 static int latency_read_proc(char *page,
 			     char **start,
@@ -743,9 +743,9 @@ void xnpod_init_proc(void)
 	add_proc_fops("stat", &stat_seq_operations, 0, rthal_proc_root);
 #endif /* CONFIG_XENO_OPT_STATS */
 
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if defined(CONFIG_SMP) && XENO_DEBUG(NUCLEUS)
 	add_proc_leaf("lock", &lock_read_proc, NULL, NULL, rthal_proc_root);
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 
 	add_proc_leaf("latency",
 		      &latency_read_proc,
@@ -787,9 +787,9 @@ void xnpod_delete_proc(void)
 #ifdef CONFIG_XENO_OPT_STATS
 	remove_proc_entry("stat", rthal_proc_root);
 #endif /* CONFIG_XENO_OPT_STATS */
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if CONFIG_SMP && XENO_DEBUG(NUCLEUS)
 	remove_proc_entry("lock", rthal_proc_root);
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 }
 
 #ifdef CONFIG_XENO_OPT_PERVASIVE
author
#1 lore raw

This is version 2 with the following changes:

- rebased on patch 1/3
- XENO_OPT_WATCHDOG and XENO_OPT_DEBUG_RTDM are default y once debugging is enabled
- more cleanups in ksrc/nucleus/Kconfig

Jan

---
 include/asm-generic/system.h |   53 +++++++++++++----------
 include/nucleus/assert.h     |    2 
 include/nucleus/bheap.h      |   12 +++--
 include/nucleus/queue.h      |   36 +++++++++-------
 ksrc/nucleus/Config.in       |    4 -
 ksrc/nucleus/Kconfig         |   95 +++++++++++++++++++++----------------------
 ksrc/nucleus/module.c        |   12 ++---
 ksrc/nucleus/pod.c           |   43 +++++++++++--------
 ksrc/nucleus/shadow.c        |   38 +++++++----------
 ksrc/skins/rtdm/Kconfig      |    1 
 10 files changed, 157 insertions(+), 139 deletions(-)
include/nucleus/assert.h +2 -0
Index: xenomai/include/nucleus/assert.h
===================================================================
@@ -22,6 +22,8 @@
 
 #include <nucleus/compiler.h>
 
+#define XENO_DEBUG(subsystem)   (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
+
 #define XENO_ASSERT(subsystem,cond,action)  do { \
     if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && !(cond))) { \
         xnarch_trace_panic_freeze(); \
include/nucleus/bheap.h +7 -5
Index: xenomai/include/nucleus/bheap.h
===================================================================
@@ -21,8 +21,14 @@
 #define _XENO_NUCLEUS_BHEAP_H
 
 #include <nucleus/compiler.h>
+
+/* debug support */
 #include <nucleus/assert.h>
 
+#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
+#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
+#endif
+
 /* Priority queue implementation, using a binary heap. */
 
 typedef unsigned long long bheap_key_t;
@@ -53,11 +59,7 @@ typedef struct bheap {
         bheaph_t *elems[sz];                    \
     } name
 
-#ifdef CONFIG_XENO_OPT_DEBUG_BHEAP
-#define BHEAP_CHECK(heap)   XENO_BUGON(BHEAP, ((heap)->sz == 0))
-#else /* !CONFIG_XENO_OPT_DEBUG_BHEAP */
-#define BHEAP_CHECK(heap)   do { } while (0)
-#endif /* CONFIG_XENO_OPT_DEBUG_BHEAP */
+#define BHEAP_CHECK(heap)   XENO_BUGON(QUEUES, ((heap)->sz == 0))
 
 #define bheap_gethead(heap)                     \
 ({                                              \
ksrc/nucleus/Kconfig +47 -48

234 lines not on this page · raw message

ksrc/nucleus/shadow.c +17 -21
Index: xenomai/ksrc/nucleus/shadow.c
===================================================================
@@ -55,6 +55,13 @@
 #include <asm/xenomai/syscall.h>
 #include <asm/xenomai/bits/shadow.h>
 
+/* debug support */
+#include <nucleus/assert.h>
+
+#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS
+#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0
+#endif
+
 int nkthrptd;
 
 int nkerrptd;
@@ -486,12 +493,11 @@ static void schedule_linux_call(int type
 	struct __lostagerq *rq = &lostagerq[cpuid];
 	spl_t s;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (!p)
+	XENO_ASSERT(NUCLEUS, p,
 		xnpod_fatal("schedule_linux_call() invoked "
 			    "with NULL task pointer (req=%d, arg=%d)?!", type,
 			    arg);
-#endif /* CONFIG_XENO_OPT_DEBUG */
+		);
 
 	splhigh(s);
 	reqnum = rq->in;
@@ -628,13 +634,11 @@ int xnshadow_harden(void)
 	   fail; the caller will have to process this signal anyway. */
 
 	if (rthal_current_domain == rthal_root_domain) {
-#ifdef CONFIG_XENO_OPT_DEBUG
-		if (!signal_pending(this_task)
-		    || this_task->state != TASK_RUNNING)
+		if (XENO_DEBUG(NUCLEUS) && (!signal_pending(this_task)
+		    || this_task->state != TASK_RUNNING))
 			xnpod_fatal
 			    ("xnshadow_harden() failed for thread %s[%d]",
 			     thread->name, xnthread_user_pid(thread));
-#endif /* CONFIG_XENO_OPT_DEBUG */
 		return -ERESTARTSYS;
 	}
 
@@ -688,10 +692,7 @@ void xnshadow_relax(int notify)
 	int cprio;
 	spl_t s;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (testbits(thread->status, XNROOT))
-		xnpod_fatal("xnshadow_relax() called from the Linux domain");
-#endif /* CONFIG_XENO_OPT_DEBUG */
+	XENO_BUGON(NUCLEUS, testbits(thread->status, XNROOT));
 
 	/* Enqueue the request to move the running shadow from the Xenomai
 	   domain to the Linux domain.  This will cause the Linux task
@@ -721,11 +722,9 @@ void xnshadow_relax(int notify)
 
 	splexit(s);
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (rthal_current_domain != rthal_root_domain)
+	if (XENO_DEBUG(NUCLEUS) && rthal_current_domain != rthal_root_domain)
 		xnpod_fatal("xnshadow_relax() failed for thread %s[%d]",
 			    thread->name, xnthread_user_pid(thread));
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 	cprio = thread->cprio < MAX_RT_PRIO ? thread->cprio : MAX_RT_PRIO - 1;
 	rthal_reenter_root(get_switch_lock_owner(),
@@ -883,10 +882,9 @@ void xnshadow_unmap(xnthread_t *thread)
 	struct task_struct *p;
 	unsigned muxid, magic;
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-	if (!testbits(xnpod_current_sched()->status, XNKCOUT))
+	if (XENO_DEBUG(NUCLEUS) &&
+	    !testbits(xnpod_current_sched()->status, XNKCOUT))
 		xnpod_fatal("xnshadow_unmap() called from invalid context");
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 	p = xnthread_archtcb(thread)->user_task;	/* May be != current */
 
@@ -1708,8 +1706,7 @@ static inline void do_schedule_event(str
 #endif /* CONFIG_XENO_OPT_RPIDISABLE */
 			newrprio = XNPOD_ROOT_PRIO_BASE;	/* Decouple priority scales. */
 
-#ifdef CONFIG_XENO_OPT_DEBUG
-		{
+		if (XENO_DEBUG(NUCLEUS)) {
 			xnflags_t status = threadin->status;
 			int sigpending = signal_pending(next);
 
@@ -1717,7 +1714,7 @@ static inline void do_schedule_event(str
 				xnarch_trace_panic_freeze();
 				show_stack(xnthread_user_task(threadin), NULL);
 				xnpod_fatal
-				    ("Hardened thread %s[%d] running in Linux domain?! (status=0x%lx, sig=%d, prev=%s[%d])",
+				    ("Hardened thread %s[%d] running in Linux"" domain?! (status=0x%lx, sig=%d, prev=%s[%d])",
 				     threadin->name, next->pid, status,
 				     sigpending, prev->comm, prev->pid);
 			} else if (!(next->ptrace & PT_PTRACED) &&
@@ -1733,7 +1730,6 @@ static inline void do_schedule_event(str
 				     sigpending, prev->comm, prev->pid);
 			}
 		}
-#endif /* CONFIG_XENO_OPT_DEBUG */
 
 #ifdef CONFIG_XENO_OPT_ISHIELD
 		reset_shield(threadin);
include/nucleus/queue.h +21 -15
Index: xenomai/include/nucleus/queue.h
===================================================================
@@ -24,6 +24,13 @@
 #include <nucleus/types.h>
 #include <nucleus/core.h>
 
+/* debug support */
+#include <nucleus/assert.h>
+
+#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES
+#define CONFIG_XENO_OPT_DEBUG_QUEUES 0
+#endif
+
 /* Basic element holder */
 
 typedef struct xnholder {
@@ -62,28 +69,28 @@ typedef struct xnqueue {
 
     xnholder_t head;
     int elems;
-#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if defined(__KERNEL__) && XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
     xnlock_t lock;
-#endif /* __KERNEL__ && CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* __KERNEL__ && XENO_DEBUG(QUEUES) && CONFIG_SMP */
 
 } xnqueue_t;
 
-#if defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
 #define DECLARE_XNQUEUE(q) xnqueue_t q = { { &(q).head, &(q).head }, 0, XNARCH_LOCK_UNLOCKED }
-#else /* !(CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP) */
+#else /* !(XENO_DEBUG(QUEUES) && CONFIG_SMP) */
 #define DECLARE_XNQUEUE(q) xnqueue_t q = { { &(q).head, &(q).head }, 0 }
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* XENO_DEBUG(QUEUES) && CONFIG_SMP */
 
 static inline void initq (xnqueue_t *qslot)
 {
     inith(&qslot->head);
     qslot->elems = 0;
-#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_DEBUG_QUEUES) && defined(CONFIG_SMP)
+#if defined(__KERNEL__) && XENO_DEBUG(QUEUES) && defined(CONFIG_SMP)
     xnlock_init(&qslot->lock);
-#endif /* __KERNEL__ && CONFIG_XENO_OPT_DEBUG_QUEUES && CONFIG_SMP */
+#endif /* __KERNEL__ && XENO_DEBUG(QUEUES) && CONFIG_SMP */
 }
 
-#ifdef CONFIG_XENO_OPT_DEBUG_QUEUES
+#if XENO_DEBUG(QUEUES)
 
 #if defined(__KERNEL__) || defined(__XENO_SIM__)
 
@@ -178,7 +185,7 @@ do { \
    dth(__holder);				\
    --(__qslot)->elems; })
 
-#else /* !CONFIG_XENO_OPT_DEBUG_QUEUES */
+#else /* !XENO_DEBUG(QUEUES) */
 
 static inline void insertq (xnqueue_t *qslot,
 			    xnholder_t *head,
@@ -212,7 +219,7 @@ static inline void removeq (xnqueue_t *q
     --qslot->elems;
 }
 
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
+#endif /* XENO_DEBUG(QUEUES) */
 
 static inline xnholder_t *getheadq (xnqueue_t *qslot)
 {
@@ -762,13 +769,12 @@ static inline xnpholder_t *getmlq(xnmlqu
     queue = &mlqslot->queue[idx];
     holder = getq(queue);
 
-#ifdef CONFIG_XENO_OPT_DEBUG_QUEUES
-    if (!holder)
+    XENO_ASSERT(QUEUES, holder,
         xnpod_fatal("corrupted multi-level queue, qslot=%p at %s:%d",
                     mlqslot,
 		    __FILE__,__LINE__);
-#endif /* CONFIG_XENO_OPT_DEBUG_QUEUES */
-        
+        );
+
     hi = idx / BITS_PER_LONG;
     lo = idx % BITS_PER_LONG;
 
@@ -779,7 +785,7 @@ static inline xnpholder_t *getmlq(xnmlqu
 	if (mlqslot->lomap[hi] == 0)
 	    __clrbits(mlqslot->himap,1 << hi);
     }
-    
+
     return (xnpholder_t *)holder;
 }
 
ksrc/nucleus/Config.in +2 -2
Index: xenomai/ksrc/nucleus/Config.in
===================================================================
@@ -32,10 +32,10 @@ if [ "$CONFIG_XENO_OPT_NUCLEUS" != "n" ]
 	bool 'Statistics collection' CONFIG_XENO_OPT_STATS
 	bool 'Debug support' CONFIG_XENO_OPT_DEBUG
 	if [ "$CONFIG_XENO_OPT_DEBUG" = "y" ]; then
+		bool 'Nucleus Debugging support' CONFIG_XENO_OPT_DEBUG_NUCLEUS
 		bool 'Queue Debugging support' CONFIG_XENO_OPT_DEBUG_QUEUES
-		define_bool CONFIG_XENO_OPT_DEBUG_BHEAP y
+		bool 'Watchdog support' CONFIG_XENO_OPT_WATCHDOG
 	fi
-	bool 'Watchdog support' CONFIG_XENO_OPT_WATCHDOG
 
 	bool 'Enable periodic timer support' CONFIG_XENO_OPT_TIMING_PERIODIC
 	if [ "$CONFIG_XENO_OPT_TIMING_PERIODIC" = "y" ]; then
ksrc/nucleus/pod.c +25 -18

135 lines not on this page · raw message

include/asm-generic/system.h +29 -24

154 lines not on this page · raw message

ksrc/nucleus/module.c +6 -6
Index: xenomai/ksrc/nucleus/module.c
===================================================================
@@ -474,7 +474,7 @@ static struct file_operations stat_seq_o
 
 #endif /* CONFIG_XENO_OPT_STATS */
 
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if defined(CONFIG_SMP) && XENO_DEBUG(NUCLEUS)
 
 xnlockinfo_t xnlock_stats[RTHAL_NR_CPUS];
 
@@ -522,7 +522,7 @@ static int lock_read_proc(char *page,
 
 EXPORT_SYMBOL(xnlock_stats);
 
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 
 static int latency_read_proc(char *page,
 			     char **start,
@@ -743,9 +743,9 @@ void xnpod_init_proc(void)
 	add_proc_fops("stat", &stat_seq_operations, 0, rthal_proc_root);
 #endif /* CONFIG_XENO_OPT_STATS */
 
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if defined(CONFIG_SMP) && XENO_DEBUG(NUCLEUS)
 	add_proc_leaf("lock", &lock_read_proc, NULL, NULL, rthal_proc_root);
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 
 	add_proc_leaf("latency",
 		      &latency_read_proc,
@@ -787,9 +787,9 @@ void xnpod_delete_proc(void)
 #ifdef CONFIG_XENO_OPT_STATS
 	remove_proc_entry("stat", rthal_proc_root);
 #endif /* CONFIG_XENO_OPT_STATS */
-#ifdef CONFIG_XENO_SPINLOCK_DEBUG
+#if CONFIG_SMP && XENO_DEBUG(NUCLEUS)
 	remove_proc_entry("lock", rthal_proc_root);
-#endif /* CONFIG_XENO_SPINLOCK_DEBUG */
+#endif /* CONFIG_SMP && XENO_DEBUG(NUCLEUS) */
 }
 
 #ifdef CONFIG_XENO_OPT_PERVASIVE
ksrc/skins/rtdm/Kconfig +1 -0
Index: xenomai/ksrc/skins/rtdm/Kconfig
===================================================================
@@ -22,6 +22,7 @@ config XENO_OPT_RTDM_FILDES
 config XENO_OPT_DEBUG_RTDM
 	bool "RTDM debugging support"
 	depends on XENO_OPT_DEBUG && XENO_SKIN_RTDM
+	default y
 	help
 
 	This option activates debugging checks for the RTDM subsystem.