diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-09 17:00:54 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-09 17:00:54 -0500 |
commit | 1235a665a5e00dc762e6646c01381b3ed5019d86 (patch) | |
tree | 3947c065b1407e3ee60a10926047b4db8a353314 /litmus/litmus.c | |
parent | 642eadd6b82daaeeb3247c2417bf58d113639a1c (diff) |
Enable sched_trace log injection from userspacewip-gpu-cleanup
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r-- | litmus/litmus.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index 1b4b9d25dbdc..6a1095aa7725 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -310,6 +310,79 @@ asmlinkage long sys_null_call(cycles_t __user *ts) | |||
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
313 | |||
314 | asmlinkage long sys_sched_trace_event(int event, struct st_inject_args __user *__args) | ||
315 | { | ||
316 | long retval = 0; | ||
317 | struct task_struct* t = current; | ||
318 | |||
319 | struct st_inject_args args; | ||
320 | |||
321 | if (is_realtime(t)) { | ||
322 | printk(KERN_WARNING "Only non-real-time tasks may inject sched_trace events.\n"); | ||
323 | retval = -EINVAL; | ||
324 | goto out; | ||
325 | } | ||
326 | |||
327 | if (__args && copy_from_user(&args, __args, sizeof(args))) { | ||
328 | retval = -EFAULT; | ||
329 | goto out; | ||
330 | } | ||
331 | |||
332 | switch(event) { | ||
333 | /*************************************/ | ||
334 | /* events that don't need parameters */ | ||
335 | /*************************************/ | ||
336 | case ST_INJECT_NAME: | ||
337 | sched_trace_task_name(t); | ||
338 | break; | ||
339 | case ST_INJECT_PARAM: | ||
340 | /* presumes sporadic_task_ns() has already been called | ||
341 | * and valid data has been initialized even if the calling | ||
342 | * task is SCHED_NORMAL. */ | ||
343 | sched_trace_task_param(t); | ||
344 | break; | ||
345 | |||
346 | /*******************************/ | ||
347 | /* events that need parameters */ | ||
348 | /*******************************/ | ||
349 | case ST_INJECT_COMPLETION: | ||
350 | if (!__args) { | ||
351 | retval = -EINVAL; | ||
352 | goto out; | ||
353 | } | ||
354 | |||
355 | /* slam in the data */ | ||
356 | t->rt_param.job_params.job_no = args.job_no; | ||
357 | |||
358 | sched_trace_task_completion(t, 0); | ||
359 | break; | ||
360 | case ST_INJECT_RELEASE: | ||
361 | if (!__args) { | ||
362 | retval = -EINVAL; | ||
363 | goto out; | ||
364 | } | ||
365 | |||
366 | /* slam in the data */ | ||
367 | tsk_rt(t)->job_params.release = args.release; | ||
368 | tsk_rt(t)->job_params.deadline = args.deadline; | ||
369 | |||
370 | sched_trace_task_release(t); | ||
371 | break; | ||
372 | |||
373 | /**********************/ | ||
374 | /* unsupported events */ | ||
375 | /**********************/ | ||
376 | default: | ||
377 | retval = -EINVAL; | ||
378 | break; | ||
379 | } | ||
380 | |||
381 | out: | ||
382 | return retval; | ||
383 | } | ||
384 | |||
385 | |||
313 | #if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_AFFINITY_LOCKING) | 386 | #if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_AFFINITY_LOCKING) |
314 | void init_gpu_affinity_state(struct task_struct* p) | 387 | void init_gpu_affinity_state(struct task_struct* p) |
315 | { | 388 | { |