aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-09-10 14:50:12 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2012-09-10 14:50:12 -0400
commitf4260f81a68d170b1d3558b5447343224d918a45 (patch)
tree647b6490efe8a6157cf3a919ec62eb5c0784175a /include/litmus
parent893c8943ce5c5527f05ab7e9208d5a942d77d8b5 (diff)
parent6a225701acf7d79f292eeffcd99d6f00b02c180b (diff)
Merge remote-tracking branch 'github/prop/litmus-signals' into wip-gpu-rtas12
Conflicts: litmus/sched_gsn_edf.c
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/budget.h20
-rw-r--r--include/litmus/rt_param.h16
-rw-r--r--include/litmus/signal.h47
3 files changed, 79 insertions, 4 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h
index 33344ee8d5f9..763b31c0e9f6 100644
--- a/include/litmus/budget.h
+++ b/include/litmus/budget.h
@@ -5,6 +5,9 @@
5 * the next task. */ 5 * the next task. */
6void update_enforcement_timer(struct task_struct* t); 6void update_enforcement_timer(struct task_struct* t);
7 7
8/* Send SIG_BUDGET to a real-time task. */
9void send_sigbudget(struct task_struct* t);
10
8inline static int budget_exhausted(struct task_struct* t) 11inline static int budget_exhausted(struct task_struct* t)
9{ 12{
10 return get_exec_time(t) >= get_exec_cost(t); 13 return get_exec_time(t) >= get_exec_cost(t);
@@ -19,10 +22,21 @@ inline static lt_t budget_remaining(struct task_struct* t)
19 return 0; 22 return 0;
20} 23}
21 24
22#define budget_enforced(t) (tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT) 25#define budget_enforced(t) (\
26 tsk_rt(t)->task_params.budget_policy != NO_ENFORCEMENT)
27
28#define budget_precisely_tracked(t) (\
29 tsk_rt(t)->task_params.budget_policy == PRECISE_ENFORCEMENT || \
30 tsk_rt(t)->task_params.budget_signal_policy == PRECISE_SIGNALS)
31
32#define budget_signalled(t) (\
33 tsk_rt(t)->task_params.budget_signal_policy != NO_SIGNALS)
34
35#define budget_precisely_signalled(t) (\
36 tsk_rt(t)->task_params.budget_policy == PRECISE_SIGNALS)
23 37
24#define budget_precisely_enforced(t) (tsk_rt(t)->task_params.budget_policy \ 38#define sigbudget_sent(t) (\
25 == PRECISE_ENFORCEMENT) 39 test_bit(RT_JOB_SIG_BUDGET_SENT, &tsk_rt(t)->job_params.flags))
26 40
27static inline int requeue_preempted_job(struct task_struct* t) 41static inline int requeue_preempted_job(struct task_struct* t)
28{ 42{
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 419ff0c88a65..a1f3613ebeed 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -32,9 +32,15 @@ typedef enum {
32typedef enum { 32typedef enum {
33 NO_ENFORCEMENT, /* job may overrun unhindered */ 33 NO_ENFORCEMENT, /* job may overrun unhindered */
34 QUANTUM_ENFORCEMENT, /* budgets are only checked on quantum boundaries */ 34 QUANTUM_ENFORCEMENT, /* budgets are only checked on quantum boundaries */
35 PRECISE_ENFORCEMENT /* budgets are enforced with hrtimers */ 35 PRECISE_ENFORCEMENT, /* budgets are enforced with hrtimers */
36} budget_policy_t; 36} budget_policy_t;
37 37
38typedef enum {
39 NO_SIGNALS, /* job receives no signals when it exhausts its budget */
40 QUANTUM_SIGNALS, /* budget signals are only sent on quantum boundaries */
41 PRECISE_SIGNALS, /* budget signals are triggered with hrtimers */
42} budget_signal_policy_t;
43
38/* We use the common priority interpretation "lower index == higher priority", 44/* We use the common priority interpretation "lower index == higher priority",
39 * which is commonly used in fixed-priority schedulability analysis papers. 45 * which is commonly used in fixed-priority schedulability analysis papers.
40 * So, a numerically lower priority value implies higher scheduling priority, 46 * So, a numerically lower priority value implies higher scheduling priority,
@@ -64,6 +70,7 @@ struct rt_task {
64 unsigned int priority; 70 unsigned int priority;
65 task_class_t cls; 71 task_class_t cls;
66 budget_policy_t budget_policy; /* ignored by pfair */ 72 budget_policy_t budget_policy; /* ignored by pfair */
73 budget_signal_policy_t budget_signal_policy; /* currently ignored by pfair */
67}; 74};
68 75
69union np_flag { 76union np_flag {
@@ -142,8 +149,15 @@ struct rt_job {
142 * Increase this sequence number when a job is released. 149 * Increase this sequence number when a job is released.
143 */ 150 */
144 unsigned int job_no; 151 unsigned int job_no;
152
153 /* bits:
154 * 0th: Set if a budget exhaustion signal has already been sent for
155 * the current job. */
156 unsigned long flags;
145}; 157};
146 158
159#define RT_JOB_SIG_BUDGET_SENT 0
160
147struct pfair_param; 161struct pfair_param;
148 162
149enum klitirqd_sem_status 163enum klitirqd_sem_status
diff --git a/include/litmus/signal.h b/include/litmus/signal.h
new file mode 100644
index 000000000000..b3d82b294984
--- /dev/null
+++ b/include/litmus/signal.h
@@ -0,0 +1,47 @@
1#ifndef LITMUS_SIGNAL_H
2#define LITMUS_SIGNAL_H
3
4#ifdef __KERNEL__
5#include <linux/signal.h>
6#else
7#include <signal.h>
8#endif
9
10/* Signals used by Litmus to asynchronously communicate events
11 * to real-time tasks.
12 *
13 * Signal values overlap with [SIGRTMIN, SIGRTMAX], so beware of
14 * application-level conflicts when dealing with COTS user-level
15 * code.
16 */
17
18/* Sent to a Litmus task when all of the following conditions are true:
19 * (1) The task has exhausted its budget.
20 * (2) budget_signal_policy is QUANTUM_SIGNALS or PRECISE_SIGNALS.
21 *
22 * Note: If a task does not have a registered handler for SIG_BUDGET,
23 * the signal will cause the task to terminate (default action).
24 */
25
26/* Assigned values start at SIGRTMAX and decrease, hopefully reducing
27 * likelihood of user-level conflicts.
28 */
29#define SIG_BUDGET (SIGRTMAX - 0)
30
31/*
32Future signals could include:
33
34#define SIG_DEADLINE_MISS (SIGRTMAX - 1)
35#define SIG_CRIT_LEVEL_CHANGE (SIGRTMAX - 2)
36*/
37
38#define SIGLITMUSMIN SIG_BUDGET
39
40#ifdef __KERNEL__
41#if (SIGLITMUSMIN < SIGRTMIN)
42/* no compile-time check in user-space since SIGRTMIN may be a variable. */
43#error "Too many LITMUS^RT signals!"
44#endif
45#endif
46
47#endif