aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2009-12-18 09:08:44 -0500
committerAndrea Bastoni <bastoni@cs.unc.edu>2009-12-18 09:08:44 -0500
commit2f41251f9febad2e54fa338ea63a62818970af0c (patch)
tree470e7ae6305bc554b1564579586b898fd8da5159
parent0c70a26073633b3879eac57d38f1260c1bebeafc (diff)
Test kernel tracing events capabilitiestracing-devel
Can events be applied to LITMUS code instead of sched_task_trace ? PROS: - architectural indipendency - easy porting on newer kernel version - lock free ring buffer implementation already there CONS: - need userspace tools conversion to slightly different format - is it possible to replicate all the previous functionalities? - only sched_trace_* functions can be implemented through events, TRACE() debugging features are still implemented in the old way (??? cannot we simply use the tracing features of the kernel for debugging purposes ????)
-rw-r--r--include/trace/events/litmus.h147
-rw-r--r--include/trace/events/sched.h3
-rw-r--r--kernel/sched.c3
-rw-r--r--litmus/litmus.c8
-rw-r--r--litmus/rt_domain.c5
-rw-r--r--litmus/sched_gsn_edf.c11
-rw-r--r--litmus/sched_litmus.c3
7 files changed, 172 insertions, 8 deletions
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h
new file mode 100644
index 000000000000..e5216a8502c2
--- /dev/null
+++ b/include/trace/events/litmus.h
@@ -0,0 +1,147 @@
1/*
2 * LITMUS^RT scheduling events
3 * included from sched.
4 */
5#include <litmus/litmus.h>
6#include <litmus/rt_param.h>
7
8/*
9 * Tracing task admission
10 */
11TRACE_EVENT(litmus_task_param,
12
13 TP_PROTO(struct task_struct *t),
14
15 TP_ARGS(t),
16
17 TP_STRUCT__entry(
18 __field( pid_t, pid )
19 __field( unsigned int, job )
20 __field( lt_t, wcet )
21 __field( lt_t, period )
22 __field( lt_t, phase )
23 __field( int, partition )
24 ),
25
26 TP_fast_assign(
27 __entry->pid = t ? t->pid : 0;
28 __entry->job = t ? t->rt_param.job_params.job_no : 0;
29 __entry->wcet = get_exec_cost(t);
30 __entry->period = get_rt_period(t);
31 __entry->phase = get_rt_phase(t);
32 __entry->partition = get_partition(t);
33 ),
34
35 TP_printk("period(%d, %Lu).\nwcet(%d, %Lu).\n",
36 __entry->pid, __entry->period,
37 __entry->pid, __entry->wcet)
38);
39
40/*
41 * Tracing jobs release
42 */
43TRACE_EVENT(litmus_task_release,
44
45 TP_PROTO(struct task_struct *t),
46
47 TP_ARGS(t),
48
49 TP_STRUCT__entry(
50 __field( pid_t, pid )
51 __field( unsigned int, job )
52 __field( lt_t, release )
53 __field( lt_t, deadline )
54 ),
55
56 TP_fast_assign(
57 __entry->pid = t ? t->pid : 0;
58 __entry->job = t ? t->rt_param.job_params.job_no : 0;
59 __entry->release = get_release(t);
60 __entry->deadline = get_deadline(t);
61 ),
62
63 TP_printk("released(job(%u, %u), %Lu).\ndeadline(job(%u, %u), %Lu).\n",
64 __entry->pid, __entry->job, __entry->release,
65 __entry->pid, __entry->job, __entry->deadline)
66);
67
68/*
69 * Tracing jobs completion
70 */
71TRACE_EVENT(litmus_task_completion,
72
73 TP_PROTO(struct task_struct *t, unsigned long forced),
74
75 TP_ARGS(t, forced),
76
77 TP_STRUCT__entry(
78 __field( pid_t, pid )
79 __field( unsigned int, job )
80 __field( lt_t, when )
81 __field( unsigned long, forced )
82 ),
83
84 TP_fast_assign(
85 __entry->pid = t ? t->pid : 0;
86 __entry->job = t ? t->rt_param.job_params.job_no : 0;
87 __entry->when = litmus_clock();
88 __entry->forced = forced;
89 ),
90
91 TP_printk("completed(job(%u, %u), %Lu).\n",
92 __entry->pid, __entry->job, __entry->when)
93);
94
95/*
96 * Tracing jobs resume
97 */
98TRACE_EVENT(litmus_task_resume,
99
100 TP_PROTO(struct task_struct *t),
101
102 TP_ARGS(t),
103
104 TP_STRUCT__entry(
105 __field( pid_t, pid )
106 __field( unsigned int, job )
107 __field( lt_t, when )
108 ),
109
110 TP_fast_assign(
111 __entry->pid = t ? t->pid : 0;
112 __entry->job = t ? t->rt_param.job_params.job_no : 0;
113 __entry->when = litmus_clock();
114 ),
115
116 TP_printk("resumed(job(%u, %u), %Lu).\n",
117 __entry->pid, __entry->job, __entry->when)
118);
119
120/*
121 * Tracepoint for switching away previous task
122 */
123TRACE_EVENT(litmus_switch_away,
124
125 TP_PROTO(struct task_struct *t),
126
127 TP_ARGS(t),
128
129 TP_STRUCT__entry(
130 __field( pid_t, pid )
131 __field( unsigned int, job )
132 __field( lt_t, when )
133 __field( lt_t, exec_time )
134 ),
135
136 TP_fast_assign(
137 __entry->pid = t ? t->pid : 0;
138 __entry->job = t ? t->rt_param.job_params.job_no : 0;
139 __entry->when = litmus_clock();
140 __entry->exec_time = get_exec_time(t);
141 ),
142
143 TP_printk("scheduled(job(%u, %u), %Lu, %Lu).\n",
144 __entry->pid, __entry->job,
145 __entry->when, __entry->exec_time)
146);
147
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 4069c43f4187..0e1d542ca961 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -472,6 +472,9 @@ TRACE_EVENT(sched_stat_iowait,
472 (unsigned long long)__entry->delay) 472 (unsigned long long)__entry->delay)
473); 473);
474 474
475/* include LITMUS^RT scheduling events */
476#include "./litmus.h"
477
475#endif /* _TRACE_SCHED_H */ 478#endif /* _TRACE_SCHED_H */
476 479
477/* This part must be outside protection */ 480/* This part must be outside protection */
diff --git a/kernel/sched.c b/kernel/sched.c
index ee894ee8a0bb..5ff48213781c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5459,7 +5459,8 @@ need_resched:
5459 release_kernel_lock(prev); 5459 release_kernel_lock(prev);
5460need_resched_nonpreemptible: 5460need_resched_nonpreemptible:
5461 TS_SCHED_START; 5461 TS_SCHED_START;
5462 sched_trace_task_switch_away(prev); 5462// sched_trace_task_switch_away(prev);
5463 trace_litmus_switch_away(prev);
5463 5464
5464 schedule_debug(prev); 5465 schedule_debug(prev);
5465 5466
diff --git a/litmus/litmus.c b/litmus/litmus.c
index de751a14d77c..c4c74fe299fc 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -19,6 +19,8 @@
19 19
20#include <litmus/trace.h> 20#include <litmus/trace.h>
21 21
22#include <trace/events/sched.h>
23
22#include <litmus/rt_domain.h> 24#include <litmus/rt_domain.h>
23 25
24/* Number of RT tasks that exist in the system */ 26/* Number of RT tasks that exist in the system */
@@ -342,7 +344,8 @@ long litmus_admit_task(struct task_struct* tsk)
342 344
343 if (!retval) { 345 if (!retval) {
344 sched_trace_task_name(tsk); 346 sched_trace_task_name(tsk);
345 sched_trace_task_param(tsk); 347// sched_trace_task_param(tsk);
348 trace_litmus_task_param(tsk);
346 atomic_inc(&rt_task_count); 349 atomic_inc(&rt_task_count);
347 } 350 }
348 351
@@ -355,7 +358,8 @@ out:
355void litmus_exit_task(struct task_struct* tsk) 358void litmus_exit_task(struct task_struct* tsk)
356{ 359{
357 if (is_realtime(tsk)) { 360 if (is_realtime(tsk)) {
358 sched_trace_task_completion(tsk, 1); 361// sched_trace_task_completion(tsk, 1);
362 trace_litmus_task_completion(tsk, 1);
359 363
360 litmus->task_exit(tsk); 364 litmus->task_exit(tsk);
361 365
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c
index 62c9fdcd22be..d5ece53fa61e 100644
--- a/litmus/rt_domain.c
+++ b/litmus/rt_domain.c
@@ -19,6 +19,8 @@
19 19
20#include <litmus/trace.h> 20#include <litmus/trace.h>
21 21
22#include <trace/events/sched.h>
23
22#include <litmus/heap.h> 24#include <litmus/heap.h>
23 25
24static int dummy_resched(rt_domain_t *rt) 26static int dummy_resched(rt_domain_t *rt)
@@ -181,7 +183,8 @@ static void arm_release_timer(rt_domain_t *_rt)
181 list_for_each_safe(pos, safe, &list) { 183 list_for_each_safe(pos, safe, &list) {
182 /* pick task of work list */ 184 /* pick task of work list */
183 t = list_entry(pos, struct task_struct, rt_param.list); 185 t = list_entry(pos, struct task_struct, rt_param.list);
184 sched_trace_task_release(t); 186// sched_trace_task_release(t);
187 trace_litmus_task_release(t);
185 list_del(pos); 188 list_del(pos);
186 189
187 /* put into release heap while holding release_lock */ 190 /* put into release heap while holding release_lock */
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index a223e69f2efb..5386f0a24587 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -18,6 +18,8 @@
18#include <litmus/edf_common.h> 18#include <litmus/edf_common.h>
19#include <litmus/sched_trace.h> 19#include <litmus/sched_trace.h>
20 20
21#include <trace/events/sched.h>
22
21#include <litmus/heap.h> 23#include <litmus/heap.h>
22 24
23#include <linux/module.h> 25#include <linux/module.h>
@@ -321,7 +323,8 @@ static noinline void job_completion(struct task_struct *t, int forced)
321{ 323{
322 BUG_ON(!t); 324 BUG_ON(!t);
323 325
324 sched_trace_task_completion(t, forced); 326// sched_trace_task_completion(t, forced);
327 trace_litmus_task_completion(t, forced);
325 328
326 TRACE_TASK(t, "job_completion().\n"); 329 TRACE_TASK(t, "job_completion().\n");
327 330
@@ -330,7 +333,8 @@ static noinline void job_completion(struct task_struct *t, int forced)
330 /* prepare for next period */ 333 /* prepare for next period */
331 prepare_for_next_period(t); 334 prepare_for_next_period(t);
332 if (is_released(t, litmus_clock())) 335 if (is_released(t, litmus_clock()))
333 sched_trace_task_release(t); 336 trace_litmus_task_release(t);
337// sched_trace_task_release(t);
334 /* unlink */ 338 /* unlink */
335 unlink(t); 339 unlink(t);
336 /* requeue 340 /* requeue
@@ -558,7 +562,8 @@ static void gsnedf_task_wake_up(struct task_struct *task)
558 if (is_tardy(task, now)) { 562 if (is_tardy(task, now)) {
559 /* new sporadic release */ 563 /* new sporadic release */
560 release_at(task, now); 564 release_at(task, now);
561 sched_trace_task_release(task); 565// sched_trace_task_release(task);
566 trace_litmus_task_release(task);
562 } 567 }
563 else { 568 else {
564 if (task->rt.time_slice) { 569 if (task->rt.time_slice) {
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c
index 4d1cdacbeb9f..2aa609466cde 100644
--- a/litmus/sched_litmus.c
+++ b/litmus/sched_litmus.c
@@ -145,7 +145,8 @@ static void enqueue_task_litmus(struct rq *rq, struct task_struct *p,
145 int wakeup) 145 int wakeup)
146{ 146{
147 if (wakeup) { 147 if (wakeup) {
148 sched_trace_task_resume(p); 148// sched_trace_task_resume(p);
149 trace_litmus_task_resume(p);
149 tsk_rt(p)->present = 1; 150 tsk_rt(p)->present = 1;
150 litmus->task_wake_up(p); 151 litmus->task_wake_up(p);
151 } else 152 } else