aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/rt_param.h
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-29 23:35:01 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-29 23:35:01 -0400
commit6ffc1fee98c4b995eb3a0285f4f8fb467cb0306e (patch)
tree69a05892a41e7f7400fa598ee0bdf8027c8f0fd6 /include/litmus/rt_param.h
parente40152ee1e1c7a63f4777791863215e3faa37a86 (diff)
parent7c1ff4c544dd650cceff3cd69a04bcba60856678 (diff)
Merge branch 'master' into wip-merge-2.6.34
Simple merge between master and 2.6.34 with conflicts resolved. This commit does not compile, the following main problems are still unresolved: - spinlock -> raw_spinlock API changes - kfifo API changes - sched_class API changes Conflicts: Makefile arch/x86/include/asm/hw_irq.h arch/x86/include/asm/unistd_32.h arch/x86/kernel/syscall_table_32.S include/linux/hrtimer.h kernel/sched.c kernel/sched_fair.c
Diffstat (limited to 'include/litmus/rt_param.h')
-rw-r--r--include/litmus/rt_param.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
new file mode 100644
index 000000000000..5b94d1a8eea7
--- /dev/null
+++ b/include/litmus/rt_param.h
@@ -0,0 +1,189 @@
1/*
2 * Definition of the scheduler plugin interface.
3 *
4 */
5#ifndef _LINUX_RT_PARAM_H_
6#define _LINUX_RT_PARAM_H_
7
8/* Litmus time type. */
9typedef unsigned long long lt_t;
10
11static inline int lt_after(lt_t a, lt_t b)
12{
13 return ((long long) b) - ((long long) a) < 0;
14}
15#define lt_before(a, b) lt_after(b, a)
16
17static inline int lt_after_eq(lt_t a, lt_t b)
18{
19 return ((long long) a) - ((long long) b) >= 0;
20}
21#define lt_before_eq(a, b) lt_after_eq(b, a)
22
23/* different types of clients */
24typedef enum {
25 RT_CLASS_HARD,
26 RT_CLASS_SOFT,
27 RT_CLASS_BEST_EFFORT
28} task_class_t;
29
30struct rt_task {
31 lt_t exec_cost;
32 lt_t period;
33 lt_t phase;
34 unsigned int cpu;
35 task_class_t cls;
36};
37
38/* The definition of the data that is shared between the kernel and real-time
39 * tasks via a shared page (see litmus/ctrldev.c).
40 *
41 * WARNING: User space can write to this, so don't trust
42 * the correctness of the fields!
43 *
44 * This servees two purposes: to enable efficient signaling
45 * of non-preemptive sections (user->kernel) and
46 * delayed preemptions (kernel->user), and to export
47 * some real-time relevant statistics such as preemption and
48 * migration data to user space. We can't use a device to export
49 * statistics because we want to avoid system call overhead when
50 * determining preemption/migration overheads).
51 */
52struct control_page {
53 /* Is the task currently in a non-preemptive section? */
54 int np_flag;
55 /* Should the task call into the kernel when it leaves
56 * its non-preemptive section? */
57 int delayed_preemption;
58
59 /* to be extended */
60};
61
62/* don't export internal data structures to user space (liblitmus) */
63#ifdef __KERNEL__
64
65struct _rt_domain;
66struct bheap_node;
67struct release_heap;
68
69struct rt_job {
70 /* Time instant the the job was or will be released. */
71 lt_t release;
72 /* What is the current deadline? */
73 lt_t deadline;
74
75 /* How much service has this job received so far? */
76 lt_t exec_time;
77
78 /* Which job is this. This is used to let user space
79 * specify which job to wait for, which is important if jobs
80 * overrun. If we just call sys_sleep_next_period() then we
81 * will unintentionally miss jobs after an overrun.
82 *
83 * Increase this sequence number when a job is released.
84 */
85 unsigned int job_no;
86};
87
88struct pfair_param;
89
90/* RT task parameters for scheduling extensions
91 * These parameters are inherited during clone and therefore must
92 * be explicitly set up before the task set is launched.
93 */
94struct rt_param {
95 /* is the task sleeping? */
96 unsigned int flags:8;
97
98 /* do we need to check for srp blocking? */
99 unsigned int srp_non_recurse:1;
100
101 /* is the task present? (true if it can be scheduled) */
102 unsigned int present:1;
103
104 /* user controlled parameters */
105 struct rt_task task_params;
106
107 /* timing parameters */
108 struct rt_job job_params;
109
110 /* task representing the current "inherited" task
111 * priority, assigned by inherit_priority and
112 * return priority in the scheduler plugins.
113 * could point to self if PI does not result in
114 * an increased task priority.
115 */
116 struct task_struct* inh_task;
117
118#ifdef CONFIG_NP_SECTION
119 /* For the FMLP under PSN-EDF, it is required to make the task
120 * non-preemptive from kernel space. In order not to interfere with
121 * user space, this counter indicates the kernel space np setting.
122 * kernel_np > 0 => task is non-preemptive
123 */
124 unsigned int kernel_np;
125#endif
126
127 /* This field can be used by plugins to store where the task
128 * is currently scheduled. It is the responsibility of the
129 * plugin to avoid race conditions.
130 *
131 * This used by GSN-EDF and PFAIR.
132 */
133 volatile int scheduled_on;
134
135 /* Is the stack of the task currently in use? This is updated by
136 * the LITMUS core.
137 *
138 * Be careful to avoid deadlocks!
139 */
140 volatile int stack_in_use;
141
142 /* This field can be used by plugins to store where the task
143 * is currently linked. It is the responsibility of the plugin
144 * to avoid race conditions.
145 *
146 * Used by GSN-EDF.
147 */
148 volatile int linked_on;
149
150 /* PFAIR/PD^2 state. Allocated on demand. */
151 struct pfair_param* pfair;
152
153 /* Fields saved before BE->RT transition.
154 */
155 int old_policy;
156 int old_prio;
157
158 /* ready queue for this task */
159 struct _rt_domain* domain;
160
161 /* heap element for this task
162 *
163 * Warning: Don't statically allocate this node. The heap
164 * implementation swaps these between tasks, thus after
165 * dequeuing from a heap you may end up with a different node
166 * then the one you had when enqueuing the task. For the same
167 * reason, don't obtain and store references to this node
168 * other than this pointer (which is updated by the heap
169 * implementation).
170 */
171 struct bheap_node* heap_node;
172 struct release_heap* rel_heap;
173
174 /* Used by rt_domain to queue task in release list.
175 */
176 struct list_head list;
177
178 /* Pointer to the page shared between userspace and kernel. */
179 struct control_page * ctrl_page;
180};
181
182/* Possible RT flags */
183#define RT_F_RUNNING 0x00000000
184#define RT_F_SLEEP 0x00000001
185#define RT_F_EXIT_SEM 0x00000008
186
187#endif
188
189#endif