diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2014-07-16 10:52:13 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-20 14:30:32 -0400 |
commit | c1e58e8d55c4162a6b603c52eaa46783e6f6d9da (patch) | |
tree | 7e975b2155a4a37d369dea9ff92391b8af9e17c2 | |
parent | 59a6e9efdd1b75c6e2c4a07bad361b4fa7aa741c (diff) |
Add reservation creation API to plugin interface & syscalls
-rw-r--r-- | include/litmus/sched_plugin.h | 8 | ||||
-rw-r--r-- | litmus/litmus.c | 10 | ||||
-rw-r--r-- | litmus/sched_plugin.c | 13 |
3 files changed, 31 insertions, 0 deletions
diff --git a/include/litmus/sched_plugin.h b/include/litmus/sched_plugin.h index b2bc8b5a5e71..85383aa67da7 100644 --- a/include/litmus/sched_plugin.h +++ b/include/litmus/sched_plugin.h | |||
@@ -103,6 +103,10 @@ typedef void (*synchronous_release_at_t)(lt_t time_zero); | |||
103 | * reservation-specific values. */ | 103 | * reservation-specific values. */ |
104 | typedef void (*current_budget_t)(lt_t *used_so_far, lt_t *remaining); | 104 | typedef void (*current_budget_t)(lt_t *used_so_far, lt_t *remaining); |
105 | 105 | ||
106 | /* Reservation creation/removal backends. Meaning of reservation_type and | ||
107 | * reservation_id are entirely plugin-specific. */ | ||
108 | typedef long (*reservation_create_t)(int reservation_type, void* __user config); | ||
109 | typedef long (*reservation_destroy_t)(unsigned int reservation_id, int cpu); | ||
106 | 110 | ||
107 | /************************ misc routines ***********************/ | 111 | /************************ misc routines ***********************/ |
108 | 112 | ||
@@ -144,6 +148,10 @@ struct sched_plugin { | |||
144 | 148 | ||
145 | current_budget_t current_budget; | 149 | current_budget_t current_budget; |
146 | 150 | ||
151 | /* Reservation support */ | ||
152 | reservation_create_t reservation_create; | ||
153 | reservation_destroy_t reservation_destroy; | ||
154 | |||
147 | #ifdef CONFIG_LITMUS_LOCKING | 155 | #ifdef CONFIG_LITMUS_LOCKING |
148 | /* locking protocols */ | 156 | /* locking protocols */ |
149 | allocate_lock_t allocate_lock; | 157 | allocate_lock_t allocate_lock; |
diff --git a/litmus/litmus.c b/litmus/litmus.c index ed739082af5b..ed8e4127207e 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -317,6 +317,16 @@ asmlinkage long sys_null_call(cycles_t __user *ts) | |||
317 | return ret; | 317 | return ret; |
318 | } | 318 | } |
319 | 319 | ||
320 | asmlinkage long sys_reservation_create(int type, void __user *config) | ||
321 | { | ||
322 | return litmus->reservation_create(type, config); | ||
323 | } | ||
324 | |||
325 | asmlinkage long sys_reservation_destroy(unsigned int reservation_id, int cpu) | ||
326 | { | ||
327 | return litmus->reservation_destroy(reservation_id, cpu); | ||
328 | } | ||
329 | |||
320 | /* p is a real-time task. Re-init its state as a best-effort task. */ | 330 | /* p is a real-time task. Re-init its state as a best-effort task. */ |
321 | static void reinit_litmus_state(struct task_struct* p, int restore) | 331 | static void reinit_litmus_state(struct task_struct* p, int restore) |
322 | { | 332 | { |
diff --git a/litmus/sched_plugin.c b/litmus/sched_plugin.c index a9fe3f5e7349..4b4e1adc1a9a 100644 --- a/litmus/sched_plugin.c +++ b/litmus/sched_plugin.c | |||
@@ -153,6 +153,17 @@ static long litmus_dummy_allocate_lock(struct litmus_lock **lock, int type, | |||
153 | 153 | ||
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | static long litmus_dummy_reservation_create( | ||
157 | int reservation_type, | ||
158 | void* __user config) | ||
159 | { | ||
160 | return -ENOSYS; | ||
161 | } | ||
162 | |||
163 | static long litmus_dummy_reservation_destroy(unsigned int reservation_id, int cpu) | ||
164 | { | ||
165 | return -ENOSYS; | ||
166 | } | ||
156 | 167 | ||
157 | /* The default scheduler plugin. It doesn't do anything and lets Linux do its | 168 | /* The default scheduler plugin. It doesn't do anything and lets Linux do its |
158 | * job. | 169 | * job. |
@@ -218,6 +229,8 @@ int register_sched_plugin(struct sched_plugin* plugin) | |||
218 | CHECK(admit_task); | 229 | CHECK(admit_task); |
219 | CHECK(fork_task); | 230 | CHECK(fork_task); |
220 | CHECK(synchronous_release_at); | 231 | CHECK(synchronous_release_at); |
232 | CHECK(reservation_destroy); | ||
233 | CHECK(reservation_create); | ||
221 | 234 | ||
222 | if (!plugin->wait_for_release_at) | 235 | if (!plugin->wait_for_release_at) |
223 | plugin->wait_for_release_at = default_wait_for_release_at; | 236 | plugin->wait_for_release_at = default_wait_for_release_at; |