[Xenomai-git] Philippe Gerum : cobalt/kernel: improve handling of user debug options

2015-07-27 Thread git repository hosting
Module: xenomai-3
Branch: master
Commit: 032fb4fad94c54c681ea9f5d2f47bae83e2c9029
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=032fb4fad94c54c681ea9f5d2f47bae83e2c9029

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jul 12 16:42:23 2015 +0200

cobalt/kernel: improve handling of user debug options

This changeset introduces individual switches for enabling/disabling
particular user debug features. At this chance, the related
documentation has been updated.

Notification upon secondary mode switches is still considered
regardless of the debug settings, as production setups may depend on
it for basic sanity testing.

---

 include/cobalt/kernel/synch.h  |6 +-
 include/cobalt/kernel/thread.h |2 +-
 include/cobalt/uapi/corectl.h  |   16 ++--
 include/cobalt/uapi/signal.h   |2 +-
 kernel/cobalt/Kconfig  |  168 +---
 kernel/cobalt/debug.c  |2 +-
 kernel/cobalt/posix/cond.c |5 +-
 kernel/cobalt/posix/mutex.c|   22 +++---
 kernel/cobalt/posix/sem.c  |   10 +--
 kernel/cobalt/posix/syscall.c  |   10 ++-
 kernel/cobalt/rtdm/core.c  |2 +-
 kernel/cobalt/rtdm/fd.c|5 +-
 kernel/cobalt/synch.c  |8 +-
 kernel/cobalt/thread.c |   26 ---
 kernel/drivers/Kconfig |3 +-
 lib/cobalt/internal.c  |4 +-
 lib/cobalt/thread.c|   29 +--
 17 files changed, 176 insertions(+), 144 deletions(-)

diff --git a/include/cobalt/kernel/synch.h b/include/cobalt/kernel/synch.h
index f53cd5e..ffb884a 100644
--- a/include/cobalt/kernel/synch.h
+++ b/include/cobalt/kernel/synch.h
@@ -101,14 +101,14 @@ static inline struct xnthread *xnsynch_owner(struct 
xnsynch *synch)
 #define xnsynch_owner_check(synch, thread) \
xnsynch_fast_owner_check((synch)-fastlock, thread-handle)
 
-#if XENO_DEBUG(USER)
+#if XENO_DEBUG(MUTEX_RELAXED)
 
 void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
  struct xnthread *sleeper);
 
 void xnsynch_detect_claimed_relax(struct xnthread *owner);
 
-#else /* !XENO_DEBUG(USER) */
+#else /* !XENO_DEBUG(MUTEX_RELAXED) */
 
 static inline void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
  struct xnthread *sleeper)
@@ -119,7 +119,7 @@ static inline void xnsynch_detect_claimed_relax(struct 
xnthread *owner)
 {
 }
 
-#endif /* !XENO_DEBUG(USER) */
+#endif /* !XENO_DEBUG(MUTEX_RELAXED) */
 
 void xnsynch_init(struct xnsynch *synch, int flags,
  atomic_t *fastlock);
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 8a9236a..1ba0c1b 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -503,7 +503,7 @@ static inline void xnthread_get_resource(struct xnthread 
*thread)
 static inline int xnthread_put_resource(struct xnthread *thread)
 {
if (xnthread_test_state(thread, XNWEAK) ||
-   IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) {
+   IS_ENABLED(CONFIG_XENO_OPT_DEBUG_MUTEX_SLEEP)) {
if (unlikely(thread-res_count == 0)) {
if (xnthread_test_state(thread, XNWARN))
xnthread_signal(thread, SIGDEBUG,
diff --git a/include/cobalt/uapi/corectl.h b/include/cobalt/uapi/corectl.h
index d2544b3..9466743 100644
--- a/include/cobalt/uapi/corectl.h
+++ b/include/cobalt/uapi/corectl.h
@@ -22,12 +22,16 @@
 #define _CC_COBALT_GET_NR_PIPES1
 #define _CC_COBALT_GET_NR_TIMERS   2
 
-#define _CC_COBALT_GET_DEBUG   3
-#   define _CC_COBALT_DEBUG_ASSERT 1
-#   define _CC_COBALT_DEBUG_CONTEXT2
-#   define _CC_COBALT_DEBUG_LOCKING4
-#   define _CC_COBALT_DEBUG_USER   8
-#   define _CC_COBALT_DEBUG_RELAX  16
+#define _CC_COBALT_GET_DEBUG   3
+#   define _CC_COBALT_DEBUG_ASSERT 1
+#   define _CC_COBALT_DEBUG_CONTEXT2
+#   define _CC_COBALT_DEBUG_LOCKING4
+#   define _CC_COBALT_DEBUG_USER   8
+#   define _CC_COBALT_DEBUG_MUTEX_RELAXED  16
+#   define _CC_COBALT_DEBUG_MUTEX_SLEEP32
+#   define _CC_COBALT_DEBUG_POSIX_SYNCHRO  64
+#   define _CC_COBALT_DEBUG_LEGACY 128
+#   define _CC_COBALT_DEBUG_TRACE_RELAX256
 
 #define _CC_COBALT_GET_POLICIES4
 #   define _CC_COBALT_SCHED_FIFO   1
diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h
index 53e46ba..b5483d7 100644
--- a/include/cobalt/uapi/signal.h
+++ b/include/cobalt/uapi/signal.h
@@ -66,7 +66,7 @@
 #define SIGDEBUG_WATCHDOG  6
 #define SIGDEBUG_RESCNT_IMBALANCE  7
 #define SIGDEBUG_LOCK_BREAK8
-#define SIGDEBUG_RESCNT_SLEEP  9
+#define SIGDEBUG_MUTEX_SLEEP   9
 
 #define COBALT_DELAYMAX2147483647U
 
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index 27b4a4a..afa62d2 100644
--- a/kernel/cobalt/Kconfig

[Xenomai-git] Philippe Gerum : cobalt/kernel: improve handling of user debug options

2015-07-12 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 032fb4fad94c54c681ea9f5d2f47bae83e2c9029
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=032fb4fad94c54c681ea9f5d2f47bae83e2c9029

Author: Philippe Gerum r...@xenomai.org
Date:   Sun Jul 12 16:42:23 2015 +0200

cobalt/kernel: improve handling of user debug options

This changeset introduces individual switches for enabling/disabling
particular user debug features. At this chance, the related
documentation has been updated.

Notification upon secondary mode switches is still considered
regardless of the debug settings, as production setups may depend on
it for basic sanity testing.

---

 include/cobalt/kernel/synch.h  |6 +-
 include/cobalt/kernel/thread.h |2 +-
 include/cobalt/uapi/corectl.h  |   16 ++--
 include/cobalt/uapi/signal.h   |2 +-
 kernel/cobalt/Kconfig  |  168 +---
 kernel/cobalt/debug.c  |2 +-
 kernel/cobalt/posix/cond.c |5 +-
 kernel/cobalt/posix/mutex.c|   22 +++---
 kernel/cobalt/posix/sem.c  |   10 +--
 kernel/cobalt/posix/syscall.c  |   10 ++-
 kernel/cobalt/rtdm/core.c  |2 +-
 kernel/cobalt/rtdm/fd.c|5 +-
 kernel/cobalt/synch.c  |8 +-
 kernel/cobalt/thread.c |   26 ---
 kernel/drivers/Kconfig |3 +-
 lib/cobalt/internal.c  |4 +-
 lib/cobalt/thread.c|   29 +--
 17 files changed, 176 insertions(+), 144 deletions(-)

diff --git a/include/cobalt/kernel/synch.h b/include/cobalt/kernel/synch.h
index f53cd5e..ffb884a 100644
--- a/include/cobalt/kernel/synch.h
+++ b/include/cobalt/kernel/synch.h
@@ -101,14 +101,14 @@ static inline struct xnthread *xnsynch_owner(struct 
xnsynch *synch)
 #define xnsynch_owner_check(synch, thread) \
xnsynch_fast_owner_check((synch)-fastlock, thread-handle)
 
-#if XENO_DEBUG(USER)
+#if XENO_DEBUG(MUTEX_RELAXED)
 
 void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
  struct xnthread *sleeper);
 
 void xnsynch_detect_claimed_relax(struct xnthread *owner);
 
-#else /* !XENO_DEBUG(USER) */
+#else /* !XENO_DEBUG(MUTEX_RELAXED) */
 
 static inline void xnsynch_detect_relaxed_owner(struct xnsynch *synch,
  struct xnthread *sleeper)
@@ -119,7 +119,7 @@ static inline void xnsynch_detect_claimed_relax(struct 
xnthread *owner)
 {
 }
 
-#endif /* !XENO_DEBUG(USER) */
+#endif /* !XENO_DEBUG(MUTEX_RELAXED) */
 
 void xnsynch_init(struct xnsynch *synch, int flags,
  atomic_t *fastlock);
diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
index 8a9236a..1ba0c1b 100644
--- a/include/cobalt/kernel/thread.h
+++ b/include/cobalt/kernel/thread.h
@@ -503,7 +503,7 @@ static inline void xnthread_get_resource(struct xnthread 
*thread)
 static inline int xnthread_put_resource(struct xnthread *thread)
 {
if (xnthread_test_state(thread, XNWEAK) ||
-   IS_ENABLED(CONFIG_XENO_OPT_DEBUG_USER)) {
+   IS_ENABLED(CONFIG_XENO_OPT_DEBUG_MUTEX_SLEEP)) {
if (unlikely(thread-res_count == 0)) {
if (xnthread_test_state(thread, XNWARN))
xnthread_signal(thread, SIGDEBUG,
diff --git a/include/cobalt/uapi/corectl.h b/include/cobalt/uapi/corectl.h
index d2544b3..9466743 100644
--- a/include/cobalt/uapi/corectl.h
+++ b/include/cobalt/uapi/corectl.h
@@ -22,12 +22,16 @@
 #define _CC_COBALT_GET_NR_PIPES1
 #define _CC_COBALT_GET_NR_TIMERS   2
 
-#define _CC_COBALT_GET_DEBUG   3
-#   define _CC_COBALT_DEBUG_ASSERT 1
-#   define _CC_COBALT_DEBUG_CONTEXT2
-#   define _CC_COBALT_DEBUG_LOCKING4
-#   define _CC_COBALT_DEBUG_USER   8
-#   define _CC_COBALT_DEBUG_RELAX  16
+#define _CC_COBALT_GET_DEBUG   3
+#   define _CC_COBALT_DEBUG_ASSERT 1
+#   define _CC_COBALT_DEBUG_CONTEXT2
+#   define _CC_COBALT_DEBUG_LOCKING4
+#   define _CC_COBALT_DEBUG_USER   8
+#   define _CC_COBALT_DEBUG_MUTEX_RELAXED  16
+#   define _CC_COBALT_DEBUG_MUTEX_SLEEP32
+#   define _CC_COBALT_DEBUG_POSIX_SYNCHRO  64
+#   define _CC_COBALT_DEBUG_LEGACY 128
+#   define _CC_COBALT_DEBUG_TRACE_RELAX256
 
 #define _CC_COBALT_GET_POLICIES4
 #   define _CC_COBALT_SCHED_FIFO   1
diff --git a/include/cobalt/uapi/signal.h b/include/cobalt/uapi/signal.h
index 53e46ba..b5483d7 100644
--- a/include/cobalt/uapi/signal.h
+++ b/include/cobalt/uapi/signal.h
@@ -66,7 +66,7 @@
 #define SIGDEBUG_WATCHDOG  6
 #define SIGDEBUG_RESCNT_IMBALANCE  7
 #define SIGDEBUG_LOCK_BREAK8
-#define SIGDEBUG_RESCNT_SLEEP  9
+#define SIGDEBUG_MUTEX_SLEEP   9
 
 #define COBALT_DELAYMAX2147483647U
 
diff --git a/kernel/cobalt/Kconfig b/kernel/cobalt/Kconfig
index 27b4a4a..afa62d2 100644
--- a/kernel/cobalt/Kconfig