Module: xenomai-jki
Branch: for-forge
Commit: 30a6227e3c734a0bd3381a603edba383841b0ca6
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=30a6227e3c734a0bd3381a603edba383841b0ca6

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Wed Jul 29 17:30:47 2015 +0200

kernel/cobalt: Add reason to gorelax trace point

Trace and print the name of the relaxation reason whenever available.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/thread.c            |    2 +-
 kernel/cobalt/trace/cobalt-core.h |   26 +++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 4cec6e7..2d1f840 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1997,7 +1997,7 @@ void xnthread_relax(int notify, int reason)
         * domain to the Linux domain.  This will cause the Linux task
         * to resume using the register state of the shadow thread.
         */
-       trace_cobalt_shadow_gorelax(thread);
+       trace_cobalt_shadow_gorelax(thread, reason);
 
        /*
         * If you intend to change the following interrupt-free
diff --git a/kernel/cobalt/trace/cobalt-core.h 
b/kernel/cobalt/trace/cobalt-core.h
index ee20b7c..d2b1c7e 100644
--- a/kernel/cobalt/trace/cobalt-core.h
+++ b/kernel/cobalt/trace/cobalt-core.h
@@ -357,9 +357,29 @@ DEFINE_EVENT(thread_event, cobalt_shadow_hardened,
        TP_ARGS(thread)
 );
 
-DEFINE_EVENT(thread_event, cobalt_shadow_gorelax,
-       TP_PROTO(struct xnthread *thread),
-       TP_ARGS(thread)
+#define cobalt_print_relax_reason(reason)                              \
+       __print_symbolic(reason,                                        \
+                        { SIGDEBUG_UNDEFINED,          "undefined" },  \
+                        { SIGDEBUG_MIGRATE_SIGNAL,     "signal" },     \
+                        { SIGDEBUG_MIGRATE_SYSCALL,    "syscall" },    \
+                        { SIGDEBUG_MIGRATE_FAULT,      "fault" })
+
+TRACE_EVENT(cobalt_shadow_gorelax,
+       TP_PROTO(struct xnthread *thread, int reason),
+       TP_ARGS(thread, reason),
+
+       TP_STRUCT__entry(
+               __field(struct xnthread *, thread)
+               __field(int, reason)
+       ),
+
+       TP_fast_assign(
+               __entry->thread = thread;
+               __entry->reason = reason;
+       ),
+
+       TP_printk("thread=%p reason=%s",
+                 __entry->thread, cobalt_print_relax_reason(__entry->reason))
 );
 
 DEFINE_EVENT(thread_event, cobalt_shadow_relaxed,


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

Reply via email to