aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-18 16:26:24 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-04-18 16:26:24 -0400
commitbf81930bba566a19f2ce4f4adb41c5fd7d45aae1 (patch)
treebe3d7aa7b78e4d84a3879e9101d4d27256065e47
parent4233ca1c82752fab3ab7cf5327ebfffcb9f4b73d (diff)
parent9dc2073ec433ed5b7bc7a70375c373b53470bbc5 (diff)
Merge branch 'master' of ssh://cvs/cvs/proj/litmus/repo/litmus2008
-rw-r--r--arch/sparc64/kernel/systbls.S3
-rw-r--r--arch/x86/kernel/syscall_table_32.S3
-rw-r--r--include/litmus/unistd.h3
-rw-r--r--litmus/fdso.c7
-rw-r--r--litmus/fmlp.c2
-rw-r--r--litmus/ftdev.c24
-rw-r--r--litmus/litmus.c23
-rw-r--r--litmus/rt_domain.c2
-rwxr-xr-xlitmus/sched_cedf.c2
-rwxr-xr-xlitmus/sched_pfair.c8
-rw-r--r--litmus/sched_task_trace.c2
-rw-r--r--litmus/srp.c8
-rw-r--r--litmus/sync.c4
13 files changed, 55 insertions, 36 deletions
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 7fc7615b57..7dcbac74f7 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -165,7 +165,8 @@ sys_call_table:
165 .word sys_set_rt_task_param, sys_get_rt_task_param, sys_complete_job, sys_register_np_flag, sys_exit_np 165 .word sys_set_rt_task_param, sys_get_rt_task_param, sys_complete_job, sys_register_np_flag, sys_exit_np
166/*320*/ 166/*320*/
167 .word sys_od_open, sys_od_close, sys_fmlp_down, sys_fmlp_up, sys_srp_down 167 .word sys_od_open, sys_od_close, sys_fmlp_down, sys_fmlp_up, sys_srp_down
168/*325*/ .word sys_srp_up, sys_query_job_no, sys_wait_for_job_release, sys_wait_for_ts_release, sys_release_ts 168/*325*/ .word sys_srp_up, sys_query_job_no, sys_wait_for_job_release, sys_wait_for_ts_release
169/*330*/ .word sys_release_ts, sys_null_call
169 170
170#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 171#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
171 defined(CONFIG_SOLARIS_EMUL_MODULE) 172 defined(CONFIG_SOLARIS_EMUL_MODULE)
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index f6fdb0a885..65496c26da 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -339,4 +339,5 @@ ENTRY(sys_call_table)
339 .long sys_query_job_no 339 .long sys_query_job_no
340 .long sys_wait_for_job_release 340 .long sys_wait_for_job_release
341 .long sys_wait_for_ts_release 341 .long sys_wait_for_ts_release
342 .long sys_release_ts /* 339 */ 342 .long sys_release_ts
343 .long sys_null_call /* 340 */
diff --git a/include/litmus/unistd.h b/include/litmus/unistd.h
index 8224235d95..5ef367f491 100644
--- a/include/litmus/unistd.h
+++ b/include/litmus/unistd.h
@@ -16,5 +16,6 @@
16#define __NR_wait_for_job_release __LSC(12) 16#define __NR_wait_for_job_release __LSC(12)
17#define __NR_wait_for_ts_release __LSC(13) 17#define __NR_wait_for_ts_release __LSC(13)
18#define __NR_release_ts __LSC(14) 18#define __NR_release_ts __LSC(14)
19#define __NR_null_call __LSC(15)
19 20
20#define NR_litmus_syscalls 15 21#define NR_litmus_syscalls 16
diff --git a/litmus/fdso.c b/litmus/fdso.c
index 81ab0afff3..bdc0466f9e 100644
--- a/litmus/fdso.c
+++ b/litmus/fdso.c
@@ -67,7 +67,7 @@ static struct inode_obj_id* alloc_inode_obj(struct inode* inode,
67 if (!raw_obj) 67 if (!raw_obj)
68 return NULL; 68 return NULL;
69 69
70 obj = kmalloc(sizeof(struct inode_obj_id), GFP_KERNEL); 70 obj = kmalloc(sizeof(*obj), GFP_KERNEL);
71 if (!obj) 71 if (!obj)
72 return NULL; 72 return NULL;
73 INIT_LIST_HEAD(&obj->list); 73 INIT_LIST_HEAD(&obj->list);
@@ -134,9 +134,8 @@ static struct od_table_entry* get_od_entry(struct task_struct* t)
134 134
135 table = t->od_table; 135 table = t->od_table;
136 if (!table) { 136 if (!table) {
137 table = (struct od_table_entry*) 137 table = kzalloc(sizeof(*table) * MAX_OBJECT_DESCRIPTORS,
138 kzalloc(sizeof(struct od_table_entry) * 138 GFP_KERNEL);
139 MAX_OBJECT_DESCRIPTORS, GFP_KERNEL);
140 t->od_table = table; 139 t->od_table = table;
141 } 140 }
142 141
diff --git a/litmus/fmlp.c b/litmus/fmlp.c
index f34eeea9ab..820af8e00e 100644
--- a/litmus/fmlp.c
+++ b/litmus/fmlp.c
@@ -23,7 +23,7 @@ static void* create_fmlp_semaphore(void)
23 struct pi_semaphore* sem; 23 struct pi_semaphore* sem;
24 int i; 24 int i;
25 25
26 sem = kmalloc(sizeof(struct pi_semaphore), GFP_KERNEL); 26 sem = kmalloc(sizeof(*sem), GFP_KERNEL);
27 if (!sem) 27 if (!sem)
28 return NULL; 28 return NULL;
29 atomic_set(&sem->count, 1); 29 atomic_set(&sem->count, 1);
diff --git a/litmus/ftdev.c b/litmus/ftdev.c
index a62ccecf64..1c1c241a0a 100644
--- a/litmus/ftdev.c
+++ b/litmus/ftdev.c
@@ -15,7 +15,7 @@ struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size)
15 char* mem; 15 char* mem;
16 int order = 0, pages = 1; 16 int order = 0, pages = 1;
17 17
18 buf = kmalloc(sizeof(struct ft_buffer), GFP_KERNEL); 18 buf = kmalloc(sizeof(*buf), GFP_KERNEL);
19 if (!buf) 19 if (!buf)
20 return NULL; 20 return NULL;
21 21
@@ -65,7 +65,7 @@ struct ftdev_event {
65 65
66static int activate(struct ftdev_event** chain, int id) 66static int activate(struct ftdev_event** chain, int id)
67{ 67{
68 struct ftdev_event* ev = kmalloc(sizeof(struct ftdev_event), GFP_KERNEL); 68 struct ftdev_event* ev = kmalloc(sizeof(*ev), GFP_KERNEL);
69 if (ev) { 69 if (ev) {
70 printk(KERN_INFO 70 printk(KERN_INFO
71 "Enabling feather-trace event %d.\n", (int) id); 71 "Enabling feather-trace event %d.\n", (int) id);
@@ -110,7 +110,7 @@ static int ftdev_open(struct inode *in, struct file *filp)
110 } 110 }
111 if (ftdev->can_open && (err = ftdev->can_open(ftdev, buf_idx))) 111 if (ftdev->can_open && (err = ftdev->can_open(ftdev, buf_idx)))
112 goto out; 112 goto out;
113 113
114 ftdm = ftdev->minor + buf_idx; 114 ftdm = ftdev->minor + buf_idx;
115 filp->private_data = ftdm; 115 filp->private_data = ftdm;
116 116
@@ -258,15 +258,15 @@ static ssize_t ftdev_write(struct file *filp, const char __user *from,
258 cmd_t cmd; 258 cmd_t cmd;
259 cmd_t id; 259 cmd_t id;
260 260
261 if (len % sizeof(cmd_t) || len < 2 * sizeof(cmd_t)) 261 if (len % sizeof(cmd) || len < 2 * sizeof(cmd))
262 goto out; 262 goto out;
263 263
264 if (copy_from_user(&cmd, from, sizeof(cmd_t))) { 264 if (copy_from_user(&cmd, from, sizeof(cmd))) {
265 err = -EFAULT; 265 err = -EFAULT;
266 goto out; 266 goto out;
267 } 267 }
268 len -= sizeof(cmd_t); 268 len -= sizeof(cmd);
269 from += sizeof(cmd_t); 269 from += sizeof(cmd);
270 270
271 if (cmd != FTDEV_ENABLE_CMD && cmd != FTDEV_DISABLE_CMD) 271 if (cmd != FTDEV_ENABLE_CMD && cmd != FTDEV_DISABLE_CMD)
272 goto out; 272 goto out;
@@ -276,22 +276,22 @@ static ssize_t ftdev_write(struct file *filp, const char __user *from,
276 goto out; 276 goto out;
277 } 277 }
278 278
279 err = sizeof(cmd_t); 279 err = sizeof(cmd);
280 while (len) { 280 while (len) {
281 if (copy_from_user(&id, from, sizeof(cmd_t))) { 281 if (copy_from_user(&id, from, sizeof(cmd))) {
282 err = -EFAULT; 282 err = -EFAULT;
283 goto out_unlock; 283 goto out_unlock;
284 } 284 }
285 /* FIXME: check id against list of acceptable events */ 285 /* FIXME: check id against list of acceptable events */
286 len -= sizeof(cmd_t); 286 len -= sizeof(cmd);
287 from += sizeof(cmd_t); 287 from += sizeof(cmd);
288 if (cmd == FTDEV_DISABLE_CMD) 288 if (cmd == FTDEV_DISABLE_CMD)
289 deactivate(&ftdm->events, id); 289 deactivate(&ftdm->events, id);
290 else if (activate(&ftdm->events, id) != 0) { 290 else if (activate(&ftdm->events, id) != 0) {
291 err = -ENOMEM; 291 err = -ENOMEM;
292 goto out_unlock; 292 goto out_unlock;
293 } 293 }
294 err += sizeof(cmd_t); 294 err += sizeof(cmd);
295 } 295 }
296 296
297out_unlock: 297out_unlock:
diff --git a/litmus/litmus.c b/litmus/litmus.c
index f9734c1c2e..911826a386 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -247,7 +247,7 @@ static void __scheduler_signal(struct task_struct *t, unsigned int signo,
247{ 247{
248 struct sched_sig* sig; 248 struct sched_sig* sig;
249 249
250 sig = kmalloc(GFP_ATOMIC, sizeof(struct sched_sig)); 250 sig = kmalloc(GFP_ATOMIC, sizeof(*sig));
251 if (!sig) { 251 if (!sig) {
252 TRACE_TASK(t, "dropping signal: %u\n", t); 252 TRACE_TASK(t, "dropping signal: %u\n", t);
253 return; 253 return;
@@ -479,6 +479,23 @@ asmlinkage long sys_exit_np(void)
479#endif /* CONFIG_NP_SECTION */ 479#endif /* CONFIG_NP_SECTION */
480 480
481 481
482/* sys_null_call() is only used for determining raw system call
483 * overheads (kernel entry, kernel exit). It has no useful side effects.
484 * If ts is non-NULL, then the current Feather-Trace time is recorded.
485 */
486asmlinkage long sys_null_call(cycles_t __user *ts)
487{
488 long ret = 0;
489 cycles_t now;
490
491 if (ts) {
492 now = get_cycles();
493 ret = put_user(now, ts);
494 }
495
496 return ret;
497}
498
482/* p is a real-time task. Re-init its state as a best-effort task. */ 499/* p is a real-time task. Re-init its state as a best-effort task. */
483static void reinit_litmus_state(struct task_struct* p, int restore) 500static void reinit_litmus_state(struct task_struct* p, int restore)
484{ 501{
@@ -500,7 +517,7 @@ static void reinit_litmus_state(struct task_struct* p, int restore)
500// __setscheduler(p, p->rt_param.old_policy, p->rt_param.old_prio); 517// __setscheduler(p, p->rt_param.old_policy, p->rt_param.old_prio);
501 518
502 /* Cleanup everything else. */ 519 /* Cleanup everything else. */
503 memset(&p->rt_param, 0, sizeof(struct rt_task)); 520 memset(&p->rt_param, 0, sizeof(user_config));
504 521
505 /* Restore preserved fields. */ 522 /* Restore preserved fields. */
506 if (restore) { 523 if (restore) {
@@ -595,7 +612,7 @@ int switch_sched_plugin(struct sched_plugin* plugin)
595 goto out; 612 goto out;
596 ret = plugin->activate_plugin(); 613 ret = plugin->activate_plugin();
597 if (0 != ret) { 614 if (0 != ret) {
598 printk(KERN_INFO "Can't activate %s (%d).\n", 615 printk(KERN_INFO "Can't activate %s (%d).\n",
599 plugin->plugin_name, ret); 616 plugin->plugin_name, ret);
600 plugin = &linux_sched_plugin; 617 plugin = &linux_sched_plugin;
601 } 618 }
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c
index be4ef5ea6a..d0a243fc6f 100644
--- a/litmus/rt_domain.c
+++ b/litmus/rt_domain.c
@@ -80,7 +80,7 @@ static struct release_heap* get_release_heap(rt_domain_t *rt, lt_t release_time)
80 if (!heap) { 80 if (!heap) {
81 /* must create new node */ 81 /* must create new node */
82 /* FIXME: use a kmemcache_t */ 82 /* FIXME: use a kmemcache_t */
83 rh = kmalloc(sizeof(struct release_heap), GFP_ATOMIC); 83 rh = kmalloc(sizeof(*rh), GFP_ATOMIC);
84 if (unlikely(!rh)) 84 if (unlikely(!rh))
85 /* Should be handled somehow. 85 /* Should be handled somehow.
86 * For now, let's just hope there is 86 * For now, let's just hope there is
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 6c32e1c06c..ee5e5c8e07 100755
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -661,7 +661,7 @@ static void cedf_domain_init(int first_cpu, int last_cpu)
661 int cpu; 661 int cpu;
662 662
663 /* Create new domain for this cluster. */ 663 /* Create new domain for this cluster. */
664 cedf_domain_t *new_cedf_domain = kmalloc(sizeof(cedf_domain_t), 664 cedf_domain_t *new_cedf_domain = kmalloc(sizeof(*new_cedf_domain),
665 GFP_KERNEL); 665 GFP_KERNEL);
666 666
667 /* Initialize cluster domain. */ 667 /* Initialize cluster domain. */
diff --git a/litmus/sched_pfair.c b/litmus/sched_pfair.c
index d0c06e03a7..053cd27ae4 100755
--- a/litmus/sched_pfair.c
+++ b/litmus/sched_pfair.c
@@ -434,7 +434,7 @@ static void schedule_next_quantum(quanta_t time)
434 434
435 for (cpu = 0; cpu < NR_CPUS; cpu++) 435 for (cpu = 0; cpu < NR_CPUS; cpu++)
436 if (pstate[cpu]->linked) 436 if (pstate[cpu]->linked)
437 PTRACE_TASK(pstate[cpu]->linked, 437 PTRACE_TASK(pstate[cpu]->linked,
438 " linked on %d.\n", cpu); 438 " linked on %d.\n", cpu);
439 else 439 else
440 PTRACE("(null) linked on %d.\n", cpu); 440 PTRACE("(null) linked on %d.\n", cpu);
@@ -511,7 +511,7 @@ static void pfair_tick(struct task_struct* t)
511 cur = current_quantum(state); 511 cur = current_quantum(state);
512 PTRACE("q %lu at %llu\n", cur, litmus_clock()); 512 PTRACE("q %lu at %llu\n", cur, litmus_clock());
513 513
514 /* Attempt to advance time. First CPU to get here 514 /* Attempt to advance time. First CPU to get here
515 * will prepare the next quantum. 515 * will prepare the next quantum.
516 */ 516 */
517 time = cmpxchg(&pfair_time, 517 time = cmpxchg(&pfair_time,
@@ -551,7 +551,7 @@ static void pfair_tick(struct task_struct* t)
551 551
552 if (state->local != current 552 if (state->local != current
553 && (is_realtime(current) || is_present(state->local))) 553 && (is_realtime(current) || is_present(state->local)))
554 set_tsk_need_resched(current); 554 set_tsk_need_resched(current);
555} 555}
556 556
557static int safe_to_schedule(struct task_struct* t, int cpu) 557static int safe_to_schedule(struct task_struct* t, int cpu)
@@ -802,7 +802,7 @@ static long pfair_admit_task(struct task_struct* t)
802 period = 1; 802 period = 1;
803 } 803 }
804 804
805 param = kmalloc(sizeof(struct pfair_param) + 805 param = kmalloc(sizeof(*param) +
806 quanta * sizeof(struct subtask), GFP_ATOMIC); 806 quanta * sizeof(struct subtask), GFP_ATOMIC);
807 807
808 if (!param) 808 if (!param)
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c
index 4b546a86d6..913d999dfe 100644
--- a/litmus/sched_task_trace.c
+++ b/litmus/sched_task_trace.c
@@ -148,7 +148,7 @@ feather_callback void do_sched_trace_task_switch_away(unsigned long id, unsigned
148 } 148 }
149} 149}
150 150
151feather_callback void do_sched_trace_task_completion(unsigned long id, unsigned long _task, 151feather_callback void do_sched_trace_task_completion(unsigned long id, unsigned long _task,
152 unsigned long forced) 152 unsigned long forced)
153{ 153{
154 struct task_struct *t = (struct task_struct*) _task; 154 struct task_struct *t = (struct task_struct*) _task;
diff --git a/litmus/srp.c b/litmus/srp.c
index 6e670f9138..71639b9916 100644
--- a/litmus/srp.c
+++ b/litmus/srp.c
@@ -78,7 +78,7 @@ struct srp_semaphore {
78 int cpu; /* cpu associated with this "semaphore" and resource */ 78 int cpu; /* cpu associated with this "semaphore" and resource */
79}; 79};
80 80
81#define ceiling2sem(c) container_of(c, struct srp_semaphore, ceiling) 81#define ceiling2sem(c) container_of(c, struct srp_semaphore, ceiling)
82 82
83static int srp_exceeds_ceiling(struct task_struct* first, 83static int srp_exceeds_ceiling(struct task_struct* first,
84 struct srp* srp) 84 struct srp* srp)
@@ -86,7 +86,7 @@ static int srp_exceeds_ceiling(struct task_struct* first,
86 return list_empty(&srp->ceiling) || 86 return list_empty(&srp->ceiling) ||
87 get_rt_period(first) < system_ceiling(srp)->period || 87 get_rt_period(first) < system_ceiling(srp)->period ||
88 (get_rt_period(first) == system_ceiling(srp)->period && 88 (get_rt_period(first) == system_ceiling(srp)->period &&
89 first->pid < system_ceiling(srp)->pid) || 89 first->pid < system_ceiling(srp)->pid) ||
90 ceiling2sem(system_ceiling(srp))->owner == first; 90 ceiling2sem(system_ceiling(srp))->owner == first;
91} 91}
92 92
@@ -176,7 +176,7 @@ static void do_srp_down(struct srp_semaphore* sem)
176} 176}
177 177
178static void do_srp_up(struct srp_semaphore* sem) 178static void do_srp_up(struct srp_semaphore* sem)
179{ 179{
180 /* Determine new system priority ceiling for this CPU. */ 180 /* Determine new system priority ceiling for this CPU. */
181 WARN_ON(!in_list(&sem->ceiling.list)); 181 WARN_ON(!in_list(&sem->ceiling.list));
182 if (in_list(&sem->ceiling.list)) 182 if (in_list(&sem->ceiling.list))
@@ -296,7 +296,7 @@ void srp_ceiling_block(void)
296 do_ceiling_block(tsk); 296 do_ceiling_block(tsk);
297 TRACE_CUR("finally exceeds system ceiling.\n"); 297 TRACE_CUR("finally exceeds system ceiling.\n");
298 } else 298 } else
299 TRACE_CUR("is not priority ceiling blocked\n"); 299 TRACE_CUR("is not priority ceiling blocked\n");
300 preempt_enable(); 300 preempt_enable();
301} 301}
302 302
diff --git a/litmus/sync.c b/litmus/sync.c
index 8b0ebea49a..9c9941fc27 100644
--- a/litmus/sync.c
+++ b/litmus/sync.c
@@ -44,7 +44,7 @@ static long do_release_ts(lt_t start)
44 44
45 spin_lock_irqsave(&ts_release.wait.lock, flags); 45 spin_lock_irqsave(&ts_release.wait.lock, flags);
46 TRACE("<<<<<< synchronous task system release >>>>>>\n"); 46 TRACE("<<<<<< synchronous task system release >>>>>>\n");
47 47
48 sched_trace_sys_release(&start); 48 sched_trace_sys_release(&start);
49 list_for_each(pos, &ts_release.wait.task_list) { 49 list_for_each(pos, &ts_release.wait.task_list) {
50 t = (struct task_struct*) list_entry(pos, 50 t = (struct task_struct*) list_entry(pos,
@@ -82,7 +82,7 @@ asmlinkage long sys_release_ts(lt_t __user *__delay)
82 82
83 /* FIXME: check capabilities... */ 83 /* FIXME: check capabilities... */
84 84
85 ret = copy_from_user(&delay, __delay, sizeof(lt_t)); 85 ret = copy_from_user(&delay, __delay, sizeof(delay));
86 if (ret == 0) 86 if (ret == 0)
87 ret = do_release_ts(litmus_clock() + delay); 87 ret = do_release_ts(litmus_clock() + delay);
88 88