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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Feb 17 15:07:15 2015 +0100

cobalt/kernel: rebase assertion mechanism on BUG/WARN support

---

 include/cobalt/kernel/assert.h      |   93 ++++++++++---------------------
 include/cobalt/kernel/bheap.h       |    2 +-
 include/cobalt/kernel/rtdm/driver.h |    2 +-
 include/cobalt/kernel/sched.h       |    2 +-
 kernel/cobalt/Makefile              |    1 -
 kernel/cobalt/arch/x86/smi.c        |    4 +-
 kernel/cobalt/assert.c              |  103 -----------------------------------
 kernel/cobalt/clock.c               |    2 +-
 kernel/cobalt/heap.c                |   12 ++--
 kernel/cobalt/init.c                |    9 +--
 kernel/cobalt/posix/event.c         |    2 +-
 kernel/cobalt/posix/monitor.c       |    2 +-
 kernel/cobalt/posix/mutex.c         |    4 +-
 kernel/cobalt/posix/process.c       |   62 ++++++++++-----------
 kernel/cobalt/posix/signal.c        |    6 +-
 kernel/cobalt/posix/syscall.c       |   10 ++--
 kernel/cobalt/posix/thread.c        |    4 +-
 kernel/cobalt/posix/timer.c         |    2 +-
 kernel/cobalt/rtdm/core.c           |    2 +-
 kernel/cobalt/rtdm/device.c         |    8 +--
 kernel/cobalt/rtdm/drvlib.c         |    2 +-
 kernel/cobalt/rtdm/fd.c             |    6 +-
 kernel/cobalt/sched-quota.c         |   12 ++--
 kernel/cobalt/sched-sporadic.c      |    8 +--
 kernel/cobalt/sched-tp.c            |    4 +-
 kernel/cobalt/sched.c               |   16 +++---
 kernel/cobalt/synch.c               |   18 +++---
 kernel/cobalt/thread.c              |   26 +++++----
 kernel/cobalt/vfile.c               |    8 +--
 kernel/drivers/autotune/autotune.c  |    2 +-
 kernel/drivers/ipc/bufp.c           |    4 +-
 31 files changed, 147 insertions(+), 291 deletions(-)

diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
index 2318410..82d01a5 100644
--- a/include/cobalt/kernel/assert.h
+++ b/include/cobalt/kernel/assert.h
@@ -19,75 +19,40 @@
 #ifndef _COBALT_KERNEL_ASSERT_H
 #define _COBALT_KERNEL_ASSERT_H
 
+#include <linux/kconfig.h>
 #include <cobalt/kernel/trace.h>
 #include <cobalt/kernel/ancillaries.h>
 
-#define XENO_INFO  KERN_INFO    "[Xenomai] "
-#define XENO_WARN  KERN_WARNING "[Xenomai] "
-#define XENO_ERR   KERN_ERR     "[Xenomai] "
-
-#define XENO_DEBUG(__subsys)   \
-       (CONFIG_XENO_OPT_DEBUG_##__subsys > 0)
-
-#define XENO_ASSERT(__subsys, __cond)                                          
\
-       ({                                                                      
\
-               int __ret = !XENO_DEBUG(__subsys) || (__cond);                  
\
-               if (unlikely(!__ret))                                           
\
-                       __xnsys_assert_failed(__FILE__, __LINE__, (#__cond));   
\
-               __ret;                                                          
\
-       })
-
-#define XENO_BUGON(__subsys, __cond)                                   \
-       do {                                                            \
-               if (unlikely(XENO_DEBUG(__subsys) && (__cond)))         \
-                       xnsys_fatal("bug at %s:%d (%s)",                \
-                                   __FILE__, __LINE__, (#__cond));     \
-       } while (0)
-
-#define XENO_BUG(__subsys)  XENO_BUGON(__subsys, 1)
-
-#define XENO_WARNON(__subsys, __cond)                                  \
-       do {                                                            \
-               if (unlikely(XENO_DEBUG(__subsys) && (__cond)))         \
-                       printk(XENO_WARN "assertion failed at %s:%d (%s)", \
-                                   __FILE__, __LINE__, (#__cond));     \
-       } while (0)
-
-#ifndef CONFIG_XENO_OPT_DEBUG_COBALT
-#define CONFIG_XENO_OPT_DEBUG_COBALT   0
-#endif
-
-#ifndef CONFIG_XENO_OPT_DEBUG_CONTEXT
-#define CONFIG_XENO_OPT_DEBUG_CONTEXT  0
-#endif
-
-#ifndef CONFIG_XENO_OPT_DEBUG_LOCKING
-#define CONFIG_XENO_OPT_DEBUG_LOCKING  0
-#endif
-
-#ifndef CONFIG_XENO_OPT_DEBUG_USER
-#define CONFIG_XENO_OPT_DEBUG_USER     0
-#endif
-
-#define primary_mode_only()    XENO_BUGON(CONTEXT, ipipe_root_p)
-#define secondary_mode_only()  XENO_BUGON(CONTEXT, !ipipe_root_p)
-#define interrupt_only()       XENO_BUGON(CONTEXT, !xnsched_interrupt_p())
-#define realtime_cpu_only()    XENO_BUGON(CONTEXT, 
!xnsched_supported_cpu(ipipe_processor_id()))
-#define thread_only()          XENO_BUGON(CONTEXT, xnsched_interrupt_p())
+#define XENO_INFO      KERN_INFO    "[Xenomai] "
+#define XENO_WARNING   KERN_WARNING "[Xenomai] "
+#define XENO_ERR       KERN_ERR     "[Xenomai] "
+
+#define XENO_DEBUG(__subsys)                           \
+       IS_ENABLED(CONFIG_XENO_OPT_DEBUG_##__subsys)
+#define XENO_ASSERT(__subsys, __cond)                  \
+       (!WARN_ON(XENO_DEBUG(__subsys) && !(__cond)))
+#define XENO_BUG(__subsys)                             \
+       BUG_ON(XENO_DEBUG(__subsys))
+#define XENO_BUG_ON(__subsys, __cond)                  \
+       BUG_ON(XENO_DEBUG(__subsys) && (__cond))
+#define XENO_WARN(__subsys, __cond, __fmt...)          \
+       WARN(XENO_DEBUG(__subsys) && (__cond), __fmt)
+#define XENO_WARN_ON(__subsys, __cond)                 \
+       WARN_ON(XENO_DEBUG(__subsys) && (__cond))
+#define XENO_WARN_ON_ONCE(__subsys, __cond)            \
+       WARN_ON_ONCE(XENO_DEBUG(__subsys) && (__cond))
+
+#define primary_mode_only()    XENO_BUG_ON(CONTEXT, ipipe_root_p)
+#define secondary_mode_only()  XENO_BUG_ON(CONTEXT, !ipipe_root_p)
+#define interrupt_only()       XENO_BUG_ON(CONTEXT, !xnsched_interrupt_p())
+#define realtime_cpu_only()    XENO_BUG_ON(CONTEXT, 
!xnsched_supported_cpu(ipipe_processor_id()))
+#define thread_only()          XENO_BUG_ON(CONTEXT, xnsched_interrupt_p())
 #if XENO_DEBUG(LOCKING)
-#define atomic_only()          XENO_BUGON(CONTEXT, (xnlock_is_owner(&nklock) 
&& hard_irqs_disabled()) == 0)
-#define preemptible_only()     XENO_BUGON(CONTEXT, xnlock_is_owner(&nklock) || 
hard_irqs_disabled())
+#define atomic_only()          XENO_BUG_ON(CONTEXT, (xnlock_is_owner(&nklock) 
&& hard_irqs_disabled()) == 0)
+#define preemptible_only()     XENO_BUG_ON(CONTEXT, xnlock_is_owner(&nklock) 
|| hard_irqs_disabled())
 #else
-#define atomic_only()          XENO_BUGON(CONTEXT, hard_irqs_disabled() == 0)
-#define preemptible_only()     XENO_BUGON(CONTEXT, hard_irqs_disabled() != 0)
+#define atomic_only()          XENO_BUG_ON(CONTEXT, hard_irqs_disabled() == 0)
+#define preemptible_only()     XENO_BUG_ON(CONTEXT, hard_irqs_disabled() != 0)
 #endif
 
-void __xnsys_assert_failed(const char *file, int line, const char *msg);
-
-void __xnsys_fatal(const char *format, ...);
-
-#define xnsys_fatal(__fmt, __args...) nkpanic(KERN_ERR __fmt, ##__args)
-
-extern void (*nkpanic)(const char *format, ...);
-
 #endif /* !_COBALT_KERNEL_ASSERT_H */
diff --git a/include/cobalt/kernel/bheap.h b/include/cobalt/kernel/bheap.h
index e04e694..4506c2a 100644
--- a/include/cobalt/kernel/bheap.h
+++ b/include/cobalt/kernel/bheap.h
@@ -63,7 +63,7 @@ static inline int bheap_ordered(bheap_t *heap)
 }
 
 #define BHEAP_CHECK(heap)                                              \
-       XENO_BUGON(COBALT, ((heap)->sz == 0) || !bheap_ordered(heap))
+       XENO_BUG_ON(COBALT, ((heap)->sz == 0) || !bheap_ordered(heap))
 
 #define bheap_gethead(heap)                            \
        ({                                              \
diff --git a/include/cobalt/kernel/rtdm/driver.h 
b/include/cobalt/kernel/rtdm/driver.h
index 6faa8bd..b2087f1 100644
--- a/include/cobalt/kernel/rtdm/driver.h
+++ b/include/cobalt/kernel/rtdm/driver.h
@@ -551,7 +551,7 @@ static inline void rtdm_lock_init(rtdm_lock_t *lock)
  */
 static inline void rtdm_lock_get(rtdm_lock_t *lock)
 {
-       XENO_BUGON(COBALT, !spltest());
+       XENO_BUG_ON(COBALT, !spltest());
        spin_lock(lock);
        __xnsched_lock();
 }
diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index b7a4365..c9b86fb 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -394,7 +394,7 @@ int xnsched_maybe_resched_after_unlocked_switch(struct 
xnsched *sched)
 static inline struct xnsched *
 xnsched_finish_unlocked_switch(struct xnsched *sched)
 {
-       XENO_BUGON(COBALT, !hard_irqs_disabled());
+       XENO_BUG_ON(COBALT, !hard_irqs_disabled());
        return xnsched_current();
 }
 
diff --git a/kernel/cobalt/Makefile b/kernel/cobalt/Makefile
index eb2a509..a8c799b 100644
--- a/kernel/cobalt/Makefile
+++ b/kernel/cobalt/Makefile
@@ -2,7 +2,6 @@ obj-$(CONFIG_XENOMAI) += xenomai.o rtdm/ posix/
 
 xenomai-y :=   apc.o           \
                arith.o         \
-               assert.o        \
                bufd.o          \
                clock.o         \
                heap.o          \
diff --git a/kernel/cobalt/arch/x86/smi.c b/kernel/cobalt/arch/x86/smi.c
index f3e6b4d..cc38f17 100644
--- a/kernel/cobalt/arch/x86/smi.c
+++ b/kernel/cobalt/arch/x86/smi.c
@@ -75,7 +75,7 @@ void mach_x86_smi_disable(void)
        mask_bits(smi_masked_bits, smi_en_addr);
 
        if (inl(smi_en_addr) & smi_masked_bits)
-               printk(XENO_WARN "SMI workaround failed!\n");
+               printk(XENO_WARNING "SMI workaround failed!\n");
        else
                printk(XENO_INFO "SMI workaround enabled\n");
 
@@ -122,7 +122,7 @@ void mach_x86_smi_init(void)
        }
 
        if (smi_state == 0) {
-               printk(XENO_WARN "SMI-enabled chipset found, but SMI workaround 
disabled\n"
+               printk(XENO_WARNING "SMI-enabled chipset found, but SMI 
workaround disabled\n"
                       "          (see xenomai.smi parameter). You might 
encounter\n"
                       "          high latencies!\n");
                pci_dev_put(dev);
diff --git a/kernel/cobalt/assert.c b/kernel/cobalt/assert.c
deleted file mode 100644
index 09a94d2..0000000
--- a/kernel/cobalt/assert.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2013 Philippe Gerum <r...@xenomai.org>.
- *
- * Xenomai is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * Xenomai is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Xenomai; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-#include <stdarg.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <cobalt/kernel/sched.h>
-#include <cobalt/kernel/assert.h>
-#include <cobalt/kernel/clock.h>
-
-void (*nkpanic)(const char *format, ...) = panic;
-EXPORT_SYMBOL_GPL(nkpanic);
-
-void __xnsys_fatal(const char *format, ...)
-{
-       struct xnthread *thread;
-       struct xnsched *sched;
-       static int oopsed;
-       unsigned int cpu;
-       char pbuf[16];
-       xnticks_t now;
-       va_list ap;
-       int cprio;
-       spl_t s;
-
-       xntrace_panic_freeze();
-       ipipe_prepare_panic();
-
-       xnlock_get_irqsave(&nklock, s);
-
-       if (oopsed)
-               goto out;
-
-       oopsed = 1;
-       va_start(ap, format);
-       vprintk(format, ap);
-       va_end(ap);
-
-       now = xnclock_read_monotonic(&nkclock);
-
-       printk(KERN_ERR "\n %-3s  %-6s %-8s %-8s %-8s  %s\n",
-              "CPU", "PID", "PRI", "TIMEOUT", "STAT", "NAME");
-
-       /*
-        * NOTE: &nkthreadq can't be empty, we have the root thread(s)
-        * linked there at least.
-        */
-       for_each_online_cpu(cpu) {
-               sched = xnsched_struct(cpu);
-               list_for_each_entry(thread, &nkthreadq, glink) {
-                       if (thread->sched != sched)
-                               continue;
-                       cprio = xnthread_current_priority(thread);
-                       ksformat(pbuf, sizeof(pbuf), "%3d", cprio);
-                       printk(KERN_ERR "%c%3u  %-6d %-8s %-8Lu %.8x  %s\n",
-                              thread == sched->curr ? '>' : ' ',
-                              cpu,
-                              xnthread_host_pid(thread),
-                              pbuf,
-                              xnthread_get_timeout(thread, now),
-                              xnthread_get_state(thread),
-                              thread->name);
-               }
-       }
-
-       printk(KERN_ERR "Master time base: clock=%Lu\n",
-              xnclock_read_raw(&nkclock));
-#ifdef CONFIG_SMP
-       printk(KERN_ERR "Current CPU: #%d\n", ipipe_processor_id());
-#endif
-out:
-       xnlock_put_irqrestore(&nklock, s);
-
-       show_stack(NULL,NULL);
-       xntrace_panic_dump();
-       for (;;)
-               cpu_relax();
-}
-EXPORT_SYMBOL_GPL(__xnsys_fatal);
-
-void __xnsys_assert_failed(const char *file, int line, const char *msg)
-{
-       xntrace_panic_freeze();
-       printk(XENO_ERR "assertion failed at %s:%d (%s)\n",
-              file, line, msg);
-       xntrace_panic_dump();
-}
-EXPORT_SYMBOL_GPL(__xnsys_assert_failed);
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 24cb9a4..9338e67 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -648,7 +648,7 @@ void xnclock_deregister(struct xnclock *clock)
 
        for_each_online_cpu(cpu) {
                tmd = xnclock_percpu_timerdata(clock, cpu);
-               XENO_BUGON(COBALT, !xntimerq_empty(&tmd->q));
+               XENO_BUG_ON(COBALT, !xntimerq_empty(&tmd->q));
                xntimerq_destroy(&tmd->q);
        }
 
diff --git a/kernel/cobalt/heap.c b/kernel/cobalt/heap.c
index 6c9fdb0..70f1c8f 100644
--- a/kernel/cobalt/heap.c
+++ b/kernel/cobalt/heap.c
@@ -348,7 +348,7 @@ splitpage:
                 * size, building a free list of free blocks.
                 */
                for (block = headpage, eblock =
-                    headpage + XNHEAP_PAGESZ - bsize; block < eblock;
+                            headpage + XNHEAP_PAGESZ - bsize; block < eblock;
                     block += bsize)
                        *((caddr_t *)block) = block + bsize;
 
@@ -450,8 +450,8 @@ void *xnheap_alloc(struct xnheap *heap, u32 size)
                } else {
                        if (bsize <= XNHEAP_PAGESZ)
                                --heap->buckets[ilog].fcount;
-                       XENO_BUGON(COBALT, (caddr_t)block < heap->membase ||
-                                  (caddr_t)block >= heap->memlim);
+                       XENO_BUG_ON(COBALT, (caddr_t)block < heap->membase ||
+                                   (caddr_t)block >= heap->memlim);
                        pagenum = ((caddr_t)block - heap->membase) / 
XNHEAP_PAGESZ;
                        ++heap->pagemap[pagenum].bcount;
                }
@@ -522,7 +522,7 @@ void xnheap_free(struct xnheap *heap, void *block)
        free_page_list:
                /* Link all freed pages in a single sub-list. */
                for (freepage = (caddr_t) block,
-                    tailpage = (caddr_t) block + bsize - XNHEAP_PAGESZ;
+                            tailpage = (caddr_t) block + bsize - XNHEAP_PAGESZ;
                     freepage < tailpage; freepage += XNHEAP_PAGESZ)
                        *((caddr_t *) freepage) = freepage + XNHEAP_PAGESZ;
 
@@ -538,7 +538,7 @@ void xnheap_free(struct xnheap *heap, void *block)
                for (nextpage = heap->freelist, lastpage = NULL;
                     nextpage != NULL && nextpage < (caddr_t) block;
                     lastpage = nextpage, nextpage = *((caddr_t *)nextpage))
-                 ;     /* Loop */
+                       ;       /* Loop */
 
                *((caddr_t *)tailpage) = nextpage;
 
@@ -586,7 +586,7 @@ void xnheap_free(struct xnheap *heap, void *block)
                nextpage = freepage + XNHEAP_PAGESZ;
                nblocks = XNHEAP_PAGESZ >> log2size;
                heap->buckets[ilog].fcount -= (nblocks - 1);
-               XENO_BUGON(COBALT, heap->buckets[ilog].fcount < 0);
+               XENO_BUG_ON(COBALT, heap->buckets[ilog].fcount < 0);
 
                /*
                 * Still easy case: all free blocks are laid on a
diff --git a/kernel/cobalt/init.c b/kernel/cobalt/init.c
index d47ecec..bfa63a2 100644
--- a/kernel/cobalt/init.c
+++ b/kernel/cobalt/init.c
@@ -258,7 +258,7 @@ static struct {
 static int __init setup_init_state(char *s)
 {
        static char warn_bad_state[] __initdata =
-               XENO_WARN "invalid init state '%s'\n";
+               XENO_WARNING "invalid init state '%s'\n";
        int n;
 
        for (n = 0; n < ARRAY_SIZE(init_states); n++)
@@ -303,9 +303,6 @@ static __init int sys_init(void)
 
        xnregistry_init();
 
-       nkpanic = __xnsys_fatal;
-       smp_wmb();
-
        /*
         * If starting in stopped mode, do all initializations, but do
         * not enable the core timer.
@@ -327,7 +324,7 @@ static int __init xenomai_init(void)
        int ret, __maybe_unused cpu;
 
        if (!realtime_core_enabled()) {
-               printk(XENO_WARN "disabled on kernel command line\n");
+               printk(XENO_WARNING "disabled on kernel command line\n");
                return 0;
        }
 
@@ -338,7 +335,7 @@ static int __init xenomai_init(void)
                        cpu_set(cpu, xnsched_realtime_cpus);
        }
        if (cpumask_empty(&xnsched_realtime_cpus)) {
-               printk(XENO_WARN "disabled via empty real-time CPU mask\n");
+               printk(XENO_WARNING "disabled via empty real-time CPU mask\n");
                set_realtime_core_state(COBALT_STATE_DISABLED);
                return 0;
        }
diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index 372e253..2366a4c 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -97,7 +97,7 @@ COBALT_SYSCALL(event_init, current,
        state->flags = 0;
        state->nwaiters = 0;
        stateoff = cobalt_umm_offset(umm, state);
-       XENO_BUGON(COBALT, stateoff != (__u32)stateoff);
+       XENO_BUG_ON(COBALT, stateoff != (__u32)stateoff);
        shadow.flags = flags;
        shadow.handle = event->handle;
        shadow.state_offset = (__u32)stateoff;
diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index 476050a..5df5604 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -101,7 +101,7 @@ COBALT_SYSCALL(monitor_init, current,
 
        state->flags = 0;
        stateoff = cobalt_umm_offset(umm, state);
-       XENO_BUGON(COBALT, stateoff != (__u32)stateoff);
+       XENO_BUG_ON(COBALT, stateoff != (__u32)stateoff);
        shadow.flags = flags;
        shadow.handle = mon->handle;
        shadow.state_offset = (__u32)stateoff;
diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index 80af511..43620c5 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -74,7 +74,7 @@ cobalt_mutex_destroy_inner(xnhandle_t handle, struct 
cobalt_kqueues *q)
        mutex = xnregistry_lookup(handle, NULL);
        if (!cobalt_obj_active(mutex, COBALT_MUTEX_MAGIC, typeof(*mutex))) {
                xnlock_put_irqrestore(&nklock, s);
-               printk(XENO_WARN "mutex_destroy: invalid mutex %x\n",
+               printk(XENO_WARNING "mutex_destroy: invalid mutex %x\n",
                        mutex ? mutex->magic : ~0);
                return;
        }
@@ -204,7 +204,7 @@ redo:
        case PTHREAD_MUTEX_NORMAL:
                /* Attempting to relock a normal mutex, deadlock. */
 #if XENO_DEBUG(USER)
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "thread %s deadlocks on non-recursive mutex\n",
                       curr->name);
 #endif
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index 07b011f..7fedf43 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -194,7 +194,7 @@ static void remove_process(struct cobalt_process *process)
                __clear_bit(personality->xid, &process->permap);
                personality->ops.detach_process(priv);
                atomic_dec(&personality->refcnt);
-               XENO_ASSERT(COBALT, atomic_read(&personality->refcnt) >= 0);
+               XENO_WARN_ON(COBALT, atomic_read(&personality->refcnt) < 0);
                if (personality->module)
                        module_put(personality->module);
        }
@@ -721,7 +721,7 @@ static inline int handle_exception(struct ipipe_trap_data 
*d)
 #if XENO_DEBUG(COBALT) || XENO_DEBUG(USER)
        if (!user_mode(d->regs)) {
                xntrace_panic_freeze();
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "switching %s to secondary mode after exception #%u in "
                       "kernel-space at 0x%lx (pid %d)\n", thread->name,
                       xnarch_fault_trap(d),
@@ -729,7 +729,7 @@ static inline int handle_exception(struct ipipe_trap_data 
*d)
                       xnthread_host_pid(thread));
                xntrace_panic_dump();
        } else if (xnarch_fault_notify(d)) /* Don't report debug traps */
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "switching %s to secondary mode after exception #%u from 
"
                       "user-space at 0x%lx (pid %d)\n", thread->name,
                       xnarch_fault_trap(d),
@@ -756,7 +756,7 @@ static int handle_mayday_event(struct pt_regs *regs)
        struct xnarchtcb *tcb = xnthread_archtcb(thread);
        struct cobalt_ppd *sys_ppd;
 
-       XENO_BUGON(COBALT, !xnthread_test_state(thread, XNUSER));
+       XENO_BUG_ON(COBALT, !xnthread_test_state(thread, XNUSER));
 
        /* We enter the mayday handler with hw IRQs off. */
        sys_ppd = cobalt_ppd_get(0);
@@ -825,7 +825,7 @@ static int handle_setaffinity_event(struct 
ipipe_cpu_migration_data *d)
         * mode then switches back to it, in SMP configurations.
         */
        if (cpus_empty(thread->affinity))
-               printk(XENO_WARN "thread %s[%d] changed CPU affinity 
inconsistently\n",
+               printk(XENO_WARNING "thread %s[%d] changed CPU affinity 
inconsistently\n",
                       thread->name, xnthread_host_pid(thread));
        else {
                xnlock_get_irqsave(&nklock, s);
@@ -863,7 +863,7 @@ static inline void check_affinity(struct task_struct *p) /* 
nklocked, IRQs off *
         * hopeless, whine and kill that thread asap.
         */
        if (!xnsched_supported_cpu(cpu)) {
-               printk(XENO_WARN "thread %s[%d] switched to non-rt CPU%d, 
aborted.\n",
+               printk(XENO_WARNING "thread %s[%d] switched to non-rt CPU%d, 
aborted.\n",
                       thread->name, xnthread_host_pid(thread), cpu);
                /*
                 * Can't call xnthread_cancel() from a migration
@@ -983,7 +983,7 @@ static inline void lock_timers(void)
 
 static inline void unlock_timers(void)
 {
-       XENO_BUGON(COBALT, atomic_read(&nkclklk) == 0);
+       XENO_BUG_ON(COBALT, atomic_read(&nkclklk) == 0);
        smp_mb__before_atomic();
        atomic_dec(&nkclklk);
        smp_mb__after_atomic();
@@ -1001,7 +1001,7 @@ static int handle_taskexit_event(struct task_struct *p) 
/* p == current */
        secondary_mode_only();
 
        thread = xnthread_current();
-       XENO_BUGON(COBALT, thread == NULL);
+       XENO_BUG_ON(COBALT, thread == NULL);
        trace_cobalt_shadow_unmap(thread);
 
        if (xnthread_test_state(thread, XNDEBUG))
@@ -1089,31 +1089,25 @@ static int handle_schedule_event(struct task_struct 
*next_task)
        }
 
 no_ptrace:
-       if (XENO_DEBUG(COBALT)) {
-               if (!xnthread_test_state(next, XNRELAX)) {
-                       xntrace_panic_freeze();
-                       show_stack(xnthread_host_task(next), NULL);
-                       xnsys_fatal
-                               ("hardened thread %s[%d] running in Linux 
domain?! "
-                                "(status=0x%x, sig=%d, prev=%s[%d])",
-                                next->name, next_task->pid, 
xnthread_get_state(next),
-                                signal_pending(next_task), prev_task->comm, 
prev_task->pid);
-               } else if (!(next_task->ptrace & PT_PTRACED) &&
-                          /*
-                           * Allow ptraced threads to run shortly in order to
-                           * properly recover from a stopped state.
-                           */
+       /*
+        * Do basic sanity checks on the incoming thread state.
+        * NOTE: we allow ptraced threads to run shortly in order to
+        * properly recover from a stopped state.
+        */
+       if (!XENO_WARN(COBALT, !xnthread_test_state(next, XNRELAX),
+                      "hardened thread %s[%d] running in Linux domain?! "
+                      "(status=0x%x, sig=%d, prev=%s[%d])",
+                      next->name, next_task->pid, xnthread_get_state(next),
+                      signal_pending(next_task), prev_task->comm, 
prev_task->pid))
+               XENO_WARN(COBALT,
+                         !(next_task->ptrace & PT_PTRACED) &&
                           !xnthread_test_state(next, XNDORMANT)
-                          && xnthread_test_state(next, XNPEND)) {
-                       xntrace_panic_freeze();
-                       show_stack(xnthread_host_task(next), NULL);
-                       xnsys_fatal
-                               ("blocked thread %s[%d] rescheduled?! "
-                                "(status=0x%x, sig=%d, prev=%s[%d])",
-                                next->name, next_task->pid, 
xnthread_get_state(next),
-                                signal_pending(next_task), prev_task->comm, 
prev_task->pid);
-               }
-       }
+                         && xnthread_test_state(next, XNPEND),
+                         "blocked thread %s[%d] rescheduled?! "
+                         "(status=0x%x, sig=%d, prev=%s[%d])",
+                         next->name, next_task->pid, xnthread_get_state(next),
+                         signal_pending(next_task), prev_task->comm,
+                         prev_task->pid);
 out:
        return KEVENT_PROPAGATE;
 }
@@ -1279,7 +1273,7 @@ static int attach_process(struct cobalt_process *process)
 
        p->mayday_tramp = map_mayday_page();
        if (p->mayday_tramp == 0) {
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "%s[%d] cannot map MAYDAY page\n",
                       current->comm, current->pid);
                ret = -ENOMEM;
@@ -1288,7 +1282,7 @@ static int attach_process(struct cobalt_process *process)
 
        exe_path = get_exe_path(current);
        if (IS_ERR(exe_path)) {
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "%s[%d] can't find exe path\n",
                       current->comm, current->pid);
                exe_path = NULL; /* Not lethal, but weird. */
diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c
index 993849d..91986b2 100644
--- a/kernel/cobalt/posix/signal.c
+++ b/kernel/cobalt/posix/signal.c
@@ -47,7 +47,7 @@ static int cobalt_signal_deliver(struct cobalt_thread *thread,
        int sig, ret;
 
        sig = sigp->si.si_signo;
-       XENO_BUGON(COBALT, sig < 1 || sig > _NSIG);
+       XENO_BUG_ON(COBALT, sig < 1 || sig > _NSIG);
 
        /*
         * Attempt to deliver the signal immediately to the initial
@@ -152,7 +152,7 @@ struct cobalt_sigpending *cobalt_signal_alloc(void)
 
        if (list_empty(&sigpending_pool)) {
                if (printk_ratelimit())
-                       printk(XENO_WARN "signal bucket pool underflows\n");
+                       printk(XENO_WARNING "signal bucket pool underflows\n");
                return NULL;
        }
 
@@ -216,7 +216,7 @@ static int signal_wait(sigset_t *set, xnticks_t timeout,
        spl_t s;
 
        curr = cobalt_current_thread();
-       XENO_BUGON(COBALT, curr == NULL);
+       XENO_BUG_ON(COBALT, curr == NULL);
 
        if (u_si && !access_wok(u_si, sizeof(*u_si)))
                return -EFAULT;
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 34b9ddd..16d0101 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -253,7 +253,7 @@ static COBALT_SYSCALL(mayday, oneway, (void))
 
        cur = xnthread_current();
        if (cur == NULL) {
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "MAYDAY received from invalid context %s[%d]\n",
                       current->comm, current->pid);
                return -EPERM;
@@ -454,7 +454,7 @@ static int stop_services(const void __user *u_buf, size_t 
u_bufsz)
                /* Kill lingering RTDM tasks. */
                ret = xnthread_killall(final_grace_period, 0);
                if (ret == -EAGAIN)
-                       printk(XENO_WARN "some RTDM tasks won't stop");
+                       printk(XENO_WARNING "some RTDM tasks won't stop");
                xntimer_release_hardware();
                set_realtime_core_state(COBALT_STATE_STOPPED);
                printk(XENO_INFO "services stopped\n");
@@ -852,7 +852,7 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
         */
        if (unlikely(!allowed_syscall(process, thread, sysflags, nr))) {
                if (XENO_DEBUG(COBALT))
-                       printk(XENO_WARN
+                       printk(XENO_WARNING
                               "syscall <%d> denied to %s[%d]\n",
                               nr, current->comm, current->pid);
                __xn_error_return(regs, -EPERM);
@@ -986,7 +986,7 @@ linux_syscall:
        return KEVENT_PROPAGATE;
 
 bad_syscall:
-       printk(XENO_WARN "bad syscall <%#lx>\n", __xn_syscall(regs));
+       printk(XENO_WARNING "bad syscall <%#lx>\n", __xn_syscall(regs));
 
        __xn_error_return(regs, -ENOSYS);
 
@@ -1110,7 +1110,7 @@ int ipipe_fastcall_hook(struct pt_regs *regs)
        int ret;
 
        ret = handle_head_syscall(&xnsched_realtime_domain, regs);
-       XENO_BUGON(COBALT, ret == KEVENT_PROPAGATE);
+       XENO_BUG_ON(COBALT, ret == KEVENT_PROPAGATE);
 
        return ret;
 }
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 6f3f0cf..a106292 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -129,7 +129,7 @@ static inline void thread_unhash(const struct 
cobalt_local_hkey *hkey)
                gslot = *gtail;
        }
        /* gslot must be found here. */
-       XENO_BUGON(COBALT, !(gslot && gtail));
+       XENO_BUG_ON(COBALT, !(gslot && gtail));
        *gtail = gslot->next;
 
        xnlock_put_irqrestore(&nklock, s);
@@ -204,7 +204,7 @@ void cobalt_thread_map(struct xnthread *curr)
 
        thread = container_of(curr, struct cobalt_thread, threadbase);
        thread->process = cobalt_current_process();
-       XENO_BUGON(COBALT, thread->process == NULL);
+       XENO_BUG_ON(COBALT, thread->process == NULL);
 }
 
 struct xnthread_personality *cobalt_thread_exit(struct xnthread *curr)
diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index ac265cc..7ef61c3 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -381,7 +381,7 @@ int __cobalt_timer_settime(timer_t timerid, int flags,
        spl_t s;
 
        cc = cobalt_current_process();
-       XENO_BUGON(COBALT, cc == NULL);
+       XENO_BUG_ON(COBALT, cc == NULL);
 
        xnlock_get_irqsave(&nklock, s);
 
diff --git a/kernel/cobalt/rtdm/core.c b/kernel/cobalt/rtdm/core.c
index 77cc335..d00b0c4 100644
--- a/kernel/cobalt/rtdm/core.c
+++ b/kernel/cobalt/rtdm/core.c
@@ -106,7 +106,7 @@ open_devnode(struct rtdm_device *dev, const char *path, int 
oflag)
 
 #ifdef CONFIG_XENO_OPT_DEBUG_USER
        if (strncmp(path, "/dev/rtdm/", 10))
-               printk(XENO_WARN
+               printk(XENO_WARNING
                       "%s[%d] opens obsolete device path: %s\n",
                       current->comm, current->pid, path);
 #endif
diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index 620748a..1c602c2 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -241,7 +241,7 @@ static int state_change_notifier(struct notifier_block *nb,
                        return NOTIFY_DONE;
                ret = drv->smops.start(drv);
                if (ret)
-                       printk(XENO_WARN
+                       printk(XENO_WARNING
                               "failed starting driver %s (%d)\n",
                               drv->profile_info.name, ret);
                break;
@@ -250,7 +250,7 @@ static int state_change_notifier(struct notifier_block *nb,
                        return NOTIFY_DONE;
                ret = drv->smops.stop(drv);
                if (ret)
-                       printk(XENO_WARN
+                       printk(XENO_WARNING
                               "failed stopping driver %s (%d)\n",
                               drv->profile_info.name, ret);
                break;
@@ -291,7 +291,7 @@ static int register_driver(struct rtdm_driver *drv)
        ret = alloc_chrdev_region(&rdev, 0, drv->device_count,
                                  drv->profile_info.name);
        if (ret) {
-               printk(XENO_WARN "cannot allocate chrdev region %s[0..%d]\n",
+               printk(XENO_WARNING "cannot allocate chrdev region %s[0..%d]\n",
                       drv->profile_info.name, drv->device_count - 1);
                return ret;
        }
@@ -319,7 +319,7 @@ fail_cdev:
 
 static void unregister_driver(struct rtdm_driver *drv)
 {
-       XENO_BUGON(COBALT, drv->profile_info.magic != RTDM_CLASS_MAGIC);
+       XENO_BUG_ON(COBALT, drv->profile_info.magic != RTDM_CLASS_MAGIC);
 
        if (!atomic_dec_and_test(&drv->refcount))
                return;
diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
index fcc0c58..329bf18 100644
--- a/kernel/cobalt/rtdm/drvlib.c
+++ b/kernel/cobalt/rtdm/drvlib.c
@@ -599,7 +599,7 @@ int device_service_routine(...)
  */
 void rtdm_toseq_init(rtdm_toseq_t *timeout_seq, nanosecs_rel_t timeout)
 {
-       XENO_ASSERT(COBALT, !xnsched_unblockable_p()); /* only warn here */
+       XENO_WARN_ON(COBALT, xnsched_unblockable_p()); /* only warn here */
 
        *timeout_seq = xnclock_read_monotonic(&nkclock) + timeout;
 }
diff --git a/kernel/cobalt/rtdm/fd.c b/kernel/cobalt/rtdm/fd.c
index 95d8120..7f35ea3 100644
--- a/kernel/cobalt/rtdm/fd.c
+++ b/kernel/cobalt/rtdm/fd.c
@@ -128,7 +128,7 @@ static inline void set_compat_bit(struct rtdm_fd *fd)
                fd->compat = 0;
        else {
                regs = task_pt_regs(current);
-               XENO_BUGON(COBALT, !__xn_syscall_p(regs));
+               XENO_BUG_ON(COBALT, !__xn_syscall_p(regs));
                fd->compat = __COBALT_CALL_COMPAT(__xn_reg_sys(regs));
        }
 }
@@ -352,7 +352,7 @@ void rtdm_fd_unlock(struct rtdm_fd *fd)
 
        xnlock_get_irqsave(&fdtree_lock, s);
        /* Warn if fd was unreferenced. */
-       XENO_ASSERT(COBALT, fd->refs > 0);
+       XENO_WARN_ON(COBALT, fd->refs <= 0);
        __put_fd(fd, s);
 }
 EXPORT_SYMBOL_GPL(rtdm_fd_unlock);
@@ -733,7 +733,7 @@ void rtdm_fd_init(void)
 static inline void warn_user(const char *name)
 {
 #ifdef CONFIG_XENO_OPT_DEBUG_USER
-       printk(XENO_WARN "%s[%d] called regular %s() with RTDM file/socket\n",
+       printk(XENO_WARNING "%s[%d] called regular %s() with RTDM 
file/socket\n",
               current->comm, current->pid, name + 5);
 #endif
 }
diff --git a/kernel/cobalt/sched-quota.c b/kernel/cobalt/sched-quota.c
index 71e2c36..d0c9ac8 100644
--- a/kernel/cobalt/sched-quota.c
+++ b/kernel/cobalt/sched-quota.c
@@ -152,7 +152,7 @@ static void quota_refill_handler(struct xntimer *timer)
        struct xnsched *sched;
 
        qs = container_of(timer, struct xnsched_quota, refill_timer);
-       XENO_BUGON(COBALT, list_empty(&qs->groups));
+       XENO_BUG_ON(COBALT, list_empty(&qs->groups));
        sched = container_of(qs, struct xnsched, quota);
 
        list_for_each_entry(tg, &qs->groups, next) {
@@ -276,9 +276,9 @@ static void xnsched_quota_trackprio(struct xnthread *thread,
 {
        if (p) {
                /* We should not cross groups during PIP boost. */
-               XENO_WARNON(COBALT,
-                          thread->base_class == &xnsched_class_quota &&
-                          thread->quota->tgid != p->quota.tgid);
+               XENO_WARN_ON(COBALT,
+                            thread->base_class == &xnsched_class_quota &&
+                            thread->quota->tgid != p->quota.tgid);
                thread->cprio = p->quota.prio;
        } else
                thread->cprio = thread->bprio;
@@ -322,7 +322,7 @@ static int xnsched_quota_declare(struct xnthread *thread,
 static void xnsched_quota_forget(struct xnthread *thread)
 {
        thread->quota->nr_threads--;
-       XENO_BUGON(COBALT, thread->quota->nr_threads < 0);
+       XENO_BUG_ON(COBALT, thread->quota->nr_threads < 0);
        list_del(&thread->quota_next);
        thread->quota = NULL;
 }
@@ -454,7 +454,7 @@ pick:
                list_add_tail(&next->quota_expired, &tg->expired);
                goto pick;
        }
- out:
+out:
        tg->nr_active--;
 
        return next;
diff --git a/kernel/cobalt/sched-sporadic.c b/kernel/cobalt/sched-sporadic.c
index f1a602a..a101308 100644
--- a/kernel/cobalt/sched-sporadic.c
+++ b/kernel/cobalt/sched-sporadic.c
@@ -34,7 +34,7 @@ static inline void sporadic_note_late_drop(struct xnsched 
*sched)
         * hundred times in a row. This normally reveals a time budget
         * which is too tight.
         */
-       XENO_BUGON(COBALT, ++sched->pss.drop_retries > 100);
+       XENO_BUG_ON(COBALT, ++sched->pss.drop_retries > 100);
 }
 
 static inline void sporadic_note_valid_drop(struct xnsched *sched)
@@ -42,7 +42,7 @@ static inline void sporadic_note_valid_drop(struct xnsched 
*sched)
        sched->pss.drop_retries = 0;
 }
 
-#else /* !XENO_BUGON(COBALT) */
+#else /* !XENO_DEBUG(COBALT) */
 
 static inline void sporadic_note_late_drop(struct xnsched *sched)
 {
@@ -52,7 +52,7 @@ static inline void sporadic_note_valid_drop(struct xnsched 
*sched)
 {
 }
 
-#endif /* !XENO_BUGON(COBALT) */
+#endif /* !XENO_DEBUG(COBALT) */
 
 static inline xnticks_t sporadic_diff_time(xnticks_t start, xnticks_t end)
 {
@@ -125,7 +125,7 @@ static void sporadic_replenish_handler(struct xntimer 
*timer)
 
        pss = container_of(timer, struct xnsched_sporadic_data, repl_timer);
        thread = pss->thread;
-       XENO_BUGON(COBALT, pss->repl_pending <= 0);
+       XENO_BUG_ON(COBALT, pss->repl_pending <= 0);
 
 retry:
        now = xnclock_read_monotonic(&nkclock);
diff --git a/kernel/cobalt/sched-tp.c b/kernel/cobalt/sched-tp.c
index 774c3b7..b088cf4 100644
--- a/kernel/cobalt/sched-tp.c
+++ b/kernel/cobalt/sched-tp.c
@@ -147,7 +147,7 @@ static void xnsched_tp_trackprio(struct xnthread *thread,
         */
        if (p) {
                /* We should never cross partition boundaries. */
-               XENO_WARNON(COBALT,
+               XENO_WARN_ON(COBALT,
                           thread->base_class == &xnsched_class_tp &&
                           thread->tps - thread->sched->tp.partitions != 
p->tp.ptid);
                thread->cprio = p->tp.prio;
@@ -243,7 +243,7 @@ xnsched_tp_set_schedule(struct xnsched *sched,
        union xnsched_policy_param param;
        struct xnthread *thread, *tmp;
 
-       XENO_BUGON(COBALT, gps != NULL &&
+       XENO_BUG_ON(COBALT, gps != NULL &&
                   (gps->pwin_nr <= 0 || gps->pwins[0].w_offset != 0));
 
        xnsched_tp_stop_schedule(sched);
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index f828da4..a6469db 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -63,7 +63,7 @@ static void xnsched_register_class(struct xnsched_class 
*sched_class)
         * Classes shall be registered by increasing priority order,
         * idle first and up.
         */
-       XENO_BUGON(COBALT, sched_class->next &&
+       XENO_BUG_ON(COBALT, sched_class->next &&
                   sched_class->next->weight > sched_class->weight);
 
        printk(XENO_INFO "scheduling class %s registered.\n", 
sched_class->name);
@@ -120,11 +120,11 @@ static void watchdog_handler(struct xntimer *timer)
        trace_cobalt_watchdog_signal(curr);
 
        if (xnthread_test_state(curr, XNUSER)) {
-               printk(XENO_WARN "watchdog triggered on CPU #%d -- runaway 
thread "
+               printk(XENO_WARNING "watchdog triggered on CPU #%d -- runaway 
thread "
                       "'%s' signaled\n", xnsched_cpu(sched), curr->name);
                xnthread_call_mayday(curr, SIGDEBUG_WATCHDOG);
        } else {
-               printk(XENO_WARN "watchdog triggered on CPU #%d -- runaway 
thread "
+               printk(XENO_WARNING "watchdog triggered on CPU #%d -- runaway 
thread "
                       "'%s' canceled\n", xnsched_cpu(sched), curr->name);
                /*
                 * On behalf on an IRQ handler, xnthread_cancel()
@@ -515,7 +515,7 @@ void xnsched_initq(struct xnsched_mlq *q)
 
 static inline int get_qindex(struct xnsched_mlq *q, int prio)
 {
-       XENO_BUGON(COBALT, prio < 0 || prio >= XNSCHED_MLQ_LEVELS);
+       XENO_BUG_ON(COBALT, prio < 0 || prio >= XNSCHED_MLQ_LEVELS);
        /*
         * BIG FAT WARNING: We need to rescale the priority level to a
         * 0-based range. We use find_first_bit() to scan the bitmap
@@ -583,7 +583,7 @@ struct xnthread *xnsched_getq(struct xnsched_mlq *q)
 
        idx = xnsched_weightq(q);
        head = q->heads + idx;
-       XENO_BUGON(COBALT, list_empty(head));
+       XENO_BUG_ON(COBALT, list_empty(head));
        thread = list_first_entry(head, struct xnthread, rlink);
        del_q(q, &thread->rlink, idx);
 
@@ -624,7 +624,7 @@ struct xnthread *xnsched_rt_pick(struct xnsched *sched)
         */
        idx = xnsched_weightq(q);
        head = q->heads + idx;
-       XENO_BUGON(COBALT, list_empty(head));
+       XENO_BUG_ON(COBALT, list_empty(head));
 
        /*
         * The active class (i.e. ->sched_class) is the one currently
@@ -891,7 +891,7 @@ out:
 shadow_epilogue:
        __ipipe_complete_domain_migration();
 
-       XENO_BUGON(COBALT, xnthread_current() == NULL);
+       XENO_BUG_ON(COBALT, xnthread_current() == NULL);
 
        /*
         * Interrupts must be disabled here (has to be done on entry
@@ -900,7 +900,7 @@ shadow_epilogue:
         * handler that hit before we call xnsched_run in
         * xnthread_suspend() when relaxing a thread.
         */
-       XENO_BUGON(COBALT, !hard_irqs_disabled());
+       XENO_BUG_ON(COBALT, !hard_irqs_disabled());
 
        return 1;
 }
diff --git a/kernel/cobalt/synch.c b/kernel/cobalt/synch.c
index 410ed73..93176eb 100644
--- a/kernel/cobalt/synch.c
+++ b/kernel/cobalt/synch.c
@@ -140,7 +140,7 @@ int xnsynch_sleep_on(struct xnsynch *synch, xnticks_t 
timeout,
 
        primary_mode_only();
 
-       XENO_BUGON(COBALT, synch->status & XNSYNCH_OWNER);
+       XENO_BUG_ON(COBALT, synch->status & XNSYNCH_OWNER);
 
        thread = xnthread_current();
 
@@ -186,7 +186,7 @@ struct xnthread *xnsynch_wakeup_one_sleeper(struct xnsynch 
*synch)
        struct xnthread *thread;
        spl_t s;
 
-       XENO_BUGON(COBALT, synch->status & XNSYNCH_OWNER);
+       XENO_BUG_ON(COBALT, synch->status & XNSYNCH_OWNER);
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -213,7 +213,7 @@ int xnsynch_wakeup_many_sleepers(struct xnsynch *synch, int 
nr)
        int nwakeups = 0;
        spl_t s;
 
-       XENO_BUGON(COBALT, synch->status & XNSYNCH_OWNER);
+       XENO_BUG_ON(COBALT, synch->status & XNSYNCH_OWNER);
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -261,7 +261,7 @@ void xnsynch_wakeup_this_sleeper(struct xnsynch *synch, 
struct xnthread *sleeper
 {
        spl_t s;
 
-       XENO_BUGON(COBALT, synch->status & XNSYNCH_OWNER);
+       XENO_BUG_ON(COBALT, synch->status & XNSYNCH_OWNER);
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -333,7 +333,7 @@ int xnsynch_try_acquire(struct xnsynch *synch)
 
        primary_mode_only();
 
-       XENO_BUGON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
+       XENO_BUG_ON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
 
        curr = xnthread_current();
        lockp = xnsynch_fastlock(synch);
@@ -400,7 +400,7 @@ int xnsynch_acquire(struct xnsynch *synch, xnticks_t 
timeout,
 
        primary_mode_only();
 
-       XENO_BUGON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
+       XENO_BUG_ON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
 
        curr = xnthread_current();
        currh = curr->handle;
@@ -548,7 +548,7 @@ static void clear_boost(struct xnsynch *synch, struct 
xnthread *owner)
        } else {
                /* Find the highest priority needed to enforce the PIP. */
                hsynch = list_first_entry(&owner->claimq, struct xnsynch, link);
-               XENO_BUGON(COBALT, list_empty(&hsynch->pendq));
+               XENO_BUG_ON(COBALT, list_empty(&hsynch->pendq));
                target = list_first_entry(&hsynch->pendq, struct xnthread, 
plink);
                if (target->wprio > wprio)
                        wprio = target->wprio;
@@ -637,7 +637,7 @@ struct xnthread *xnsynch_release(struct xnsynch *synch,
        xnhandle_t threadh;
        atomic_t *lockp;
 
-       XENO_BUGON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
+       XENO_BUG_ON(COBALT, (synch->status & XNSYNCH_OWNER) == 0);
 
        trace_cobalt_synch_release(synch);
 
@@ -793,7 +793,7 @@ int xnsynch_flush(struct xnsynch *synch, int reason)
        trace_cobalt_synch_flush(synch);
 
        if (list_empty(&synch->pendq)) {
-               XENO_BUGON(COBALT, synch->status & XNSYNCH_CLAIMED);
+               XENO_BUG_ON(COBALT, synch->status & XNSYNCH_CLAIMED);
                ret = XNSYNCH_DONE;
        } else {
                ret = XNSYNCH_RESCHED;
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index b883c4a..cd9e1c2 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -106,7 +106,7 @@ static int kthread_trampoline(void *arg)
 
        ret = xnthread_map(thread, ka->done);
        if (ret) {
-               printk(XENO_WARN "failed to create kernel shadow %s\n",
+               printk(XENO_WARNING "failed to create kernel shadow %s\n",
                       thread->name);
                return ret;
        }
@@ -440,7 +440,7 @@ static inline void cleanup_tcb(struct xnthread *thread) /* 
nklock held, irqs off
        xnvfile_touch_tag(&nkthreadlist_tag);
 
        if (xnthread_test_state(thread, XNREADY)) {
-               XENO_BUGON(COBALT, xnthread_test_state(thread, 
XNTHREAD_BLOCK_BITS));
+               XENO_BUG_ON(COBALT, xnthread_test_state(thread, 
XNTHREAD_BLOCK_BITS));
                xnsched_dequeue(thread);
                xnthread_clear_state(thread, XNREADY);
        }
@@ -839,9 +839,9 @@ void xnthread_suspend(struct xnthread *thread, int mask,
        spl_t s;
 
        /* No, you certainly do not want to suspend the root thread. */
-       XENO_BUGON(COBALT, xnthread_test_state(thread, XNROOT));
+       XENO_BUG_ON(COBALT, xnthread_test_state(thread, XNROOT));
        /* No built-in support for conjunctive wait. */
-       XENO_BUGON(COBALT, wchan && thread->wchan);
+       XENO_BUG_ON(COBALT, wchan && thread->wchan);
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -1470,7 +1470,7 @@ void xnthread_cancel(struct xnthread *thread)
        spl_t s;
 
        /* Right, so you want to kill the kernel?! */
-       XENO_BUGON(COBALT, xnthread_test_state(thread, XNROOT));
+       XENO_BUG_ON(COBALT, xnthread_test_state(thread, XNROOT));
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -1557,7 +1557,7 @@ int xnthread_join(struct xnthread *thread, bool 
uninterruptible)
        spl_t s;
        int ret;
 
-       XENO_BUGON(COBALT, xnthread_test_state(thread, XNROOT));
+       XENO_BUG_ON(COBALT, xnthread_test_state(thread, XNROOT));
 
        xnlock_get_irqsave(&nklock, s);
 
@@ -2010,9 +2010,13 @@ void xnthread_relax(int notify, int reason)
        xnthread_suspend(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL);
        splnone();
 
-       if (XENO_DEBUG(COBALT) && !ipipe_root_p)
-               xnsys_fatal("xnthread_relax() failed for thread %s[%d]",
-                           thread->name, xnthread_host_pid(thread));
+       /*
+        * Basic sanity check after an expected transition to secondary
+        * mode.
+        */
+       XENO_WARN(COBALT, !ipipe_root_p,
+                 "xnthread_relax() failed for thread %s[%d]",
+                 thread->name, xnthread_host_pid(thread));
 
        __ipipe_reenter_root();
 
@@ -2060,7 +2064,7 @@ static inline void do_kthread_signal(struct task_struct 
*p,
                                     struct xnthread *thread,
                                     struct lostage_signal *rq)
 {
-       printk(XENO_WARN
+       printk(XENO_WARNING
               "kernel shadow %s received unhandled signal %d (action=0x%x)\n",
               thread->name, rq->signo, rq->sigval);
 }
@@ -2450,7 +2454,7 @@ void xnthread_call_mayday(struct xnthread *thread, int 
reason)
        struct task_struct *p = xnthread_host_task(thread);
 
        /* Mayday traps are available to userland threads only. */
-       XENO_BUGON(COBALT, !xnthread_test_state(thread, XNUSER));
+       XENO_BUG_ON(COBALT, !xnthread_test_state(thread, XNUSER));
        xnthread_set_info(thread, XNKICKED);
        xnthread_signal(thread, SIGDEBUG, reason);
        ipipe_raise_mayday(p);
diff --git a/kernel/cobalt/vfile.c b/kernel/cobalt/vfile.c
index 427e167..dc311f9 100644
--- a/kernel/cobalt/vfile.c
+++ b/kernel/cobalt/vfile.c
@@ -223,7 +223,7 @@ redo:
         * errors in all other cases.
         */
        if (ops->begin) {
-               XENO_BUGON(COBALT, ops->end == NULL);
+               XENO_BUG_ON(COBALT, ops->end == NULL);
                data = ops->begin(it);
                if (data == NULL) {
                        kfree(it);
@@ -300,7 +300,7 @@ static int vfile_snapshot_release(struct inode *inode, 
struct file *file)
                it = seq->private;
                if (it) {
                        --xnvfile_nref(it->vfile);
-                       XENO_BUGON(COBALT, it->vfile->entry.refcnt < 0);
+                       XENO_BUG_ON(COBALT, it->vfile->entry.refcnt < 0);
                        if (it->databuf)
                                it->endfn(it, it->databuf);
                        kfree(it);
@@ -400,7 +400,7 @@ int xnvfile_init_snapshot(const char *name,
        struct proc_dir_entry *ppde, *pde;
        int mode;
 
-       XENO_BUGON(COBALT, vfile->tag == NULL);
+       XENO_BUG_ON(COBALT, vfile->tag == NULL);
 
        if (vfile->entry.lockops == NULL)
                /* Defaults to nucleus lock */
@@ -554,7 +554,7 @@ static int vfile_regular_release(struct inode *inode, 
struct file *file)
                it = seq->private;
                if (it) {
                        --xnvfile_nref(it->vfile);
-                       XENO_BUGON(COBALT, xnvfile_nref(it->vfile) < 0);
+                       XENO_BUG_ON(COBALT, xnvfile_nref(it->vfile) < 0);
                        kfree(it);
                }
 
diff --git a/kernel/drivers/autotune/autotune.c 
b/kernel/drivers/autotune/autotune.c
index fbacb0e..6afec5c 100644
--- a/kernel/drivers/autotune/autotune.c
+++ b/kernel/drivers/autotune/autotune.c
@@ -568,7 +568,7 @@ static int tune_gravity(struct gravity_tuner *tuner, int 
period)
 
                if (state->min_lat < 0) {
                        if (tuner->get_gravity(tuner) == 0) {
-                               printk(XENO_WARN
+                               printk(XENO_WARNING
                                       "autotune(%s) failed with early shot 
(%Ld ns)\n",
                                       tuner->name,
                                       xnclock_ticks_to_ns(&nkclock, 
state->min_lat));
diff --git a/kernel/drivers/ipc/bufp.c b/kernel/drivers/ipc/bufp.c
index 5ae166a..fcfd694 100644
--- a/kernel/drivers/ipc/bufp.c
+++ b/kernel/drivers/ipc/bufp.c
@@ -243,7 +243,7 @@ redo:
                        goto out;
 
                wc = rtipc_get_wait_context(waiter);
-               XENO_BUGON(COBALT, wc == NULL);
+               XENO_BUG_ON(COBALT, wc == NULL);
                bufwc = container_of(wc, struct bufp_wait_context, wc);
                if (bufwc->len + sk->fillsz <= sk->bufsz)
                        /* This call rescheds internally. */
@@ -493,7 +493,7 @@ redo:
                        goto out;
 
                wc = rtipc_get_wait_context(waiter);
-               XENO_BUGON(COBALT, wc == NULL);
+               XENO_BUG_ON(COBALT, wc == NULL);
                bufwc = container_of(wc, struct bufp_wait_context, wc);
                if (bufwc->len <= rsk->fillsz)
                        rtdm_event_pulse(&rsk->i_event);


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

Reply via email to