aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2014-07-16 10:52:13 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2014-07-21 08:53:44 -0400
commitac730fd04287024162f1f960ad40a8c8e971cc55 (patch)
tree38560ac7cc3bf6f7c4fe611c1d106b9b1f8c492f
parente4010654e60d58ae6619857359d508b3597a9cf7 (diff)
Add reservation creation API to plugin interface & syscalls
-rw-r--r--include/litmus/sched_plugin.h9
-rw-r--r--litmus/litmus.c10
-rw-r--r--litmus/sched_plugin.c13
3 files changed, 32 insertions, 0 deletions
diff --git a/include/litmus/sched_plugin.h b/include/litmus/sched_plugin.h
index 0ccccd6ae1af..cb663b84dd38 100644
--- a/include/litmus/sched_plugin.h
+++ b/include/litmus/sched_plugin.h
@@ -77,6 +77,11 @@ typedef long (*wait_for_release_at_t)(lt_t release_time);
77/* Informs the plugin when a synchronous release takes place. */ 77/* Informs the plugin when a synchronous release takes place. */
78typedef void (*synchronous_release_at_t)(lt_t time_zero); 78typedef void (*synchronous_release_at_t)(lt_t time_zero);
79 79
80/* Reservation creation/removal backends. Meaning of reservation_type and
81 * reservation_id are entirely plugin-specific. */
82typedef long (*reservation_create_t)(int reservation_type, void* __user config);
83typedef long (*reservation_destroy_t)(unsigned int reservation_id, int cpu);
84
80/************************ misc routines ***********************/ 85/************************ misc routines ***********************/
81 86
82 87
@@ -109,6 +114,10 @@ struct sched_plugin {
109 task_exit_t task_exit; 114 task_exit_t task_exit;
110 task_cleanup_t task_cleanup; 115 task_cleanup_t task_cleanup;
111 116
117 /* Reservation support */
118 reservation_create_t reservation_create;
119 reservation_destroy_t reservation_destroy;
120
112#ifdef CONFIG_LITMUS_LOCKING 121#ifdef CONFIG_LITMUS_LOCKING
113 /* locking protocols */ 122 /* locking protocols */
114 allocate_lock_t allocate_lock; 123 allocate_lock_t allocate_lock;
diff --git a/litmus/litmus.c b/litmus/litmus.c
index a061343ab769..1b3795a326a0 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -310,6 +310,16 @@ asmlinkage long sys_null_call(cycles_t __user *ts)
310 return ret; 310 return ret;
311} 311}
312 312
313asmlinkage long sys_reservation_create(int type, void __user *config)
314{
315 return litmus->reservation_create(type, config);
316}
317
318asmlinkage long sys_reservation_destroy(unsigned int reservation_id, int cpu)
319{
320 return litmus->reservation_destroy(reservation_id, cpu);
321}
322
313/* p is a real-time task. Re-init its state as a best-effort task. */ 323/* p is a real-time task. Re-init its state as a best-effort task. */
314static void reinit_litmus_state(struct task_struct* p, int restore) 324static void reinit_litmus_state(struct task_struct* p, int restore)
315{ 325{
diff --git a/litmus/sched_plugin.c b/litmus/sched_plugin.c
index edd91e9bf773..b9177931299c 100644
--- a/litmus/sched_plugin.c
+++ b/litmus/sched_plugin.c
@@ -132,6 +132,17 @@ static long litmus_dummy_allocate_lock(struct litmus_lock **lock, int type,
132 132
133#endif 133#endif
134 134
135static long litmus_dummy_reservation_create(
136 int reservation_type,
137 void* __user config)
138{
139 return -EINVAL;
140}
141
142static long litmus_dummy_reservation_destroy(unsigned int reservation_id, int cpu)
143{
144 return -EINVAL;
145}
135 146
136/* The default scheduler plugin. It doesn't do anything and lets Linux do its 147/* The default scheduler plugin. It doesn't do anything and lets Linux do its
137 * job. 148 * job.
@@ -193,6 +204,8 @@ int register_sched_plugin(struct sched_plugin* plugin)
193#endif 204#endif
194 CHECK(admit_task); 205 CHECK(admit_task);
195 CHECK(synchronous_release_at); 206 CHECK(synchronous_release_at);
207 CHECK(reservation_destroy);
208 CHECK(reservation_create);
196 209
197 if (!plugin->wait_for_release_at) 210 if (!plugin->wait_for_release_at)
198 plugin->wait_for_release_at = default_wait_for_release_at; 211 plugin->wait_for_release_at = default_wait_for_release_at;