aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Tang <sytang@pound.cs.unc.edu>2017-04-04 10:47:20 -0400
committerStephen Tang <sytang@pound.cs.unc.edu>2017-04-04 10:47:20 -0400
commit032304b6dc14c4f910fbeb6237ecf85de51e5aef (patch)
treea93eed0549c1937c0c18d276292e326a293fe5a0
parent12787b2fa6aa96ee501dd34a26c6d887f28872ff (diff)
Added sched_trace for request and forced res_id's to be same for single task
-rw-r--r--include/litmus/mc2_common.h2
-rw-r--r--include/litmus/sched_trace.h25
-rw-r--r--include/trace/events/litmus.h40
-rw-r--r--litmus/sched_mc2.c125
-rw-r--r--litmus/sched_task_trace.c14
5 files changed, 142 insertions, 64 deletions
diff --git a/include/litmus/mc2_common.h b/include/litmus/mc2_common.h
index 74a0527a20e3..fcc0652c4a43 100644
--- a/include/litmus/mc2_common.h
+++ b/include/litmus/mc2_common.h
@@ -16,7 +16,7 @@ enum crit_level {
16 16
17struct mc2_task { 17struct mc2_task {
18 enum crit_level crit; 18 enum crit_level crit;
19 unsigned int res_id[NR_MODES]; 19 unsigned int res_id;
20 uint32_t mode_mask; 20 uint32_t mode_mask;
21}; 21};
22 22
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h
index 626eb95bba34..dfc496f3054a 100644
--- a/include/litmus/sched_trace.h
+++ b/include/litmus/sched_trace.h
@@ -85,6 +85,11 @@ struct st_enact_mode_data {
85 u8 __unused[8]; 85 u8 __unused[8];
86}; 86};
87 87
88struct st_request_mode_data {
89 u64 when;
90 u8 __unused[8];
91};
92
88#define DATA(x) struct st_ ## x ## _data x; 93#define DATA(x) struct st_ ## x ## _data x;
89 94
90typedef enum { 95typedef enum {
@@ -100,7 +105,8 @@ typedef enum {
100 ST_RESUME, 105 ST_RESUME,
101 ST_ACTION, 106 ST_ACTION,
102 ST_SYS_RELEASE, 107 ST_SYS_RELEASE,
103 ST_ENACT_MODE 108 ST_ENACT_MODE,
109 ST_REQUEST_MODE
104} st_event_record_type_t; 110} st_event_record_type_t;
105 111
106struct st_event_record { 112struct st_event_record {
@@ -120,6 +126,7 @@ struct st_event_record {
120 DATA(action); 126 DATA(action);
121 DATA(sys_release); 127 DATA(sys_release);
122 DATA(enact_mode); 128 DATA(enact_mode);
129 DATA(request_mode);
123 } data; 130 } data;
124}; 131};
125 132
@@ -165,6 +172,9 @@ feather_callback void do_sched_trace_sys_release(unsigned long id,
165feather_callback void do_sched_trace_enact_mode(unsigned long id, 172feather_callback void do_sched_trace_enact_mode(unsigned long id,
166 struct task_struct* task); 173 struct task_struct* task);
167 174
175feather_callback void do_sched_trace_request_mode(unsigned long id,
176 struct task_struct* task);
177
168#endif 178#endif
169 179
170#else 180#else
@@ -190,6 +200,7 @@ feather_callback void do_sched_trace_enact_mode(unsigned long id,
190#define trace_litmus_task_resume(t) 200#define trace_litmus_task_resume(t)
191#define trace_litmus_sys_release(start) 201#define trace_litmus_sys_release(start)
192#define trace_litmus_enact_mode(t) 202#define trace_litmus_enact_mode(t)
203#define trace_litmus_request_mode(t)
193 204
194#endif 205#endif
195 206
@@ -265,13 +276,19 @@ feather_callback void do_sched_trace_enact_mode(unsigned long id,
265 276
266#define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ 277#define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */
267 278
268#define sched_trace_enact_mode(when) \ 279#define sched_trace_enact_mode(t) \
269 do { \ 280 do { \
270 SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \ 281 SCHED_TRACE(SCHED_TRACE_BASE_ID + 11, \
271 do_sched_trace_enact_mode, when); \ 282 do_sched_trace_enact_mode, t); \
272 trace_litmus_enact_mode(when); \ 283 trace_litmus_enact_mode(t); \
273 } while (0) 284 } while (0)
274 285
286#define sched_trace_request_mode(t) \
287 do { \
288 SCHED_TRACE(SCHED_TRACE_BASE_ID + 12, \
289 do_sched_trace_request_mode, t); \
290 trace_litmus_request_mode(t); \
291 } while (0)
275#endif /* __KERNEL__ */ 292#endif /* __KERNEL__ */
276 293
277#endif 294#endif
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h
index 0fffcee02be0..fc89b23068b1 100644
--- a/include/trace/events/litmus.h
+++ b/include/trace/events/litmus.h
@@ -225,6 +225,46 @@ 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/*
229 * Trace enact mode
230 */
231TRACE_EVENT(litmus_enact_mode,
232
233 TP_PROTO(struct task_struct *t),
234
235 TP_ARGS(t),
236
237 TP_STRUCT__entry(
238 __field( lt_t, when )
239 ),
240
241 TP_fast_assign(
242 __entry->when = litmus_clock();
243 ),
244
245 TP_printk("Mode Enact at %Lu\n", __entry->when)
246);
247
248/*
249 * Trace notice mode request
250 */
251TRACE_EVENT(litmus_request_mode,
252
253 TP_PROTO(struct task_struct *t),
254
255 TP_ARGS(t),
256
257 TP_STRUCT__entry(
258 __field( lt_t, when )
259 ),
260
261 TP_fast_assign(
262 __entry->when = litmus_clock();
263 ),
264
265 TP_printk("Mode request at %Lu\n", __entry->when)
266);
267
228#endif /* _SCHED_TASK_TRACEPOINT_H */ 268#endif /* _SCHED_TASK_TRACEPOINT_H */
229 269
230/* Must stay outside the protection */ 270/* Must stay outside the protection */
diff --git a/litmus/sched_mc2.c b/litmus/sched_mc2.c
index 525af34f0875..9949791e2d7a 100644
--- a/litmus/sched_mc2.c
+++ b/litmus/sched_mc2.c
@@ -111,7 +111,11 @@ raw_spinlock_t mode_lock;
111unsigned int mode_sizes[NR_MODES]; 111unsigned int mode_sizes[NR_MODES];
112unsigned int res_reported; 112unsigned int res_reported;
113bool cpu_0_spin_flag; 113bool cpu_0_spin_flag;
114bool seen_once;
114#define in_mode(t, modenum) (tsk_mc2_data(t)->mode_mask & (1 << modenum)) 115#define in_mode(t, modenum) (tsk_mc2_data(t)->mode_mask & (1 << modenum))
116#define pending mode != requested_mode
117#define ready !res_reported
118
115/* 119/*
116 * To be called from level A task's with period equal to 120 * To be called from level A task's with period equal to
117 * A and B hyperperiod 121 * A and B hyperperiod
@@ -120,38 +124,21 @@ bool cpu_0_spin_flag;
120asmlinkage long sys_enact_mode(void) 124asmlinkage long sys_enact_mode(void)
121{ 125{
122 struct mc2_cpu_state *state = local_cpu_state(); 126 struct mc2_cpu_state *state = local_cpu_state();
123 struct list_head *pos;
124 struct reservation *res; 127 struct reservation *res;
128 struct list_head *pos;
125 hrtimer_cancel(&state->timer);//stop listening to old mode timers 129 hrtimer_cancel(&state->timer);//stop listening to old mode timers
126 //lt_t now = litmus_clock(); 130 //lt_t now = litmus_clock();
127 if (state->cpu == 0){ 131 if (state->cpu == 0){
128 raw_spin_lock(&global_lock); 132 raw_spin_lock(&global_lock);
129 raw_spin_lock(&mode_lock); 133 raw_spin_lock(&mode_lock);
130 if (mode != requested_mode //MCR has entered 134 if (pending){ //MCR has entered
131 if( !res_reported){ //and C is throttled 135 if (!seen_once){
132 mode = requested_mode; 136 sched_trace_request_mode(current);
133 _global_env = &_global_env_modes[mode]; 137 //clean up jobs that are already done
134 //set res->reported for new global tasks 138 //after this jobs report themselves
135 list_for_each(pos, &_global_env->active_reservations){
136 res = list_entry(pos, struct reservation, list);
137 res->reported = 0;
138 }
139 list_for_each(pos, &_global_env->depleted_reservations){
140 res = list_entry(pos, struct reservation, list);
141 res->reported = 0;
142 }
143 list_for_each(pos, &_global_env->inactive_reservations){
144 res = list_entry(pos, struct reservation, list);
145 res->reported = 0;
146 res->env->change_state(res->env, res, RESERVATION_ACTIVE);
147 }
148 //gmp_update_time(_global_env, now);
149 }
150 else{
151 list_for_each(pos, &_global_env->active_reservations){ 139 list_for_each(pos, &_global_env->active_reservations){
152 res = list_entry(pos, struct reservation, list); 140 res = list_entry(pos, struct reservation, list);
153 if (tsk_rt(res->tsk)->completed){ 141 if (tsk_rt(res->tsk)->completed){
154 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
155 res->reported = 1; 142 res->reported = 1;
156 res_reported--; 143 res_reported--;
157 } 144 }
@@ -159,7 +146,6 @@ asmlinkage long sys_enact_mode(void)
159 list_for_each(pos, &_global_env->depleted_reservations){ 146 list_for_each(pos, &_global_env->depleted_reservations){
160 res = list_entry(pos, struct reservation, list); 147 res = list_entry(pos, struct reservation, list);
161 if (tsk_rt(res->tsk)->completed){ 148 if (tsk_rt(res->tsk)->completed){
162 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
163 res->reported = 1; 149 res->reported = 1;
164 res_reported--; 150 res_reported--;
165 } 151 }
@@ -168,12 +154,32 @@ asmlinkage long sys_enact_mode(void)
168 list_for_each(pos, &_global_env->inactive_reservations){ 154 list_for_each(pos, &_global_env->inactive_reservations){
169 res = list_entry(pos, struct reservation, list); 155 res = list_entry(pos, struct reservation, list);
170 if (tsk_rt(res->tsk)->completed){ 156 if (tsk_rt(res->tsk)->completed){
171 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
172 res->reported = 1; 157 res->reported = 1;
173 res_reported--; 158 res_reported--;
174 } 159 }
175 } 160 }
161 seen_once = true;
162 }
163 if( ready ){ //C is throttled
164 mode = requested_mode;
165 _global_env = &_global_env_modes[mode];
166 //set res->reported for new global tasks
167 list_for_each(pos, &_global_env->active_reservations){
168 res = list_entry(pos, struct reservation, list);
169 res->reported = 0;
170 }
171 list_for_each(pos, &_global_env->depleted_reservations){
172 res = list_entry(pos, struct reservation, list);
173 res->reported = 0;
174 }
175 list_for_each(pos, &_global_env->inactive_reservations){
176 res = list_entry(pos, struct reservation, list);
177 res->reported = 0;
178 }
179 //gmp_update_time(_global_env, now);
180 sched_trace_enact_mode(current);
176 } 181 }
182
177 183
178 } 184 }
179 raw_spin_unlock(&mode_lock); 185 raw_spin_unlock(&mode_lock);
@@ -203,12 +209,17 @@ asmlinkage long sys_enact_mode(void)
203 */ 209 */
204asmlinkage long sys_request_mode(int new_mode){ 210asmlinkage long sys_request_mode(int new_mode){
205 raw_spin_lock(&mode_lock); 211 raw_spin_lock(&mode_lock);
206 if (mode != requested_mode){ 212 if (pending){
207 raw_spin_unlock(&mode_lock); 213 raw_spin_unlock(&mode_lock);
208 return -EAGAIN; 214 return -EAGAIN;
209 } 215 }
216 if (mode == new_mode){
217 raw_spin_unlock(&mode_lock);
218 return 0;
219 }
210 requested_mode = new_mode; 220 requested_mode = new_mode;
211 res_reported = mode_sizes[mode]; 221 res_reported = mode_sizes[mode];
222 seen_once = false;
212 raw_spin_unlock(&mode_lock); 223 raw_spin_unlock(&mode_lock);
213 return 0; 224 return 0;
214} 225}
@@ -670,14 +681,14 @@ static long mc2_complete_job(void)
670 state = cpu_state_for(tinfo->cpu); 681 state = cpu_state_for(tinfo->cpu);
671 raw_spin_lock(&state->lock); 682 raw_spin_lock(&state->lock);
672 env = &(state->sup_env->env); 683 env = &(state->sup_env->env);
673 res = sup_find_by_id(state->sup_env, tinfo->mc2_param.res_id[mode]); 684 res = sup_find_by_id(state->sup_env, tinfo->mc2_param.res_id);
674 env->time_zero = tsk_rt(current)->sporadic_release_time; 685 env->time_zero = tsk_rt(current)->sporadic_release_time;
675 } 686 }
676 else if (lv == CRIT_LEVEL_C) { 687 else if (lv == CRIT_LEVEL_C) {
677 state = local_cpu_state(); 688 state = local_cpu_state();
678 raw_spin_lock(&state->lock); 689 raw_spin_lock(&state->lock);
679 raw_spin_lock(&global_lock); 690 raw_spin_lock(&global_lock);
680 res = gmp_find_by_id(_global_env, tinfo->mc2_param.res_id[mode]); 691 res = gmp_find_by_id(_global_env, tinfo->mc2_param.res_id);
681 _global_env->env.time_zero = tsk_rt(current)->sporadic_release_time; 692 _global_env->env.time_zero = tsk_rt(current)->sporadic_release_time;
682 } 693 }
683 else 694 else
@@ -726,16 +737,15 @@ static long mc2_complete_job(void)
726 */ 737 */
727 738
728 raw_spin_lock(&mode_lock); 739 raw_spin_lock(&mode_lock);
729 if (lv == CRIT_LEVEL_C && mode != requested_mode){ 740 if (lv == CRIT_LEVEL_C && pending){
730 struct reservation *res = NULL; 741 struct reservation *res = NULL;
731 res = gmp_find_by_id(_global_env, tsk_mc2_data(current)->res_id[mode]); 742 res = gmp_find_by_id(_global_env, tsk_mc2_data(current)->res_id);
732 if (res && !res->reported){ 743 if (res && !res->reported){
733 res_reported--; 744 res_reported--;
734 745
735 res->reported = 1; 746 res->reported = 1;
736 //Current task doesn't exist in new mode 747 //Current task doesn't exist in new mode
737 if ( !in_mode(current, requested_mode) ){ 748 if ( !in_mode(current, requested_mode) ){
738 res->env->change_state(res->env, res, RESERVATION_INACTIVE);
739 raw_spin_unlock(&mode_lock); 749 raw_spin_unlock(&mode_lock);
740 litmus_reschedule_local(); 750 litmus_reschedule_local();
741 } 751 }
@@ -810,10 +820,14 @@ struct task_struct* mc2_global_dispatch(struct mc2_cpu_state* state)
810 enum crit_level lv; 820 enum crit_level lv;
811 lt_t time_slice; 821 lt_t time_slice;
812 822
823 raw_spin_lock(&mode_lock);
813 list_for_each_entry_safe(res, next, &_global_env->active_reservations, list) { 824 list_for_each_entry_safe(res, next, &_global_env->active_reservations, list) {
814 BUG_ON(!res); 825 BUG_ON(!res);
815 if (res->state == RESERVATION_ACTIVE && res->scheduled_on == NO_CPU) { 826 if (res->state == RESERVATION_ACTIVE && res->scheduled_on == NO_CPU) {
816 tsk = res->ops->dispatch_client(res, &time_slice); 827 tsk = res->ops->dispatch_client(res, &time_slice);
828 if (pending && res->reported && !in_mode(tsk, requested_mode)){
829 continue;
830 }
817 if (likely(tsk)) { 831 if (likely(tsk)) {
818 lv = get_task_crit_level(tsk); 832 lv = get_task_crit_level(tsk);
819 if (lv == NUM_CRIT_LEVELS) { 833 if (lv == NUM_CRIT_LEVELS) {
@@ -824,6 +838,7 @@ struct task_struct* mc2_global_dispatch(struct mc2_cpu_state* state)
824 res->blocked_by_ghost = 0; 838 res->blocked_by_ghost = 0;
825 res->is_ghost = NO_CPU; 839 res->is_ghost = NO_CPU;
826 res->scheduled_on = state->cpu; 840 res->scheduled_on = state->cpu;
841 raw_spin_unlock(&mode_lock);
827 return tsk; 842 return tsk;
828 } else if (lv == CRIT_LEVEL_C) { 843 } else if (lv == CRIT_LEVEL_C) {
829 //ce = &state->crit_entries[lv]; 844 //ce = &state->crit_entries[lv];
@@ -835,6 +850,7 @@ struct task_struct* mc2_global_dispatch(struct mc2_cpu_state* state)
835 res->blocked_by_ghost = 0; 850 res->blocked_by_ghost = 0;
836 res->is_ghost = NO_CPU; 851 res->is_ghost = NO_CPU;
837 res->scheduled_on = state->cpu; 852 res->scheduled_on = state->cpu;
853 raw_spin_unlock(&mode_lock);
838 return tsk; 854 return tsk;
839 //} else { 855 //} else {
840 // res->blocked_by_ghost = 1; 856 // res->blocked_by_ghost = 1;
@@ -847,7 +863,7 @@ struct task_struct* mc2_global_dispatch(struct mc2_cpu_state* state)
847 } 863 }
848 } 864 }
849 } 865 }
850 866 raw_spin_unlock(&mode_lock);
851 return NULL; 867 return NULL;
852} 868}
853 869
@@ -1145,19 +1161,19 @@ static long mc2_admit_task(struct task_struct *tsk)
1145 tinfo->mc2_param.crit = mp->crit; 1161 tinfo->mc2_param.crit = mp->crit;
1146 tinfo->cpu = task_cpu(tsk); 1162 tinfo->cpu = task_cpu(tsk);
1147 tinfo->has_departed = true; 1163 tinfo->has_departed = true;
1148 1164 tinfo->mc2_param.res_id = mp->res_id;
1165
1149 for(i = 0; i < NR_MODES; i++){ 1166 for(i = 0; i < NR_MODES; i++){
1150 if (!in_mode(tsk, i)){ 1167 if (!in_mode(tsk, i)){
1151 //task not present in mode 1168 //task not present in mode
1152 continue; 1169 continue;
1153 } 1170 }
1154 1171
1155 res = sup_find_by_id(&(state->sup_env_modes[i]), mp->res_id[i]); 1172 res = sup_find_by_id(&(state->sup_env_modes[i]), mp->res_id);
1156 1173
1157 /* found the appropriate reservation */ 1174 /* found the appropriate reservation */
1158 if (res) { 1175 if (res) {
1159 TRACE_TASK(tsk, "SUP FOUND RES ID\n"); 1176 TRACE_TASK(tsk, "SUP FOUND RES ID\n");
1160 tinfo->mc2_param.res_id[i] = mp->res_id[i];
1161 1177
1162 /* initial values */ 1178 /* initial values */
1163 err = err? err:mc2_task_client_init(&tinfo->res_info[i], &tinfo->mc2_param, tsk, res); 1179 err = err? err:mc2_task_client_init(&tinfo->res_info[i], &tinfo->mc2_param, tsk, res);
@@ -1186,19 +1202,19 @@ static long mc2_admit_task(struct task_struct *tsk)
1186 1202
1187 tinfo->mc2_param.crit = mp->crit; 1203 tinfo->mc2_param.crit = mp->crit;
1188 tinfo->cpu = -1; 1204 tinfo->cpu = -1;
1189 tinfo->has_departed = true; 1205 tinfo->has_departed = true;
1190 1206 tinfo->mc2_param.res_id = mp->res_id;
1207
1191 for(i = 0; i < NR_MODES; i++){ 1208 for(i = 0; i < NR_MODES; i++){
1192 if (!in_mode(tsk, i)) continue; 1209 if (!in_mode(tsk, i)) continue;
1193 res = gmp_find_by_id(_global_env, mp->res_id[mode]); 1210 res = gmp_find_by_id(_global_env, mp->res_id);
1194 1211
1195 /* found the appropriate reservation (or vCPU) */ 1212 /* found the appropriate reservation (or vCPU) */
1196 if (res) { 1213 if (res) {
1197 TRACE_TASK(tsk, "GMP FOUND RES ID\n"); 1214 TRACE_TASK(tsk, "GMP FOUND RES ID\n");
1198 tinfo->mc2_param.res_id[i] = mp->res_id[i];
1199 1215
1200 /* initial values */ 1216 /* initial values */
1201 err = err? err:mc2_task_client_init(&tinfo->res_info[mode], &tinfo->mc2_param, tsk, res); 1217 err = err? err:mc2_task_client_init(&tinfo->res_info[i], &tinfo->mc2_param, tsk, res);
1202 1218
1203 } 1219 }
1204 } 1220 }
@@ -1265,10 +1281,10 @@ static void mc2_task_new(struct task_struct *tsk, int on_runqueue,
1265 1281
1266 if (lv == CRIT_LEVEL_C) { 1282 if (lv == CRIT_LEVEL_C) {
1267 raw_spin_lock(&global_lock); 1283 raw_spin_lock(&global_lock);
1268 res = gmp_find_by_id(_global_env, tinfo->mc2_param.res_id[mode]); 1284 res = gmp_find_by_id(_global_env, tinfo->mc2_param.res_id);
1269 } 1285 }
1270 else { 1286 else {
1271 res = sup_find_by_id(state->sup_env, tinfo->mc2_param.res_id[mode]); 1287 res = sup_find_by_id(state->sup_env, tinfo->mc2_param.res_id);
1272 } 1288 }
1273 //res = res_find_by_id(state, tinfo->mc2_param.res_id); 1289 //res = res_find_by_id(state, tinfo->mc2_param.res_id);
1274 release = res->next_replenishment; 1290 release = res->next_replenishment;
@@ -1328,6 +1344,7 @@ static long mc2_reservation_destroy(unsigned int reservation_id, int cpu)
1328 1344
1329 /* if the reservation is global reservation */ 1345 /* if the reservation is global reservation */
1330 //state = local_cpu_state(); 1346 //state = local_cpu_state();
1347 //delete reservation id in all modes
1331 for(i = 0; i < NR_MODES; i++){ 1348 for(i = 0; i < NR_MODES; i++){
1332 //raw_spin_lock(&state->lock); 1349 //raw_spin_lock(&state->lock);
1333 1350
@@ -1361,7 +1378,6 @@ static long mc2_reservation_destroy(unsigned int reservation_id, int cpu)
1361 } 1378 }
1362 1379
1363 //raw_spin_unlock(&state->lock); 1380 //raw_spin_unlock(&state->lock);
1364 if (found) break;
1365 } 1381 }
1366 raw_spin_unlock(&global_lock); 1382 raw_spin_unlock(&global_lock);
1367 local_irq_restore(flags); 1383 local_irq_restore(flags);
@@ -1424,7 +1440,6 @@ static long mc2_reservation_destroy(unsigned int reservation_id, int cpu)
1424 1440
1425 raw_spin_unlock(&state->lock); 1441 raw_spin_unlock(&state->lock);
1426 local_irq_restore(flags); 1442 local_irq_restore(flags);
1427 if (found) break;
1428 } 1443 }
1429 } 1444 }
1430 1445
@@ -1531,7 +1546,6 @@ static long create_polling_reservation(
1531 struct reservation_config *config) 1546 struct reservation_config *config)
1532{ 1547{
1533 struct mc2_cpu_state *state; 1548 struct mc2_cpu_state *state;
1534 int i;
1535 //struct reservation* res = NULL; 1549 //struct reservation* res = NULL;
1536 struct polling_reservation *pres; 1550 struct polling_reservation *pres;
1537 unsigned long flags; 1551 unsigned long flags;
@@ -1579,13 +1593,9 @@ static long create_polling_reservation(
1579 //raw_spin_lock_irqsave(&_global_env.lock, flags); 1593 //raw_spin_lock_irqsave(&_global_env.lock, flags);
1580 state = cpu_state_for(config->cpu); 1594 state = cpu_state_for(config->cpu);
1581 raw_spin_lock_irqsave(&state->lock, flags); 1595 raw_spin_lock_irqsave(&state->lock, flags);
1582 //for the sake of reservation_destroy format, force id's unique across 1596 //force reservation id unique inside of res_config->mode
1583 //all modes 1597 if( sup_find_by_id(&(state->sup_env_modes[config->mode]), config->id) ){
1584 for(i = 0; i < NR_MODES; i++){ 1598 resExist = true;
1585 if( sup_find_by_id(&(state->sup_env_modes[i]), config->id) ){
1586 resExist = true;
1587 break;
1588 }
1589 } 1599 }
1590 if (!resExist) { 1600 if (!resExist) {
1591 polling_reservation_init(pres, use_edf, periodic, 1601 polling_reservation_init(pres, use_edf, periodic,
@@ -1615,12 +1625,9 @@ static long create_polling_reservation(
1615 } else { 1625 } else {
1616 raw_spin_lock_irqsave(&global_lock, flags); 1626 raw_spin_lock_irqsave(&global_lock, flags);
1617 1627
1618 //force id's unique across all modes 1628 //force id's unique within desired mode
1619 for(i = 0; i < NR_MODES; i++){ 1629 if (gmp_find_by_id(&(_global_env_modes[config->mode]), config->id)){
1620 if (gmp_find_by_id(&(_global_env_modes[i]), config->id)){ 1630 resExist = true;
1621 resExist = true;
1622 break;
1623 }
1624 } 1631 }
1625 if (!resExist) { 1632 if (!resExist) {
1626 polling_reservation_init(pres, use_edf, periodic, 1633 polling_reservation_init(pres, use_edf, periodic,
@@ -1856,6 +1863,8 @@ static long mc2_activate_plugin(void)
1856 raw_spin_lock_init(&_lowest_prio_cpu.lock); 1863 raw_spin_lock_init(&_lowest_prio_cpu.lock);
1857 raw_spin_lock_init(&mode_lock); 1864 raw_spin_lock_init(&mode_lock);
1858 1865
1866 seen_once = false;
1867
1859 for_each_online_cpu(cpu) { 1868 for_each_online_cpu(cpu) {
1860 TRACE("Initializing CPU%d...\n", cpu); 1869 TRACE("Initializing CPU%d...\n", cpu);
1861 1870
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c
index 67b5da0cb0ad..90d3fc9a299c 100644
--- a/litmus/sched_task_trace.c
+++ b/litmus/sched_task_trace.c
@@ -241,7 +241,7 @@ feather_callback void do_sched_trace_action(unsigned long id,
241 } 241 }
242} 242}
243 243
244feather_callback void do_sched_trace_enact(unsigned long id, 244feather_callback void do_sched_trace_enact_mode(unsigned long id,
245 unsigned long _task) 245 unsigned long _task)
246{ 246{
247 struct task_struct *t = (struct task_struct*) _task; 247 struct task_struct *t = (struct task_struct*) _task;
@@ -252,3 +252,15 @@ feather_callback void do_sched_trace_enact(unsigned long id,
252 put_record(rec); 252 put_record(rec);
253 } 253 }
254} 254}
255
256feather_callback void do_sched_trace_request_mode(unsigned long id,
257 unsigned long_ task)
258{
259 struct task_struct *t = (struct task_struct*) _task;
260 struct st_event_record* rec = get_record(ST_REQUEST_MODE, t);
261
262 if (rec){
263 rec->data.request_mode.when = now();
264 put_record(rec);
265 }
266}