aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-01-14 16:51:23 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-02-19 15:33:41 -0500
commitb5760d873dabcfbd062de3c49f52cb4957354fea (patch)
tree42981c6f3f98debc9348d3d3f765c63ea293de4c
parentaab8d4a55840b785d0344c354fb5f4eed171803c (diff)
sched_trace: Trace PGM node type parameters
-rw-r--r--include/litmus/rt_param.h8
-rw-r--r--include/litmus/sched_trace.h24
-rw-r--r--include/trace/events/litmus.h21
-rw-r--r--litmus/litmus.c22
-rw-r--r--litmus/sched_cfl_split.c6
-rw-r--r--litmus/sched_task_trace.c15
6 files changed, 85 insertions, 11 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 6160a1635227..0ddc1973b0aa 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -51,6 +51,13 @@ typedef enum {
51 TASK_EARLY 51 TASK_EARLY
52} release_policy_t; 52} release_policy_t;
53 53
54typedef enum {
55 PGM_NOT_A_NODE,
56 PGM_SRC,
57 PGM_SINK,
58 PGM_INTERNAL
59} pgm_node_type_t;
60
54/* We use the common priority interpretation "lower index == higher priority", 61/* We use the common priority interpretation "lower index == higher priority",
55 * which is commonly used in fixed-priority schedulability analysis papers. 62 * which is commonly used in fixed-priority schedulability analysis papers.
56 * So, a numerically lower priority value implies higher scheduling priority, 63 * So, a numerically lower priority value implies higher scheduling priority,
@@ -82,6 +89,7 @@ struct rt_task {
82 task_class_t cls; 89 task_class_t cls;
83 budget_policy_t budget_policy; /* ignored by pfair */ 90 budget_policy_t budget_policy; /* ignored by pfair */
84 release_policy_t release_policy; 91 release_policy_t release_policy;
92 pgm_node_type_t pgm_type;
85}; 93};
86 94
87union np_flag { 95union np_flag {
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h
index 3d3b06ced797..8e2aefecd1fe 100644
--- a/include/litmus/sched_trace.h
+++ b/include/litmus/sched_trace.h
@@ -80,6 +80,12 @@ struct st_sys_release_data {
80 u64 release; 80 u64 release;
81}; 81};
82 82
83struct st_pgm_param_data {
84 u32 node_type;
85 u16 graph_pid;
86 u8 __unused[10];
87};
88
83struct st_pgm_release_data { 89struct st_pgm_release_data {
84 u64 release; /* PGM-adjusted release time */ 90 u64 release; /* PGM-adjusted release time */
85 u64 deadline; /* PGM-adjusted deadline */ 91 u64 deadline; /* PGM-adjusted deadline */
@@ -100,6 +106,7 @@ typedef enum {
100 ST_RESUME, 106 ST_RESUME,
101 ST_ACTION, 107 ST_ACTION,
102 ST_SYS_RELEASE, 108 ST_SYS_RELEASE,
109 ST_PGM_PARAM,
103 ST_PGM_RELEASE 110 ST_PGM_RELEASE
104} st_event_record_type_t; 111} st_event_record_type_t;
105 112
@@ -119,6 +126,7 @@ struct st_event_record {
119 DATA(resume); 126 DATA(resume);
120 DATA(action); 127 DATA(action);
121 DATA(sys_release); 128 DATA(sys_release);
129 DATA(pgm_param);
122 DATA(pgm_release); 130 DATA(pgm_release);
123 } data; 131 } data;
124}; 132};
@@ -161,6 +169,8 @@ feather_callback void do_sched_trace_action(unsigned long id,
161 unsigned long action); 169 unsigned long action);
162feather_callback void do_sched_trace_sys_release(unsigned long id, 170feather_callback void do_sched_trace_sys_release(unsigned long id,
163 lt_t* start); 171 lt_t* start);
172feather_callback void do_sched_trace_pgm_param(unsigned long id,
173 struct task_struct* task);
164feather_callback void do_sched_trace_pgm_release(unsigned long id, 174feather_callback void do_sched_trace_pgm_release(unsigned long id,
165 struct task_struct* task); 175 struct task_struct* task);
166 176
@@ -188,6 +198,7 @@ feather_callback void do_sched_trace_pgm_release(unsigned long id,
188#define trace_litmus_task_block(t) 198#define trace_litmus_task_block(t)
189#define trace_litmus_task_resume(t) 199#define trace_litmus_task_resume(t)
190#define trace_litmus_sys_release(start) 200#define trace_litmus_sys_release(start)
201#define trace_litmus_pgm_param(t)
191#define trace_litmus_pgm_release(t) 202#define trace_litmus_pgm_release(t)
192 203
193#endif 204#endif
@@ -262,10 +273,17 @@ feather_callback void do_sched_trace_pgm_release(unsigned long id,
262 trace_litmus_sys_release(when); \ 273 trace_litmus_sys_release(when); \
263 } while (0) 274 } while (0)
264 275
276#define sched_trace_pgm_param(t) \
277 do { \
278 SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \
279 do_sched_trace_pgm_param, t); \
280 trace_litmus_pgm_param(t); \
281 } while (0)
282
265#define sched_trace_pgm_release(t) \ 283#define sched_trace_pgm_release(t) \
266 do { \ 284 do { \
267 SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \ 285 SCHED_TRACE(SCHED_TRACE_BASE_ID + 12, \
268 do_sched_trace_pgm_release, t); \ 286 do_sched_trace_pgm_release, t); \
269 trace_litmus_pgm_release(t); \ 287 trace_litmus_pgm_release(t); \
270 } while (0) 288 } while (0)
271 289
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h
index 0b4eac386dfe..0822328144bc 100644
--- a/include/trace/events/litmus.h
+++ b/include/trace/events/litmus.h
@@ -225,6 +225,27 @@ TRACE_EVENT(litmus_sys_release,
225 TP_printk("SynRelease(%Lu) at %Lu\n", __entry->rel, __entry->when) 225 TP_printk("SynRelease(%Lu) at %Lu\n", __entry->rel, __entry->when)
226); 226);
227 227
228/* Tracing PGM node parameters */
229TRACE_EVENT(litmus_pgm_param,
230
231 TP_PROTO(struct task_struct *t),
232
233 TP_ARGS(t),
234
235 TP_STRUCT__entry(
236 __field( pid_t, pid )
237 __field( pgm_node_type_t, node_type )
238 __field( pid_t, graph_pid )
239 ),
240
241 TP_fast_assign(
242 __entry->pid = t ? t->pid : 0;
243 __entry->node_type = t ? t->rt_params.task_params.pgm_type : PGM_NOT_A_NODE;
244 __entry->graph_pid = t ? t->tgid : 0;
245 )
246
247 TP_printk("pgm node (%u, node type = %d) in graph (%u)\n",
248 __entry->pid, __entry->node_type, __entry->graph_pid);
228/* 249/*
229 * Tracing PGM-adjusted job release 250 * Tracing PGM-adjusted job release
230 */ 251 */
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 48d24eb5f4d8..6f6479b10db0 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -107,12 +107,19 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, struct rt_task __user * param)
107 if (tp.relative_deadline == 0) 107 if (tp.relative_deadline == 0)
108 tp.relative_deadline = tp.period; 108 tp.relative_deadline = tp.period;
109 109
110 if (tp.exec_cost <= 0) 110 if (tp.exec_cost <= 0) {
111 printk(KERN_INFO "litmus: real-time task %d rejected "
112 "because declared job execution time <= 0.", pid);
111 goto out_unlock; 113 goto out_unlock;
112 if (tp.period <= 0) 114 }
115 if (tp.period <= 0) {
116 printk(KERN_INFO "litmus: real-time task %d rejected "
117 "because declared job period <= 0.", pid);
113 goto out_unlock; 118 goto out_unlock;
114 if (!cpu_online(tp.cpu)) 119 }
120 if (!cpu_online(tp.cpu)) {
115 goto out_unlock; 121 goto out_unlock;
122 }
116 if (min(tp.relative_deadline, tp.period) < tp.exec_cost) /*density check*/ 123 if (min(tp.relative_deadline, tp.period) < tp.exec_cost) /*density check*/
117 { 124 {
118 printk(KERN_INFO "litmus: real-time task %d rejected " 125 printk(KERN_INFO "litmus: real-time task %d rejected "
@@ -331,9 +338,13 @@ long litmus_admit_task(struct task_struct* tsk)
331 if (get_rt_relative_deadline(tsk) == 0 || 338 if (get_rt_relative_deadline(tsk) == 0 ||
332 get_exec_cost(tsk) > 339 get_exec_cost(tsk) >
333 min(get_rt_relative_deadline(tsk), get_rt_period(tsk)) ) { 340 min(get_rt_relative_deadline(tsk), get_rt_period(tsk)) ) {
341 printk(KERN_INFO "litmus: invalid task parameters "
342 "(e = %llu, p = %llu, d = %llu)\n",
343 get_exec_cost(tsk), get_rt_period(tsk),
344 get_rt_relative_deadline(tsk));
334 TRACE_TASK(tsk, 345 TRACE_TASK(tsk,
335 "litmus admit: invalid task parameters " 346 "litmus admit: invalid task parameters "
336 "(e = %lu, p = %lu, d = %lu)\n", 347 "(e = %llu, p = %llu, d = %llu)\n",
337 get_exec_cost(tsk), get_rt_period(tsk), 348 get_exec_cost(tsk), get_rt_period(tsk),
338 get_rt_relative_deadline(tsk)); 349 get_rt_relative_deadline(tsk));
339 retval = -EINVAL; 350 retval = -EINVAL;
@@ -341,6 +352,8 @@ long litmus_admit_task(struct task_struct* tsk)
341 } 352 }
342 353
343 if (!cpu_online(get_partition(tsk))) { 354 if (!cpu_online(get_partition(tsk))) {
355 printk(KERN_INFO "litmus: cpu %d is not online\n",
356 get_partition(tsk));
344 TRACE_TASK(tsk, "litmus admit: cpu %d is not online\n", 357 TRACE_TASK(tsk, "litmus admit: cpu %d is not online\n",
345 get_partition(tsk)); 358 get_partition(tsk));
346 retval = -EINVAL; 359 retval = -EINVAL;
@@ -369,6 +382,7 @@ long litmus_admit_task(struct task_struct* tsk)
369 if (!retval) { 382 if (!retval) {
370 sched_trace_task_name(tsk); 383 sched_trace_task_name(tsk);
371 sched_trace_task_param(tsk); 384 sched_trace_task_param(tsk);
385 sched_trace_pgm_param(tsk);
372 atomic_inc(&rt_task_count); 386 atomic_inc(&rt_task_count);
373 } 387 }
374 388
diff --git a/litmus/sched_cfl_split.c b/litmus/sched_cfl_split.c
index ad398470a495..b6dde71cdf84 100644
--- a/litmus/sched_cfl_split.c
+++ b/litmus/sched_cfl_split.c
@@ -850,8 +850,10 @@ static long cflsplit_admit_task(struct task_struct* tsk)
850 if (remote_cluster(task_cpu(tsk)) != task_cpu_cluster(tsk)) { 850 if (remote_cluster(task_cpu(tsk)) != task_cpu_cluster(tsk)) {
851 unsigned int assigned_cpu = get_partition(tsk); 851 unsigned int assigned_cpu = get_partition(tsk);
852 unsigned int cur_cpu = task_cpu(tsk); 852 unsigned int cur_cpu = task_cpu(tsk);
853 TRACE_TASK(tsk, "cluster mismatch: assigned cpu %u but on cpu %u\n", 853 printk(KERN_INFO "cluster mismatch: %u assigned cpu %d but on cpu %d\n",
854 assigned_cpu, cur_cpu); 854 tsk->pid, assigned_cpu, cur_cpu);
855 TRACE_TASK(tsk, "cluster mismatch: assigned cpu %d but on cpu %d\n",
856 assigned_cpu, cur_cpu);
855 return -EINVAL; 857 return -EINVAL;
856 } 858 }
857 return 0; 859 return 0;
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c
index 422314f29a60..b9e772c07652 100644
--- a/litmus/sched_task_trace.c
+++ b/litmus/sched_task_trace.c
@@ -238,13 +238,24 @@ feather_callback void do_sched_trace_action(unsigned long id,
238 } 238 }
239} 239}
240 240
241feather_callback void do_sched_trace_pgm_param(unsigned long id, unsigned long _task)
242{
243 struct task_struct *t = (struct task_struct*) _task;
244 struct st_event_record* rec = get_record(ST_PGM_PARAM, t);
245 if (rec) {
246 rec->data.pgm_param.node_type = tsk_rt(t)->task_params.pgm_type;
247 rec->data.pgm_param.graph_pid = t->tgid;
248 put_record(rec);
249 }
250}
251
241feather_callback void do_sched_trace_pgm_release(unsigned long id, unsigned long _task) 252feather_callback void do_sched_trace_pgm_release(unsigned long id, unsigned long _task)
242{ 253{
243 struct task_struct *t = (struct task_struct*) _task; 254 struct task_struct *t = (struct task_struct*) _task;
244 struct st_event_record* rec = get_record(ST_PGM_RELEASE, t); 255 struct st_event_record* rec = get_record(ST_PGM_RELEASE, t);
245 if (rec) { 256 if (rec) {
246 rec->data.release.release = get_release(t); 257 rec->data.pgm_release.release = get_release(t);
247 rec->data.release.deadline = get_deadline(t); 258 rec->data.pgm_release.deadline = get_deadline(t);
248 put_record(rec); 259 put_record(rec);
249 } 260 }
250} 261}