Module: xenomai-jki Branch: for-forge Commit: e5cff1b9da854fb9e061ce8d8e4377984b855943 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=e5cff1b9da854fb9e061ce8d8e4377984b855943
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Fri Sep 29 12:21:21 2017 +0200 cobalt/tracing: Primarily identify threads via pid Except for the short phase between thread_init and shadow_map, a thread is always identifiable via the pid of its Linux mate. Use this shorter value, which also correlates with what ftrace records anyway, instead of the pointer or the name. Report the full thread name only in prominent cases: init, resume and switch. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- kernel/cobalt/posix/process.c | 2 -- kernel/cobalt/thread.c | 4 +-- kernel/cobalt/trace/cobalt-core.h | 64 +++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index 3f8ff86..324dfa2 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -683,8 +683,6 @@ int cobalt_map_user(struct xnthread *thread, __u32 __user *u_winoff) __xn_put_user(cobalt_umm_offset(umm, u_window), u_winoff); xnthread_pin_initial(thread); - trace_cobalt_shadow_map(thread); - /* * CAUTION: we enable the pipeline notifier only when our * shadow TCB is consistent, so that we won't trigger false diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index 8a3c156..80317ca 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -270,6 +270,8 @@ void xnthread_init_shadow_tcb(struct xnthread *thread) tcb->core.user_fpu_owner = p; #endif /* CONFIG_XENO_ARCH_FPU */ xnarch_init_shadow_tcb(thread); + + trace_cobalt_shadow_map(thread); } void xnthread_init_root_tcb(struct xnthread *thread) @@ -2608,8 +2610,6 @@ int xnthread_map(struct xnthread *thread, struct completion *done) thread->u_window = NULL; xnthread_pin_initial(thread); - trace_cobalt_shadow_map(thread); - xnthread_init_shadow_tcb(thread); xnthread_suspend(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL); init_kthread_info(thread); diff --git a/kernel/cobalt/trace/cobalt-core.h b/kernel/cobalt/trace/cobalt-core.h index 41fdf1b..3448da9 100644 --- a/kernel/cobalt/trace/cobalt-core.h +++ b/kernel/cobalt/trace/cobalt-core.h @@ -30,24 +30,19 @@ DECLARE_EVENT_CLASS(thread_event, TP_ARGS(thread), TP_STRUCT__entry( - __field(struct xnthread *, thread) - __string(name, thread->name) __field(pid_t, pid) __field(unsigned long, state) __field(unsigned long, info) ), TP_fast_assign( - __entry->thread = thread; - __assign_str(name, thread->name); __entry->state = thread->state; __entry->info = thread->info; __entry->pid = xnthread_host_pid(thread); ), - TP_printk("thread=%p(%s) pid=%d state=0x%lx info=0x%lx", - __entry->thread, __get_str(name), __entry->pid, - __entry->state, __entry->info) + TP_printk("pid=%d state=0x%lx info=0x%lx", + __entry->pid, __entry->state, __entry->info) ); DECLARE_EVENT_CLASS(curr_thread_event, @@ -202,11 +197,10 @@ TRACE_EVENT(cobalt_switch_context, __entry->next_prio = xnthread_current_priority(next); ), - TP_printk("prev=%p(%s) prev_pid=%d prev_prio=%d prev_state=0x%lx ==> next=%p(%s) next_pid=%d next_prio=%d", - __entry->prev, __get_str(prev_name), __entry->prev_pid, + TP_printk("prev_name=%s prev_pid=%d prev_prio=%d prev_state=0x%lx ==> next_name=%s next_pid=%d next_prio=%d", + __get_str(prev_name), __entry->prev_pid, __entry->prev_prio, __entry->prev_state, - __entry->next, __get_str(next_name), __entry->next_pid, - __entry->next_prio) + __get_str(next_name), __entry->next_pid, __entry->next_prio) ); TRACE_EVENT(cobalt_thread_init, @@ -231,7 +225,7 @@ TRACE_EVENT(cobalt_thread_init, __entry->cprio = thread->cprio; ), - TP_printk("thread=%p(%s) flags=0x%lx class=%s prio=%d", + TP_printk("thread=%p name=%s flags=0x%lx class=%s prio=%d", __entry->thread, __get_str(thread_name), __entry->flags, __get_str(class_name), __entry->cprio) ); @@ -242,7 +236,7 @@ TRACE_EVENT(cobalt_thread_suspend, TP_ARGS(thread, mask, timeout, timeout_mode, wchan), TP_STRUCT__entry( - __field(struct xnthread *, thread) + __field(pid_t, pid) __field(unsigned long, mask) __field(xnticks_t, timeout) __field(xntmode_t, timeout_mode) @@ -250,15 +244,15 @@ TRACE_EVENT(cobalt_thread_suspend, ), TP_fast_assign( - __entry->thread = thread; + __entry->pid = xnthread_host_pid(thread); __entry->mask = mask; __entry->timeout = timeout; __entry->timeout_mode = timeout_mode; __entry->wchan = wchan; ), - TP_printk("thread=%p mask=0x%lx timeout=%Lu timeout_mode=%d wchan=%p", - __entry->thread, __entry->mask, + TP_printk("pid=%d mask=0x%lx timeout=%Lu timeout_mode=%d wchan=%p", + __entry->pid, __entry->mask, __entry->timeout, __entry->timeout_mode, __entry->wchan) ); @@ -267,17 +261,19 @@ TRACE_EVENT(cobalt_thread_resume, TP_ARGS(thread, mask), TP_STRUCT__entry( - __field(struct xnthread *, thread) + __string(name, thread->name) + __field(pid_t, pid) __field(unsigned long, mask) ), TP_fast_assign( - __entry->thread = thread; + __assign_str(name, thread->name); + __entry->pid = xnthread_host_pid(thread); __entry->mask = mask; ), - TP_printk("thread=%p mask=0x%lx", - __entry->thread, __entry->mask) + TP_printk("name=%s pid=%d mask=0x%lx", + __get_str(name), __entry->pid, __entry->mask) ); TRACE_EVENT(cobalt_thread_fault, @@ -304,18 +300,18 @@ TRACE_EVENT(cobalt_thread_set_current_prio, TP_STRUCT__entry( __field(struct xnthread *, thread) - __string(name, thread->name) + __field(pid_t, pid) __field(int, cprio) ), TP_fast_assign( - __entry->thread = thread; - __assign_str(name, thread->name); + __entry->thread = thread; + __entry->pid = xnthread_host_pid(thread); __entry->cprio = xnthread_current_priority(thread); ), - TP_printk("thread=%p(%s) prio=%d", - __entry->thread, __get_str(name), __entry->cprio) + TP_printk("thread=%p pid=%d prio=%d", + __entry->thread, __entry->pid, __entry->cprio) ); DEFINE_EVENT(thread_event, cobalt_thread_start, @@ -374,18 +370,18 @@ TRACE_EVENT(cobalt_thread_migrate_passive, TP_STRUCT__entry( __field(struct xnthread *, thread) - __string(name, thread->name) + __field(pid_t, pid) __field(unsigned int, cpu) ), TP_fast_assign( __entry->thread = thread; - __assign_str(name, thread->name); + __entry->pid = xnthread_host_pid(thread); __entry->cpu = cpu; ), - TP_printk("thread=%p(%s) cpu=%u", - __entry->thread, __get_str(name), __entry->cpu) + TP_printk("thread=%p pid=%d cpu=%u", + __entry->thread, __entry->pid, __entry->cpu) ); DEFINE_EVENT(curr_thread_event, cobalt_shadow_gohard, @@ -441,18 +437,18 @@ TRACE_EVENT(cobalt_shadow_map, TP_STRUCT__entry( __field(struct xnthread *, thread) - __string(name, thread->name) + __field(pid_t, pid) __field(int, prio) ), TP_fast_assign( - __entry->thread = thread; - __assign_str(name, thread->name); + __entry->thread = thread; + __entry->pid = xnthread_host_pid(thread); __entry->prio = xnthread_base_priority(thread); ), - TP_printk("thread=%p(%s) prio=%d", - __entry->thread, __get_str(name), __entry->prio) + TP_printk("thread=%p pid=%d prio=%d", + __entry->thread, __entry->pid, __entry->prio) ); DEFINE_EVENT(curr_thread_event, cobalt_shadow_unmap, _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git