From 6678944975e0eccc51039121fadaa7d29858bec2 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Fri, 8 Feb 2013 13:07:07 -0500 Subject: Extend support for PRIOQ_MUTEX --- include/litmus/fifo_lock.h | 4 ++-- include/litmus/ikglp_lock.h | 7 +++++-- include/litmus/kfmlp_lock.h | 9 +++++---- litmus/Kconfig | 5 ++++- litmus/fifo_lock.c | 1 - litmus/litmus.c | 2 ++ litmus/sched_cedf.c | 42 +++++++++++++++++++++++++++++++++++++++--- litmus/sched_gsn_edf.c | 7 ++++--- 8 files changed, 61 insertions(+), 16 deletions(-) diff --git a/include/litmus/fifo_lock.h b/include/litmus/fifo_lock.h index 4b970806117f..7f13863f11e6 100644 --- a/include/litmus/fifo_lock.h +++ b/include/litmus/fifo_lock.h @@ -1,5 +1,5 @@ -#ifndef LITMUS_fifo_H -#define LITMUS_fifo_H +#ifndef LITMUS_FIFO_H +#define LITMUS_FIFO_H #include #include diff --git a/include/litmus/ikglp_lock.h b/include/litmus/ikglp_lock.h index af155eadbb35..f9178d3dfba9 100644 --- a/include/litmus/ikglp_lock.h +++ b/include/litmus/ikglp_lock.h @@ -107,7 +107,7 @@ struct litmus_lock* ikglp_new(int m, struct litmus_lock_ops*, void* __user arg); -#if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA) +#ifdef CONFIG_LITMUS_AFFINITY_LOCKING struct ikglp_queue_info { @@ -153,12 +153,15 @@ static inline struct ikglp_affinity* ikglp_aff_obs_from_aff_obs(struct affinity_ int ikglp_aff_obs_close(struct affinity_observer*); void ikglp_aff_obs_free(struct affinity_observer*); + +#ifdef CONFIG_LITMUS_NVIDIA struct affinity_observer* ikglp_gpu_aff_obs_new(struct affinity_observer_ops*, void* __user arg); struct affinity_observer* ikglp_simple_gpu_aff_obs_new(struct affinity_observer_ops*, void* __user arg); #endif - +#endif /* end affinity */ #endif + diff --git a/include/litmus/kfmlp_lock.h b/include/litmus/kfmlp_lock.h index 5f0aae6e6f42..3609a3a20424 100644 --- a/include/litmus/kfmlp_lock.h +++ b/include/litmus/kfmlp_lock.h @@ -46,7 +46,7 @@ int kfmlp_close(struct litmus_lock* l); void kfmlp_free(struct litmus_lock* l); struct litmus_lock* kfmlp_new(struct litmus_lock_ops*, void* __user arg); -#if defined(CONFIG_LITMUS_AFFINITY_LOCKING) && defined(CONFIG_LITMUS_NVIDIA) +#ifdef CONFIG_LITMUS_AFFINITY_LOCKING struct kfmlp_queue_info { @@ -84,14 +84,15 @@ static inline struct kfmlp_affinity* kfmlp_aff_obs_from_aff_obs(struct affinity_ int kfmlp_aff_obs_close(struct affinity_observer*); void kfmlp_aff_obs_free(struct affinity_observer*); + +#ifdef CONFIG_LITMUS_NVIDIA struct affinity_observer* kfmlp_gpu_aff_obs_new(struct affinity_observer_ops*, void* __user arg); struct affinity_observer* kfmlp_simple_gpu_aff_obs_new(struct affinity_observer_ops*, void* __user arg); - - #endif -#endif +#endif /* end affinity */ +#endif diff --git a/litmus/Kconfig b/litmus/Kconfig index fad4220ae49f..8dd3955f671d 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig @@ -59,7 +59,8 @@ config REALTIME_AUX_TASKS choice prompt "Scheduling prioritization of AUX tasks." - default REALTIME_AUX_TASK_PRIORITY_BOOSTED + depends on REALTIME_AUX_TASKS + default REALTIME_AUX_TASK_PRIORITY_INHERITANCE help Select the prioritization method for auxillary tasks. @@ -69,6 +70,8 @@ config REALTIME_AUX_TASK_PRIORITY_BOOSTED Run all auxillary task threads at a maximum priority. Useful for temporarily working around bugs during development. + BEWARE: Run-away auxillary tasks will clobber CPUs. + config REALTIME_AUX_TASK_PRIORITY_INHERITANCE bool "Inheritance" help diff --git a/litmus/fifo_lock.c b/litmus/fifo_lock.c index eb42aeee20eb..be49cd3a58d2 100644 --- a/litmus/fifo_lock.c +++ b/litmus/fifo_lock.c @@ -398,7 +398,6 @@ int fifo_mutex_unlock(struct litmus_lock* l) __waitqueue_dgl_remove_first(&mutex->wait, &dgl_wait, &next); if(dgl_wait) { next = dgl_wait->task; - //select_next_lock_if_primary(l, dgl_wait); } #else next = __waitqueue_remove_first(&mutex->wait); diff --git a/litmus/litmus.c b/litmus/litmus.c index 740b5e57ecc1..a69a3d0e9128 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c @@ -556,12 +556,14 @@ out: void litmus_pre_exit_task(struct task_struct* tsk) { +#ifdef CONFIG_LITMUS_AFFINITY_LOCKING if (is_realtime(tsk)) { if (tsk_rt(tsk)->rsrc_exit_cb) { int ret = tsk_rt(tsk)->rsrc_exit_cb(tsk); WARN_ON(ret != 0); } } +#endif } void litmus_exit_task(struct task_struct* tsk) diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 2246e9b8754e..61d682d9f415 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c @@ -52,6 +52,7 @@ #ifdef CONFIG_LITMUS_NESTED_LOCKING #include +#include #include #endif @@ -852,6 +853,7 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) TRACE_TASK(prev, "will be preempted by %s/%d\n", entry->linked->comm, entry->linked->pid); +#ifdef CONFIG_REALTIME_AUX_TASKS if (tsk_rt(prev)->is_aux_task && (prev->state == TASK_INTERRUPTIBLE) && !blocks) { @@ -860,6 +862,7 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) next = prev; /* allow prev to continue. */ goto out_set_state; } +#endif /* Send the signal that the budget has been exhausted */ if (signal_budget) @@ -931,7 +934,9 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) } } +#ifdef CONFIG_REALTIME_AUX_TASKS out_set_state: +#endif sched_state_task_picked(); raw_spin_unlock(&cluster->cluster_lock); @@ -1546,6 +1551,32 @@ static struct litmus_lock* cedf_new_fifo_mutex(void) return fifo_mutex_new(&cedf_fifo_mutex_lock_ops); } +/* ******************** PRIOQ MUTEX ********************** */ + +static struct litmus_lock_ops cedf_prioq_mutex_lock_ops = { + .lock = prioq_mutex_lock, + .unlock = prioq_mutex_unlock, + .close = prioq_mutex_close, + .deallocate = prioq_mutex_free, + + .propagate_increase_inheritance = prioq_mutex_propagate_increase_inheritance, + .propagate_decrease_inheritance = prioq_mutex_propagate_decrease_inheritance, + +#ifdef CONFIG_LITMUS_DGL_SUPPORT + .dgl_lock = prioq_mutex_dgl_lock, + .is_owner = prioq_mutex_is_owner, + .enable_priority = prioq_mutex_enable_priority, + + .dgl_can_quick_lock = prioq_mutex_dgl_can_quick_lock, + .dgl_quick_lock = prioq_mutex_dgl_quick_lock, +#endif +}; + +static struct litmus_lock* cedf_new_prioq_mutex(void) +{ + return prioq_mutex_new(&cedf_prioq_mutex_lock_ops); +} + /* ******************** IKGLP ********************** */ static struct litmus_lock_ops cedf_ikglp_lock_ops = { @@ -1603,6 +1634,10 @@ static long cedf_allocate_lock(struct litmus_lock **lock, int type, *lock = cedf_new_fifo_mutex(); break; + case PRIOQ_MUTEX: + *lock = cedf_new_prioq_mutex(); + break; + case IKGLP_SEM: *lock = cedf_new_ikglp(args); break; @@ -1629,13 +1664,13 @@ UNSUPPORTED_LOCK: #ifdef CONFIG_LITMUS_AFFINITY_LOCKING -static struct affinity_observer_ops cedf_kfmlp_affinity_ops = { +static struct affinity_observer_ops cedf_kfmlp_affinity_ops __attribute__ ((unused)) = { .close = kfmlp_aff_obs_close, .deallocate = kfmlp_aff_obs_free, }; #ifdef CONFIG_LITMUS_NESTED_LOCKING -static struct affinity_observer_ops cedf_ikglp_affinity_ops = { +static struct affinity_observer_ops cedf_ikglp_affinity_ops __attribute__ ((unused)) = { .close = ikglp_aff_obs_close, .deallocate = ikglp_aff_obs_free, }; @@ -1648,7 +1683,7 @@ static long cedf_allocate_affinity_observer(struct affinity_observer **aff_obs, int err; switch (type) { - +#ifdef CONFIG_LITMUS_NVIDIA case KFMLP_SIMPLE_GPU_AFF_OBS: *aff_obs = kfmlp_simple_gpu_aff_obs_new(&cedf_kfmlp_affinity_ops, args); break; @@ -1665,6 +1700,7 @@ static long cedf_allocate_affinity_observer(struct affinity_observer **aff_obs, case IKGLP_GPU_AFF_OBS: *aff_obs = ikglp_gpu_aff_obs_new(&cedf_ikglp_affinity_ops, args); break; +#endif #endif default: err = -ENXIO; diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index 886bd14f677c..4589888fc652 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c @@ -1771,13 +1771,13 @@ UNSUPPORTED_LOCK: #ifdef CONFIG_LITMUS_AFFINITY_LOCKING -static struct affinity_observer_ops gsnedf_kfmlp_affinity_ops = { +static struct affinity_observer_ops gsnedf_kfmlp_affinity_ops __attribute__ ((unused)) = { .close = kfmlp_aff_obs_close, .deallocate = kfmlp_aff_obs_free, }; #ifdef CONFIG_LITMUS_NESTED_LOCKING -static struct affinity_observer_ops gsnedf_ikglp_affinity_ops = { +static struct affinity_observer_ops gsnedf_ikglp_affinity_ops __attribute__ ((unused)) = { .close = ikglp_aff_obs_close, .deallocate = ikglp_aff_obs_free, }; @@ -1791,7 +1791,7 @@ static long gsnedf_allocate_affinity_observer( int err; switch (type) { - +#ifdef CONFIG_LITMUS_NVIDIA case KFMLP_SIMPLE_GPU_AFF_OBS: *aff_obs = kfmlp_simple_gpu_aff_obs_new(&gsnedf_kfmlp_affinity_ops, args); break; @@ -1808,6 +1808,7 @@ static long gsnedf_allocate_affinity_observer( case IKGLP_GPU_AFF_OBS: *aff_obs = ikglp_gpu_aff_obs_new(&gsnedf_ikglp_affinity_ops, args); break; +#endif #endif default: err = -ENXIO; -- cgit v1.2.2