From 34310fd7dbc3ad98d8e7cafa4f872ba71ca00860 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Mon, 8 Nov 2010 15:02:09 -0500 Subject: Split out TRACE() from litmus.h and cleanup some includes The TRACE() functionality doesn't need all of litmus.h. Currently, it's impossible to use TRACE() in sched.h due to a circular dependency. This patch moves TRACE() and friends to litmus/sched_debug.h, which can be included in sched.h. While at it, also fix some minor include ugliness that was revealed by this change. --- include/litmus/debug_trace.h | 37 +++++++++++++++++++++++++++++++++++++ include/litmus/litmus.h | 28 +--------------------------- include/litmus/sched_trace.h | 9 --------- 3 files changed, 38 insertions(+), 36 deletions(-) create mode 100644 include/litmus/debug_trace.h (limited to 'include') diff --git a/include/litmus/debug_trace.h b/include/litmus/debug_trace.h new file mode 100644 index 000000000000..0f99be01d569 --- /dev/null +++ b/include/litmus/debug_trace.h @@ -0,0 +1,37 @@ +#ifndef LITMUS_DEBUG_TRACE_H +#define LITMUS_DEBUG_TRACE_H + +#ifdef CONFIG_SCHED_DEBUG_TRACE +void sched_trace_log_message(const char* fmt, ...); +void dump_trace_buffer(int max); +#else + +#define sched_trace_log_message(fmt, ...) + +#endif + +extern atomic_t __log_seq_no; + +#define TRACE(fmt, args...) \ + sched_trace_log_message("%d P%d: " fmt, atomic_add_return(1, &__log_seq_no), \ + raw_smp_processor_id(), ## args) + +#define TRACE_TASK(t, fmt, args...) \ + TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args) + +#define TRACE_CUR(fmt, args...) \ + TRACE_TASK(current, fmt, ## args) + +#define TRACE_BUG_ON(cond) \ + do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \ + "called from %p current=%s/%d state=%d " \ + "flags=%x partition=%d cpu=%d rtflags=%d"\ + " job=%u timeslice=%u\n", \ + #cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \ + current->pid, current->state, current->flags, \ + get_partition(current), smp_processor_id(), get_rt_flags(current), \ + current->rt_param.job_params.job_no, \ + current->rt.time_slice\ + ); } while(0); + +#endif diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 5d20276e44f4..30f41869b455 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h @@ -6,38 +6,12 @@ #ifndef _LINUX_LITMUS_H_ #define _LINUX_LITMUS_H_ -#include -#include +#include #ifdef CONFIG_RELEASE_MASTER extern atomic_t release_master_cpu; #endif -extern atomic_t __log_seq_no; - -#define TRACE(fmt, args...) \ - sched_trace_log_message("%d P%d: " fmt, atomic_add_return(1, &__log_seq_no), \ - raw_smp_processor_id(), ## args) - -#define TRACE_TASK(t, fmt, args...) \ - TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args) - -#define TRACE_CUR(fmt, args...) \ - TRACE_TASK(current, fmt, ## args) - -#define TRACE_BUG_ON(cond) \ - do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \ - "called from %p current=%s/%d state=%d " \ - "flags=%x partition=%d cpu=%d rtflags=%d"\ - " job=%u timeslice=%u\n", \ - #cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \ - current->pid, current->state, current->flags, \ - get_partition(current), smp_processor_id(), get_rt_flags(current), \ - current->rt_param.job_params.job_no, \ - current->rt.time_slice\ - ); } while(0); - - /* in_list - is a given list_head queued on some list? */ static inline int in_list(struct list_head* list) diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index e1b0c9712b5f..a5f73736f7e8 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h @@ -178,15 +178,6 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ -#ifdef CONFIG_SCHED_DEBUG_TRACE -void sched_trace_log_message(const char* fmt, ...); -void dump_trace_buffer(int max); -#else - -#define sched_trace_log_message(fmt, ...) - -#endif - #endif /* __KERNEL__ */ #endif -- cgit v1.2.2