diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-08 15:02:09 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-11-11 17:57:42 -0500 |
commit | 34310fd7dbc3ad98d8e7cafa4f872ba71ca00860 (patch) | |
tree | 31ddcaa124430c37ccb5e2f4cb0a69c37ad885ba | |
parent | c6182ba4a548baf0d1238d0df54e7d38ed299c3e (diff) |
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.
-rw-r--r-- | include/litmus/debug_trace.h | 37 | ||||
-rw-r--r-- | include/litmus/litmus.h | 28 | ||||
-rw-r--r-- | include/litmus/sched_trace.h | 9 | ||||
-rw-r--r-- | litmus/budget.c | 1 | ||||
-rw-r--r-- | litmus/litmus.c | 8 | ||||
-rw-r--r-- | litmus/litmus_proc.c | 1 | ||||
-rw-r--r-- | litmus/sched_plugin.c | 1 | ||||
-rw-r--r-- | litmus/sched_psn_edf.c | 3 | ||||
-rw-r--r-- | litmus/srp.c | 4 | ||||
-rw-r--r-- | litmus/trace.c | 1 |
10 files changed, 47 insertions, 46 deletions
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 @@ | |||
1 | #ifndef LITMUS_DEBUG_TRACE_H | ||
2 | #define LITMUS_DEBUG_TRACE_H | ||
3 | |||
4 | #ifdef CONFIG_SCHED_DEBUG_TRACE | ||
5 | void sched_trace_log_message(const char* fmt, ...); | ||
6 | void dump_trace_buffer(int max); | ||
7 | #else | ||
8 | |||
9 | #define sched_trace_log_message(fmt, ...) | ||
10 | |||
11 | #endif | ||
12 | |||
13 | extern atomic_t __log_seq_no; | ||
14 | |||
15 | #define TRACE(fmt, args...) \ | ||
16 | sched_trace_log_message("%d P%d: " fmt, atomic_add_return(1, &__log_seq_no), \ | ||
17 | raw_smp_processor_id(), ## args) | ||
18 | |||
19 | #define TRACE_TASK(t, fmt, args...) \ | ||
20 | TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args) | ||
21 | |||
22 | #define TRACE_CUR(fmt, args...) \ | ||
23 | TRACE_TASK(current, fmt, ## args) | ||
24 | |||
25 | #define TRACE_BUG_ON(cond) \ | ||
26 | do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \ | ||
27 | "called from %p current=%s/%d state=%d " \ | ||
28 | "flags=%x partition=%d cpu=%d rtflags=%d"\ | ||
29 | " job=%u timeslice=%u\n", \ | ||
30 | #cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \ | ||
31 | current->pid, current->state, current->flags, \ | ||
32 | get_partition(current), smp_processor_id(), get_rt_flags(current), \ | ||
33 | current->rt_param.job_params.job_no, \ | ||
34 | current->rt.time_slice\ | ||
35 | ); } while(0); | ||
36 | |||
37 | #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 @@ | |||
6 | #ifndef _LINUX_LITMUS_H_ | 6 | #ifndef _LINUX_LITMUS_H_ |
7 | #define _LINUX_LITMUS_H_ | 7 | #define _LINUX_LITMUS_H_ |
8 | 8 | ||
9 | #include <linux/jiffies.h> | 9 | #include <litmus/debug_trace.h> |
10 | #include <litmus/sched_trace.h> | ||
11 | 10 | ||
12 | #ifdef CONFIG_RELEASE_MASTER | 11 | #ifdef CONFIG_RELEASE_MASTER |
13 | extern atomic_t release_master_cpu; | 12 | extern atomic_t release_master_cpu; |
14 | #endif | 13 | #endif |
15 | 14 | ||
16 | extern atomic_t __log_seq_no; | ||
17 | |||
18 | #define TRACE(fmt, args...) \ | ||
19 | sched_trace_log_message("%d P%d: " fmt, atomic_add_return(1, &__log_seq_no), \ | ||
20 | raw_smp_processor_id(), ## args) | ||
21 | |||
22 | #define TRACE_TASK(t, fmt, args...) \ | ||
23 | TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args) | ||
24 | |||
25 | #define TRACE_CUR(fmt, args...) \ | ||
26 | TRACE_TASK(current, fmt, ## args) | ||
27 | |||
28 | #define TRACE_BUG_ON(cond) \ | ||
29 | do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \ | ||
30 | "called from %p current=%s/%d state=%d " \ | ||
31 | "flags=%x partition=%d cpu=%d rtflags=%d"\ | ||
32 | " job=%u timeslice=%u\n", \ | ||
33 | #cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \ | ||
34 | current->pid, current->state, current->flags, \ | ||
35 | get_partition(current), smp_processor_id(), get_rt_flags(current), \ | ||
36 | current->rt_param.job_params.job_no, \ | ||
37 | current->rt.time_slice\ | ||
38 | ); } while(0); | ||
39 | |||
40 | |||
41 | /* in_list - is a given list_head queued on some list? | 15 | /* in_list - is a given list_head queued on some list? |
42 | */ | 16 | */ |
43 | static inline int in_list(struct list_head* list) | 17 | 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, | |||
178 | 178 | ||
179 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ | 179 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ |
180 | 180 | ||
181 | #ifdef CONFIG_SCHED_DEBUG_TRACE | ||
182 | void sched_trace_log_message(const char* fmt, ...); | ||
183 | void dump_trace_buffer(int max); | ||
184 | #else | ||
185 | |||
186 | #define sched_trace_log_message(fmt, ...) | ||
187 | |||
188 | #endif | ||
189 | |||
190 | #endif /* __KERNEL__ */ | 181 | #endif /* __KERNEL__ */ |
191 | 182 | ||
192 | #endif | 183 | #endif |
diff --git a/litmus/budget.c b/litmus/budget.c index b99177a26313..f6f5ca81c9d6 100644 --- a/litmus/budget.c +++ b/litmus/budget.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/sched.h> | ||
1 | #include <linux/percpu.h> | 2 | #include <linux/percpu.h> |
2 | #include <linux/hrtimer.h> | 3 | #include <linux/hrtimer.h> |
3 | 4 | ||
diff --git a/litmus/litmus.c b/litmus/litmus.c index 99c35ac99870..0756d0156f8f 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -6,20 +6,16 @@ | |||
6 | #include <asm/uaccess.h> | 6 | #include <asm/uaccess.h> |
7 | #include <linux/uaccess.h> | 7 | #include <linux/uaccess.h> |
8 | #include <linux/sysrq.h> | 8 | #include <linux/sysrq.h> |
9 | 9 | #include <linux/sched.h> | |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | 12 | ||
13 | #include <litmus/litmus.h> | 13 | #include <litmus/litmus.h> |
14 | #include <linux/sched.h> | ||
15 | |||
16 | #include <litmus/bheap.h> | 14 | #include <litmus/bheap.h> |
17 | |||
18 | #include <litmus/trace.h> | 15 | #include <litmus/trace.h> |
19 | |||
20 | #include <litmus/rt_domain.h> | 16 | #include <litmus/rt_domain.h> |
21 | |||
22 | #include <litmus/litmus_proc.h> | 17 | #include <litmus/litmus_proc.h> |
18 | #include <litmus/sched_trace.h> | ||
23 | 19 | ||
24 | /* Number of RT tasks that exist in the system */ | 20 | /* Number of RT tasks that exist in the system */ |
25 | atomic_t rt_task_count = ATOMIC_INIT(0); | 21 | atomic_t rt_task_count = ATOMIC_INIT(0); |
diff --git a/litmus/litmus_proc.c b/litmus/litmus_proc.c index c10a6a6d3975..81ea5c35d291 100644 --- a/litmus/litmus_proc.c +++ b/litmus/litmus_proc.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * litmus_proc.c -- Implementation of the /proc/litmus directory tree. | 2 | * litmus_proc.c -- Implementation of the /proc/litmus directory tree. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/sched.h> | ||
5 | #include <linux/uaccess.h> | 6 | #include <linux/uaccess.h> |
6 | 7 | ||
7 | #include <litmus/litmus.h> | 8 | #include <litmus/litmus.h> |
diff --git a/litmus/sched_plugin.c b/litmus/sched_plugin.c index d706a08fb313..ec04454a0cf9 100644 --- a/litmus/sched_plugin.c +++ b/litmus/sched_plugin.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
9 | #include <linux/sched.h> | ||
9 | 10 | ||
10 | #include <litmus/litmus.h> | 11 | #include <litmus/litmus.h> |
11 | #include <litmus/sched_plugin.h> | 12 | #include <litmus/sched_plugin.h> |
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index 73f64730bd5e..aa567f2b91b9 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c | |||
@@ -12,14 +12,13 @@ | |||
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | |||
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | 16 | ||
18 | #include <litmus/litmus.h> | 17 | #include <litmus/litmus.h> |
19 | #include <litmus/jobs.h> | 18 | #include <litmus/jobs.h> |
20 | #include <litmus/sched_plugin.h> | 19 | #include <litmus/sched_plugin.h> |
21 | #include <litmus/edf_common.h> | 20 | #include <litmus/edf_common.h> |
22 | 21 | #include <litmus/sched_trace.h> | |
23 | 22 | ||
24 | typedef struct { | 23 | typedef struct { |
25 | rt_domain_t domain; | 24 | rt_domain_t domain; |
diff --git a/litmus/srp.c b/litmus/srp.c index 71639b991630..cb577598ce3e 100644 --- a/litmus/srp.c +++ b/litmus/srp.c | |||
@@ -3,12 +3,12 @@ | |||
3 | /* ************************************************************************** */ | 3 | /* ************************************************************************** */ |
4 | 4 | ||
5 | #include <asm/atomic.h> | 5 | #include <asm/atomic.h> |
6 | #include <linux/sched.h> | ||
6 | #include <linux/wait.h> | 7 | #include <linux/wait.h> |
8 | |||
7 | #include <litmus/litmus.h> | 9 | #include <litmus/litmus.h> |
8 | #include <litmus/sched_plugin.h> | 10 | #include <litmus/sched_plugin.h> |
9 | |||
10 | #include <litmus/fdso.h> | 11 | #include <litmus/fdso.h> |
11 | |||
12 | #include <litmus/trace.h> | 12 | #include <litmus/trace.h> |
13 | 13 | ||
14 | 14 | ||
diff --git a/litmus/trace.c b/litmus/trace.c index 440376998dc9..b3a6b47aad6e 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/sched.h> | ||
1 | #include <linux/module.h> | 2 | #include <linux/module.h> |
2 | 3 | ||
3 | #include <litmus/ftdev.h> | 4 | #include <litmus/ftdev.h> |