1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*
* Constant definitions related to
* scheduling policy.
*/
#ifndef _LINUX_LITMUS_H_
#define _LINUX_LITMUS_H_
#include <linux/jiffies.h>
#include <linux/sched_trace.h>
typedef enum {
SCHED_BEG = 0,
SCHED_LINUX = 0,
SCHED_PFAIR = 1,
SCHED_PFAIR_STAGGER = 2,
SCHED_PART_EDF = 3,
SCHED_PART_EEVDF = 4,
SCHED_GLOBAL_EDF = 5,
SCHED_PFAIR_DESYNC = 6,
SCHED_GLOBAL_EDF_NP = 7,
SCHED_CUSTOM = 8,
SCHED_EDF_HSB = 9,
SCHED_GSN_EDF = 10,
SCHED_PSN_EDF = 11,
SCHED_ADAPTIVE = 12,
/* Add your scheduling policy here */
SCHED_END = 12,
SCHED_DEFAULT = 0,
SCHED_INVALID = -1,
} spolicy;
typedef enum {
LITMUS_RESERVED_RANGE = 1024,
} sched_setup_cmd_t;
/* Runtime modes */
enum rt_mode_t {
MODE_NON_RT = 0,
MODE_RT_RUN = 1
};
/* Plugin boot options, for convenience */
#define PLUGIN_LINUX "linux"
#define PLUGIN_PFAIR "pfair"
#define PLUGIN_PART_EDF "part_edf"
#define PLUGIN_GLOBAL_EDF "global_edf"
#define PLUGIN_GLOBAL_EDF_NP "global_edf_np"
#define PLUGIN_EDF_HSB "edf_hsb"
#define PLUGIN_GSN_EDF "gsn_edf"
#define PLUGIN_PSN_EDF "psn_edf"
#define PLUGIN_ADAPTIVE "adaptive"
extern spolicy sched_policy;
/* RT mode start time */
extern volatile unsigned long rt_start_time;
/* Here we store the current mode of the system */
extern atomic_t rt_mode;
#define get_rt_mode() (atomic_read(&rt_mode))
#define set_rt_mode(a) atomic_set(&rt_mode,(a))
#define TRACE(fmt, args...) \
sched_trace_log_message("%d: " fmt, raw_smp_processor_id(), ## args)
#define TRACE_TASK(t, fmt, args...) \
TRACE("(%s/%d) " fmt, (t)->comm, (t)->pid, ##args)
#define TRACE_CUR(fmt, args...) \
TRACE_TASK(current, fmt, ## args)
#define TRACE_BUG_ON(cond) \
do { if (cond) TRACE("BUG_ON(%s) at %s:%d " \
"called from %p current=%s/%d state=%d " \
"flags=%x mode=%d partition=%d cpu=%d rtflags=%d"\
" job=%u knp=%d timeslice=%u\n", \
#cond, __FILE__, __LINE__, __builtin_return_address(0), current->comm, \
current->pid, current->state, current->flags, get_rt_mode(), \
get_partition(current), smp_processor_id(), get_rt_flags(current), \
current->rt_param.times.job_no, current->rt_param.kernel_np, \
current->time_slice\
); } while(0);
/* in_list - is a given list_head queued on some list?
*/
static inline int in_list(struct list_head* list)
{
return !( /* case 1: deleted */
(list->next == LIST_POISON1 &&
list->prev == LIST_POISON2)
||
/* case 2: initialized */
(list->next == list &&
list->prev == list)
);
}
void list_qsort(struct list_head* list, list_cmp_t less_than);
#define RT_PREEMPTIVE 0x2050 /* = NP */
#define RT_NON_PREEMPTIVE 0x4e50 /* = P */
#define RT_EXIT_NP_REQUESTED 0x5251 /* = RQ */
/* returns 1 if task t has registered np flag and set it to RT_NON_PREEMPTIVE
*/
int is_np(struct task_struct *t);
/* request that the task should call sys_exit_np()
*/
void request_exit_np(struct task_struct *t);
/* kill naughty tasks
*/
void scheduler_signal(struct task_struct *t, unsigned int signal);
void send_scheduler_signals(void);
void np_mem_kill(struct task_struct *t);
/* clean up real-time state of a task */
void exit_litmus(struct task_struct *dead_tsk);
#endif
|