diff options
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r-- | litmus/litmus.c | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index 301390148d02..ea3ffade6490 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -21,6 +21,10 @@ | |||
21 | #include <litmus/affinity.h> | 21 | #include <litmus/affinity.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifdef CONFIG_LITMUS_NVIDIA | ||
25 | #include <litmus/nvidia_info.h> | ||
26 | #endif | ||
27 | |||
24 | /* Number of RT tasks that exist in the system */ | 28 | /* Number of RT tasks that exist in the system */ |
25 | atomic_t rt_task_count = ATOMIC_INIT(0); | 29 | atomic_t rt_task_count = ATOMIC_INIT(0); |
26 | static DEFINE_RAW_SPINLOCK(task_transition_lock); | 30 | static DEFINE_RAW_SPINLOCK(task_transition_lock); |
@@ -51,6 +55,28 @@ void bheap_node_free(struct bheap_node* hn) | |||
51 | struct release_heap* release_heap_alloc(int gfp_flags); | 55 | struct release_heap* release_heap_alloc(int gfp_flags); |
52 | void release_heap_free(struct release_heap* rh); | 56 | void release_heap_free(struct release_heap* rh); |
53 | 57 | ||
58 | #ifdef CONFIG_LITMUS_NVIDIA | ||
59 | /* | ||
60 | * sys_register_nv_device | ||
61 | * @nv_device_id: The Nvidia device id that the task want to register | ||
62 | * @reg_action: set to '1' to register the specified device. zero otherwise. | ||
63 | * Syscall for register task's designated nvidia device into NV_DEVICE_REG array | ||
64 | * Returns EFAULT if nv_device_id is out of range. | ||
65 | * 0 if success | ||
66 | */ | ||
67 | asmlinkage long sys_register_nv_device(int nv_device_id, int reg_action) | ||
68 | { | ||
69 | /* register the device to caller (aka 'current') */ | ||
70 | return(reg_nv_device(nv_device_id, reg_action)); | ||
71 | } | ||
72 | #else | ||
73 | asmlinkage long sys_register_nv_device(int nv_device_id, int reg_action) | ||
74 | { | ||
75 | return(-EINVAL); | ||
76 | } | ||
77 | #endif | ||
78 | |||
79 | |||
54 | /* | 80 | /* |
55 | * sys_set_task_rt_param | 81 | * sys_set_task_rt_param |
56 | * @pid: Pid of the task which scheduling parameters must be changed | 82 | * @pid: Pid of the task which scheduling parameters must be changed |
@@ -135,6 +161,22 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, struct rt_task __user * param) | |||
135 | 161 | ||
136 | target->rt_param.task_params = tp; | 162 | target->rt_param.task_params = tp; |
137 | 163 | ||
164 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
165 | /* proxy thread off by default */ | ||
166 | target->rt_param.is_proxy_thread = 0; | ||
167 | target->rt_param.cur_klitirqd = NULL; | ||
168 | //init_MUTEX(&target->rt_param.klitirqd_sem); | ||
169 | mutex_init(&target->rt_param.klitirqd_sem); | ||
170 | //init_completion(&target->rt_param.klitirqd_sem); | ||
171 | //target->rt_param.klitirqd_sem_stat = NOT_HELD; | ||
172 | atomic_set(&target->rt_param.klitirqd_sem_stat, NOT_HELD); | ||
173 | #endif | ||
174 | |||
175 | #ifdef CONFIG_LITMUS_NVIDIA | ||
176 | atomic_set(&target->rt_param.nv_int_count, 0); | ||
177 | #endif | ||
178 | |||
179 | |||
138 | retval = 0; | 180 | retval = 0; |
139 | out_unlock: | 181 | out_unlock: |
140 | read_unlock_irq(&tasklist_lock); | 182 | read_unlock_irq(&tasklist_lock); |
@@ -269,6 +311,7 @@ asmlinkage long sys_query_job_no(unsigned int __user *job) | |||
269 | return retval; | 311 | return retval; |
270 | } | 312 | } |
271 | 313 | ||
314 | |||
272 | /* sys_null_call() is only used for determining raw system call | 315 | /* sys_null_call() is only used for determining raw system call |
273 | * overheads (kernel entry, kernel exit). It has no useful side effects. | 316 | * overheads (kernel entry, kernel exit). It has no useful side effects. |
274 | * If ts is non-NULL, then the current Feather-Trace time is recorded. | 317 | * If ts is non-NULL, then the current Feather-Trace time is recorded. |
@@ -282,7 +325,7 @@ asmlinkage long sys_null_call(cycles_t __user *ts) | |||
282 | now = get_cycles(); | 325 | now = get_cycles(); |
283 | ret = put_user(now, ts); | 326 | ret = put_user(now, ts); |
284 | } | 327 | } |
285 | 328 | ||
286 | return ret; | 329 | return ret; |
287 | } | 330 | } |
288 | 331 | ||
@@ -303,6 +346,20 @@ static void reinit_litmus_state(struct task_struct* p, int restore) | |||
303 | * at this point in time. | 346 | * at this point in time. |
304 | */ | 347 | */ |
305 | WARN_ON(p->rt_param.inh_task); | 348 | WARN_ON(p->rt_param.inh_task); |
349 | |||
350 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
351 | /* We probably should not have any tasklets executing for | ||
352 | * us at this time. | ||
353 | */ | ||
354 | WARN_ON(p->rt_param.cur_klitirqd); | ||
355 | WARN_ON(atomic_read(&p->rt_param.klitirqd_sem_stat) == HELD); | ||
356 | |||
357 | if(p->rt_param.cur_klitirqd) | ||
358 | flush_pending(p->rt_param.cur_klitirqd, p); | ||
359 | |||
360 | if(atomic_read(&p->rt_param.klitirqd_sem_stat) == HELD) | ||
361 | up_and_set_stat(p, NOT_HELD, &p->rt_param.klitirqd_sem); | ||
362 | #endif | ||
306 | 363 | ||
307 | /* Cleanup everything else. */ | 364 | /* Cleanup everything else. */ |
308 | memset(&p->rt_param, 0, sizeof(p->rt_param)); | 365 | memset(&p->rt_param, 0, sizeof(p->rt_param)); |
@@ -403,7 +460,7 @@ static void synch_on_plugin_switch(void* info) | |||
403 | */ | 460 | */ |
404 | int switch_sched_plugin(struct sched_plugin* plugin) | 461 | int switch_sched_plugin(struct sched_plugin* plugin) |
405 | { | 462 | { |
406 | unsigned long flags; | 463 | //unsigned long flags; |
407 | int ret = 0; | 464 | int ret = 0; |
408 | 465 | ||
409 | BUG_ON(!plugin); | 466 | BUG_ON(!plugin); |
@@ -417,8 +474,15 @@ int switch_sched_plugin(struct sched_plugin* plugin) | |||
417 | while (atomic_read(&cannot_use_plugin) < num_online_cpus()) | 474 | while (atomic_read(&cannot_use_plugin) < num_online_cpus()) |
418 | cpu_relax(); | 475 | cpu_relax(); |
419 | 476 | ||
477 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
478 | if(!klitirqd_is_dead()) | ||
479 | { | ||
480 | kill_klitirqd(); | ||
481 | } | ||
482 | #endif | ||
483 | |||
420 | /* stop task transitions */ | 484 | /* stop task transitions */ |
421 | raw_spin_lock_irqsave(&task_transition_lock, flags); | 485 | //raw_spin_lock_irqsave(&task_transition_lock, flags); |
422 | 486 | ||
423 | /* don't switch if there are active real-time tasks */ | 487 | /* don't switch if there are active real-time tasks */ |
424 | if (atomic_read(&rt_task_count) == 0) { | 488 | if (atomic_read(&rt_task_count) == 0) { |
@@ -436,7 +500,7 @@ int switch_sched_plugin(struct sched_plugin* plugin) | |||
436 | } else | 500 | } else |
437 | ret = -EBUSY; | 501 | ret = -EBUSY; |
438 | out: | 502 | out: |
439 | raw_spin_unlock_irqrestore(&task_transition_lock, flags); | 503 | //raw_spin_unlock_irqrestore(&task_transition_lock, flags); |
440 | atomic_set(&cannot_use_plugin, 0); | 504 | atomic_set(&cannot_use_plugin, 0); |
441 | return ret; | 505 | return ret; |
442 | } | 506 | } |