aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@jupiter-cs.cs.unc.edu>2007-02-01 17:35:46 -0500
committerBjoern B. Brandenburg <bbb@jupiter-cs.cs.unc.edu>2007-02-01 17:35:46 -0500
commitc72efb7abd520758e86317c8eb451ed607042ad9 (patch)
treed14e61b14ed2b01f683829eefd20d66fd3d549eb /include
parentad1e19d0fafe82cc5f8180c0f9221458d439d9fa (diff)
Added litmus.c, made it compile.
Diffstat (limited to 'include')
-rw-r--r--include/linux/litmus.h2
-rw-r--r--include/linux/queuelock.h32
-rw-r--r--include/linux/rt_param.h120
-rw-r--r--include/linux/sched.h8
-rw-r--r--include/linux/sched_plugin.h8
5 files changed, 166 insertions, 4 deletions
diff --git a/include/linux/litmus.h b/include/linux/litmus.h
index 922751424b..5d0a817457 100644
--- a/include/linux/litmus.h
+++ b/include/linux/litmus.h
@@ -98,5 +98,7 @@ extern int sched_type;
98/* CLEANUP: Should be queue_lock, does it really belong here? */ 98/* CLEANUP: Should be queue_lock, does it really belong here? */
99extern spinlock_t litmus_task_set_lock; 99extern spinlock_t litmus_task_set_lock;
100 100
101/* CLEANUP: Remove after porting the trace framework */
102#define TRACE(x)
101 103
102#endif 104#endif
diff --git a/include/linux/queuelock.h b/include/linux/queuelock.h
new file mode 100644
index 0000000000..0fa396a724
--- /dev/null
+++ b/include/linux/queuelock.h
@@ -0,0 +1,32 @@
1#ifndef _UNC_QUEUE_LOCK_H_
2#define _UNC_QUEUE_LOCK_H_
3/**
4* Queue lock
5*
6*
7* CLEANUP: Q-Locks to be re-implemented properly for the new LITMUS.
8* Until then, we just use spin locks to make the code compile.
9*/
10
11#include <linux/spinlock.h>
12
13typedef spinlock_t queuelock_t;
14
15
16
17/* The new linux-like queue lock API.
18
19 int init_queuelock(queuelock_t* lock, int num_procs);
20 void queue_lock_wipe(queuelock_t * lock);
21 void queue_lock(queuelock_t *);
22 void queue_unlock(queuelock_t *);
23
24*/
25
26
27#define queue_lock_init(lock, dummy) spin_lock_init(lock)
28#define queue_lock_wipe(lock) spin_lock_init(lock)
29#define queue_lock(lock) spin_lock(lock)
30#define queue_unlock(lock) spin_unlock(lock)
31
32#endif /* _UNC_QUEUE_LOCK_H_ */
diff --git a/include/linux/rt_param.h b/include/linux/rt_param.h
new file mode 100644
index 0000000000..a844e754e9
--- /dev/null
+++ b/include/linux/rt_param.h
@@ -0,0 +1,120 @@
1/*
2 * Definition of the scheduler plugin interface.
3 *
4 */
5#ifndef _LINUX_RT_PARAM_H_
6#define _LINUX_RT_PARAM_H_
7
8typedef unsigned long jiffie_t;
9
10/* different types of clients */
11typedef enum {
12 RT_CLASS_HARD,
13 RT_CLASS_SOFT,
14 RT_CLASS_BEST_EFFORT
15} task_class_t;
16
17typedef struct rt_param {
18 unsigned long exec_cost;
19 unsigned long period;
20 unsigned int cpu;
21 task_class_t class;
22} rt_param_t;
23
24/* RT task parameters for scheduling extensions
25 * These parameters are inherited during clone and therefore must
26 * be explicitly set up before the task set is launched.
27 */
28typedef struct task_rt_param {
29 /* Real-time marker */
30 int is_realtime;
31 /* user controlled parameters */
32 rt_param_t basic_params;
33 /* is the task sleeping? */
34 unsigned int flags;
35 struct {
36 /* when will this task be release the next time? */
37 jiffie_t release;
38 /* time instant the last job was released */
39 jiffie_t last_release;
40 /* what is the current deadline? */
41 jiffie_t deadline;
42
43 /* how long has this task executed so far?
44 * In case of capacity sharing a job completion cannot be
45 * detected by checking time_slice == 0 as the job may have
46 * executed while using another capacity. Use this counter
47 * to keep track of the time spent on a CPU by a job.
48 *
49 * In other words: The number of consumed quanta since the
50 * last job release.
51 */
52 unsigned int exec_time;
53 } times;
54
55 /* put information for feedback control stuff and
56 * information about the performance of the task here
57 */
58 struct {
59 /* How many non-tardy jobs since the last tardy job? */
60 unsigned int nontardy_jobs_ctr;
61 } stats;
62
63 /* is this task under control of litmus?
64 *
65 * this is necessary because otherwise signal delivery code
66 * may try to wake up a task that is already queued in plugin
67 * data structures.
68 */
69 int litmus_controlled;
70} task_rt_param_t;
71
72/* Possible RT flags */
73#define RT_F_RUNNING 0x00000000
74#define RT_F_SLEEP 0x00000001
75#define RT_F_EXP_QUANTA 0x00000002
76
77
78/* Realtime utility macros */
79#define get_passed_quanta(t) ((t)->rt_param.times.exec_time)
80#define inc_passed_quanta(t) ((t)->rt_param.times.exec_time += 1)
81#define get_rt_flags(t) ((t)->rt_param.flags)
82#define set_rt_flags(t,f) (t)->rt_param.flags=(f)
83#define get_exec_cost(t) ((t)->rt_param.basic_params.exec_cost)
84#define get_rt_period(t) ((t)->rt_param.basic_params.period)
85#define set_rt_period(t,p) (t)->rt_param.basic_params.period=(p)
86#define set_exec_cost(t,e) (t)->rt_param.basic_params.exec_cost=(e)
87#define get_partition(t) (t)->rt_param.basic_params.cpu
88#define get_deadline(t) ((t)->rt_param.times.deadline)
89#define get_class(t) ((t)->rt_param.basic_params.class)
90
91#define is_realtime(t) ((t)->rt_param.is_realtime)
92#define is_hrt(t) \
93 ((t)->rt_param.basic_params.class == RT_CLASS_HARD)
94#define is_srt(t) \
95 ((t)->rt_param.basic_params.class == RT_CLASS_SOFT)
96#define is_be(t) \
97 ((t)->rt_param.basic_params.class == RT_CLASS_BEST_EFFORT)
98
99
100
101#define clear_rt_params(t) \
102memset(&(t)->rt_param,0, sizeof(struct task_rt_param))
103
104#define get_last_release_time(t) ((t)->rt_param.times.last_release)
105#define set_last_release_time(t,r) ((t)->rt_param.times.last_releasee=(r))
106
107#define is_running(t) ((t)->state & TASK_RUNNING)
108#define is_released(t) (time_before_eq((t)->rt_param.times.release, jiffies))
109#define is_tardy(t) (time_before_eq((t)->rt_param.times.deadline, jiffies))
110
111
112/* real-time comparisn macros */
113#define earlier_deadline(a, b) (time_before(\
114 (a)->rt_param.times.deadline,\
115 (b)->rt_param.times.deadline))
116#define earlier_release(a, b) (time_before(\
117 (a)->rt_param.times.release,\
118 (b)->rt_param.times.release))
119
120#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4463735351..9a8eea140a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 4#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
5 5
6#include <linux/rt_param.h>
7
6/* 8/*
7 * cloning flags: 9 * cloning flags:
8 */ 10 */
@@ -1051,6 +1053,12 @@ struct task_struct {
1051#ifdef CONFIG_FAULT_INJECTION 1053#ifdef CONFIG_FAULT_INJECTION
1052 int make_it_fail; 1054 int make_it_fail;
1053#endif 1055#endif
1056 /* litmus parameters and state */
1057 task_rt_param_t rt_param;
1058
1059 /* allow scheduler plugins to queue in release lists, etc. */
1060 struct list_head rt_list;
1061
1054}; 1062};
1055 1063
1056static inline pid_t process_group(struct task_struct *tsk) 1064static inline pid_t process_group(struct task_struct *tsk)
diff --git a/include/linux/sched_plugin.h b/include/linux/sched_plugin.h
index 2867234285..f5cd785d84 100644
--- a/include/linux/sched_plugin.h
+++ b/include/linux/sched_plugin.h
@@ -2,8 +2,8 @@
2 * Definition of the scheduler plugin interface. 2 * Definition of the scheduler plugin interface.
3 * 3 *
4 */ 4 */
5#ifndef _LINUX_PLUGIN_DRIVER_H_ 5#ifndef _LINUX_SCHED_PLUGIN_H_
6#define _LINUX_PLUGIN_DRIVER_H_ 6#define _LINUX_SCHED_PLUGIN_H_
7 7
8#include <linux/sched.h> 8#include <linux/sched.h>
9 9
@@ -93,11 +93,11 @@ extern sched_plugin_t *curr_sched_plugin;
93 93
94/* External linux scheduler facilities */ 94/* External linux scheduler facilities */
95extern void deactivate_task(struct task_struct *, runqueue_t *); 95extern void deactivate_task(struct task_struct *, runqueue_t *);
96// Put the real-time task into the head of highest-priority RT queue 96/* Put the real-time task into the head of highest-priority RT queue */
97extern void __activate_idle_task(struct task_struct *, runqueue_t *); 97extern void __activate_idle_task(struct task_struct *, runqueue_t *);
98extern void __setscheduler(struct task_struct *, int, int); 98extern void __setscheduler(struct task_struct *, int, int);
99 99
100extern int get_sched_options(void); 100extern int get_sched_options(void);
101extern int get_this_ok_sched(void); 101extern int get_this_ok_sched(void);
102extern void set_this_ok_sched(int); 102extern void set_this_ok_sched(int);
103#endif /* _LINUX_PLUGIN_DRIVER_H_ */ 103#endif