diff options
Diffstat (limited to 'include/litmus')
| -rw-r--r-- | include/litmus/budget.h | 20 | ||||
| -rw-r--r-- | include/litmus/color.h | 9 | ||||
| -rw-r--r-- | include/litmus/dgl.h | 61 | ||||
| -rw-r--r-- | include/litmus/fifo_common.h | 25 | ||||
| -rw-r--r-- | include/litmus/litmus.h | 19 | ||||
| -rw-r--r-- | include/litmus/locking.h | 1 | ||||
| -rw-r--r-- | include/litmus/rt_domain.h | 2 | ||||
| -rw-r--r-- | include/litmus/rt_param.h | 14 | ||||
| -rw-r--r-- | include/litmus/rt_server.h | 39 | ||||
| -rw-r--r-- | include/litmus/sched_plugin.h | 7 | ||||
| -rw-r--r-- | include/litmus/sched_trace.h | 175 |
11 files changed, 339 insertions, 33 deletions
diff --git a/include/litmus/budget.h b/include/litmus/budget.h index 732530e63491..6ef0e44effb1 100644 --- a/include/litmus/budget.h +++ b/include/litmus/budget.h | |||
| @@ -1,8 +1,24 @@ | |||
| 1 | #ifndef _LITMUS_BUDGET_H_ | 1 | #ifndef _LITMUS_BUDGET_H_ |
| 2 | #define _LITMUS_BUDGET_H_ | 2 | #define _LITMUS_BUDGET_H_ |
| 3 | 3 | ||
| 4 | /* Update the per-processor enforcement timer (arm/reproram/cancel) for | 4 | struct enforcement_timer { |
| 5 | * the next task. */ | 5 | struct hrtimer timer; |
| 6 | int armed; | ||
| 7 | }; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * update_enforcement_timer() - Update per-processor enforcement timer for | ||
| 11 | * the next scheduled task. | ||
| 12 | * | ||
| 13 | * If @t is not NULL and has a precisely enforced budget, the timer will be | ||
| 14 | * armed to trigger a reschedule when the budget is exhausted. Otherwise, | ||
| 15 | * the timer will be cancelled. | ||
| 16 | */ | ||
| 6 | void update_enforcement_timer(struct task_struct* t); | 17 | void update_enforcement_timer(struct task_struct* t); |
| 7 | 18 | ||
| 19 | void init_enforcement_timer(struct enforcement_timer *et); | ||
| 20 | |||
| 21 | void arm_enforcement_timer(struct enforcement_timer* et, struct task_struct* t); | ||
| 22 | |||
| 23 | void cancel_enforcement_timer(struct enforcement_timer* et); | ||
| 8 | #endif | 24 | #endif |
diff --git a/include/litmus/color.h b/include/litmus/color.h index 998af33cd3ea..250f08a6e1f3 100644 --- a/include/litmus/color.h +++ b/include/litmus/color.h | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | #ifndef LITMUS_COLOR_H | 1 | #ifndef LITMUS_COLOR_H |
| 2 | #define LITMUS_COLOR_H | 2 | #define LITMUS_COLOR_H |
| 3 | 3 | ||
| 4 | #define NUM_COLORS 64 | ||
| 5 | #define NUM_WAYS 12 | ||
| 6 | |||
| 7 | #ifdef __KERNEL__ | ||
| 8 | |||
| 4 | #define ONE_COLOR_LEN 11 | 9 | #define ONE_COLOR_LEN 11 |
| 5 | #define ONE_COLOR_FMT "%4lu: %4d\n" | 10 | #define ONE_COLOR_FMT "%4lu: %4d\n" |
| 6 | 11 | ||
| @@ -16,6 +21,8 @@ void add_page_to_color_list(struct page*); | |||
| 16 | void add_page_to_alloced_list(struct page*, struct vm_area_struct*); | 21 | void add_page_to_alloced_list(struct page*, struct vm_area_struct*); |
| 17 | void reclaim_pages(struct vm_area_struct*); | 22 | void reclaim_pages(struct vm_area_struct*); |
| 18 | 23 | ||
| 24 | int color_server_params(int cpu, unsigned long *wcet, unsigned long *period); | ||
| 25 | |||
| 19 | int color_add_pages_handler(struct ctl_table *, int, void __user *, | 26 | int color_add_pages_handler(struct ctl_table *, int, void __user *, |
| 20 | size_t *, loff_t *); | 27 | size_t *, loff_t *); |
| 21 | int color_nr_pages_handler(struct ctl_table *, int, void __user *, | 28 | int color_nr_pages_handler(struct ctl_table *, int, void __user *, |
| @@ -38,3 +45,5 @@ int color_reclaim_pages_handler(struct ctl_table *, int, void __user *, | |||
| 38 | #endif | 45 | #endif |
| 39 | 46 | ||
| 40 | #endif | 47 | #endif |
| 48 | |||
| 49 | #endif | ||
diff --git a/include/litmus/dgl.h b/include/litmus/dgl.h new file mode 100644 index 000000000000..2bf61d4a7547 --- /dev/null +++ b/include/litmus/dgl.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #ifndef __DGL_H_ | ||
| 2 | #define __DGL_H_ | ||
| 3 | |||
| 4 | #include <litmus/color.h> | ||
| 5 | #include <linux/list.h> | ||
| 6 | |||
| 7 | #define WP(num, word) (num / word + (num % word != 0)) | ||
| 8 | |||
| 9 | #define NUM_REPLICAS NUM_WAYS | ||
| 10 | #define NUM_RESOURCES NUM_COLORS | ||
| 11 | #define MASK_SIZE (sizeof(unsigned long) * 8) | ||
| 12 | #define MASK_WORDS WP(NUM_RESOURCES, MASK_SIZE) | ||
| 13 | |||
| 14 | /* | ||
| 15 | * A request for @replica amount of a single resource. | ||
| 16 | */ | ||
| 17 | struct dgl_req { | ||
| 18 | unsigned short replicas; | ||
| 19 | struct list_head list; | ||
| 20 | }; | ||
| 21 | |||
| 22 | /* | ||
| 23 | * Simultaneous @requests for multiple resources. | ||
| 24 | */ | ||
| 25 | struct dgl_group_req { | ||
| 26 | int cpu; | ||
| 27 | unsigned long requested[MASK_WORDS]; | ||
| 28 | unsigned long waiting[MASK_WORDS]; | ||
| 29 | struct dgl_req requests[NUM_RESOURCES]; | ||
| 30 | unsigned long long ts; | ||
| 31 | }; | ||
| 32 | |||
| 33 | /* | ||
| 34 | * A single resource. | ||
| 35 | */ | ||
| 36 | struct dgl_resource { | ||
| 37 | unsigned int free_replicas; | ||
| 38 | struct list_head waiting; | ||
| 39 | }; | ||
| 40 | |||
| 41 | /* | ||
| 42 | * A group of resources. | ||
| 43 | */ | ||
| 44 | struct dgl { | ||
| 45 | struct dgl_resource resources[NUM_RESOURCES]; | ||
| 46 | struct dgl_group_req* acquired[NR_CPUS]; | ||
| 47 | |||
| 48 | char requests; | ||
| 49 | char running; | ||
| 50 | unsigned long long ts; | ||
| 51 | }; | ||
| 52 | |||
| 53 | void dgl_init(struct dgl *dgl); | ||
| 54 | void dgl_group_req_init(struct dgl_group_req *greq); | ||
| 55 | |||
| 56 | void set_req(struct dgl_group_req *greq, int resource, int replicas); | ||
| 57 | |||
| 58 | void add_group_req(struct dgl *dgl, struct dgl_group_req *greq, int cpu); | ||
| 59 | void remove_group_req(struct dgl *dgl, struct dgl_group_req *greq); | ||
| 60 | |||
| 61 | #endif | ||
diff --git a/include/litmus/fifo_common.h b/include/litmus/fifo_common.h new file mode 100644 index 000000000000..4756f77bd511 --- /dev/null +++ b/include/litmus/fifo_common.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | * EDF common data structures and utility functions shared by all EDF | ||
| 3 | * based scheduler plugins | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* CLEANUP: Add comments and make it less messy. | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __FIFO_COMMON_H__ | ||
| 11 | #define __FIFO_COMMON_H__ | ||
| 12 | |||
| 13 | #include <litmus/rt_domain.h> | ||
| 14 | |||
| 15 | void fifo_domain_init(rt_domain_t* rt, check_resched_needed_t resched, | ||
| 16 | release_jobs_t release); | ||
| 17 | |||
| 18 | int fifo_higher_prio(struct task_struct* first, | ||
| 19 | struct task_struct* second); | ||
| 20 | |||
| 21 | int fifo_ready_order(struct bheap_node* a, struct bheap_node* b); | ||
| 22 | |||
| 23 | int fifo_preemption_needed(rt_domain_t* rt, struct task_struct *t); | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 0b071fd359f9..f0ddb89e68dd 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h | |||
| @@ -44,6 +44,8 @@ void litmus_exit_task(struct task_struct *tsk); | |||
| 44 | 44 | ||
| 45 | #define tsk_rt(t) (&(t)->rt_param) | 45 | #define tsk_rt(t) (&(t)->rt_param) |
| 46 | 46 | ||
| 47 | #define get_server_job(t) (tsk_rt(t)->job_params.fake_job_no) | ||
| 48 | |||
| 47 | /* Realtime utility macros */ | 49 | /* Realtime utility macros */ |
| 48 | #define get_rt_flags(t) (tsk_rt(t)->flags) | 50 | #define get_rt_flags(t) (tsk_rt(t)->flags) |
| 49 | #define set_rt_flags(t,f) (tsk_rt(t)->flags=(f)) | 51 | #define set_rt_flags(t,f) (tsk_rt(t)->flags=(f)) |
| @@ -51,10 +53,13 @@ void litmus_exit_task(struct task_struct *tsk); | |||
| 51 | #define get_exec_time(t) (tsk_rt(t)->job_params.exec_time) | 53 | #define get_exec_time(t) (tsk_rt(t)->job_params.exec_time) |
| 52 | #define get_rt_period(t) (tsk_rt(t)->task_params.period) | 54 | #define get_rt_period(t) (tsk_rt(t)->task_params.period) |
| 53 | #define get_rt_phase(t) (tsk_rt(t)->task_params.phase) | 55 | #define get_rt_phase(t) (tsk_rt(t)->task_params.phase) |
| 56 | #define get_rt_job(t) (tsk_rt(t)->job_params.job_no) | ||
| 54 | #define get_partition(t) (tsk_rt(t)->task_params.cpu) | 57 | #define get_partition(t) (tsk_rt(t)->task_params.cpu) |
| 55 | #define get_deadline(t) (tsk_rt(t)->job_params.deadline) | 58 | #define get_deadline(t) (tsk_rt(t)->job_params.deadline) |
| 56 | #define get_release(t) (tsk_rt(t)->job_params.release) | 59 | #define get_release(t) (tsk_rt(t)->job_params.release) |
| 57 | #define get_class(t) (tsk_rt(t)->task_params.cls) | 60 | #define get_class(t) (tsk_rt(t)->task_params.cls) |
| 61 | #define is_server(t) (tsk_rt(t)->is_server) | ||
| 62 | #define get_task_server(task) (tsk_rt(task)->server) | ||
| 58 | 63 | ||
| 59 | #define is_priority_boosted(t) (tsk_rt(t)->priority_boosted) | 64 | #define is_priority_boosted(t) (tsk_rt(t)->priority_boosted) |
| 60 | #define get_boost_start(t) (tsk_rt(t)->boost_start_time) | 65 | #define get_boost_start(t) (tsk_rt(t)->boost_start_time) |
| @@ -128,6 +133,16 @@ void srp_ceiling_block(void); | |||
| 128 | 133 | ||
| 129 | #define bheap2task(hn) ((struct task_struct*) hn->value) | 134 | #define bheap2task(hn) ((struct task_struct*) hn->value) |
| 130 | 135 | ||
| 136 | static inline struct control_page* get_control_page(struct task_struct *t) | ||
| 137 | { | ||
| 138 | return tsk_rt(t)->ctrl_page; | ||
| 139 | } | ||
| 140 | |||
| 141 | static inline int has_control_page(struct task_struct* t) | ||
| 142 | { | ||
| 143 | return tsk_rt(t)->ctrl_page != NULL; | ||
| 144 | } | ||
| 145 | |||
| 131 | #ifdef CONFIG_NP_SECTION | 146 | #ifdef CONFIG_NP_SECTION |
| 132 | 147 | ||
| 133 | static inline int is_kernel_np(struct task_struct *t) | 148 | static inline int is_kernel_np(struct task_struct *t) |
| @@ -230,10 +245,6 @@ static inline int is_np(struct task_struct *t) | |||
| 230 | int kernel, user; | 245 | int kernel, user; |
| 231 | kernel = is_kernel_np(t); | 246 | kernel = is_kernel_np(t); |
| 232 | user = is_user_np(t); | 247 | user = is_user_np(t); |
| 233 | if (kernel || user) | ||
| 234 | TRACE_TASK(t, " is non-preemptive: kernel=%d user=%d\n", | ||
| 235 | |||
| 236 | kernel, user); | ||
| 237 | return kernel || user; | 248 | return kernel || user; |
| 238 | #else | 249 | #else |
| 239 | return unlikely(is_kernel_np(t) || is_user_np(t)); | 250 | return unlikely(is_kernel_np(t) || is_user_np(t)); |
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 4d7b870cb443..41991d5af01b 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
| @@ -9,6 +9,7 @@ struct litmus_lock_ops; | |||
| 9 | struct litmus_lock { | 9 | struct litmus_lock { |
| 10 | struct litmus_lock_ops *ops; | 10 | struct litmus_lock_ops *ops; |
| 11 | int type; | 11 | int type; |
| 12 | int id; | ||
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 14 | struct litmus_lock_ops { | 15 | struct litmus_lock_ops { |
diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h index ac249292e866..b243f998fef7 100644 --- a/include/litmus/rt_domain.h +++ b/include/litmus/rt_domain.h | |||
| @@ -82,6 +82,8 @@ void __add_ready(rt_domain_t* rt, struct task_struct *new); | |||
| 82 | void __merge_ready(rt_domain_t* rt, struct bheap *tasks); | 82 | void __merge_ready(rt_domain_t* rt, struct bheap *tasks); |
| 83 | void __add_release(rt_domain_t* rt, struct task_struct *task); | 83 | void __add_release(rt_domain_t* rt, struct task_struct *task); |
| 84 | 84 | ||
| 85 | struct release_heap* release_heap_alloc(int gfp_flags); | ||
| 86 | |||
| 85 | static inline struct task_struct* __take_ready(rt_domain_t* rt) | 87 | static inline struct task_struct* __take_ready(rt_domain_t* rt) |
| 86 | { | 88 | { |
| 87 | struct bheap_node* hn = bheap_take(rt->order, &rt->ready_queue); | 89 | struct bheap_node* hn = bheap_take(rt->order, &rt->ready_queue); |
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index ed9b7d20a763..2991fff58bc6 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | #ifndef _LINUX_RT_PARAM_H_ | 5 | #ifndef _LINUX_RT_PARAM_H_ |
| 6 | #define _LINUX_RT_PARAM_H_ | 6 | #define _LINUX_RT_PARAM_H_ |
| 7 | 7 | ||
| 8 | #include <litmus/color.h> | ||
| 9 | |||
| 8 | /* Litmus time type. */ | 10 | /* Litmus time type. */ |
| 9 | typedef unsigned long long lt_t; | 11 | typedef unsigned long long lt_t; |
| 10 | 12 | ||
| @@ -69,7 +71,10 @@ union np_flag { | |||
| 69 | struct control_page { | 71 | struct control_page { |
| 70 | volatile union np_flag sched; | 72 | volatile union np_flag sched; |
| 71 | 73 | ||
| 72 | /* to be extended */ | 74 | /* locking overhead tracing: time stamp prior to system call */ |
| 75 | uint64_t ts_syscall_start; /* Feather-Trace cycles */ | ||
| 76 | |||
| 77 | int requests[NUM_COLORS]; | ||
| 73 | }; | 78 | }; |
| 74 | 79 | ||
| 75 | #ifndef __KERNEL__ | 80 | #ifndef __KERNEL__ |
| @@ -92,6 +97,8 @@ struct color_ctrl_page { | |||
| 92 | struct _rt_domain; | 97 | struct _rt_domain; |
| 93 | struct bheap_node; | 98 | struct bheap_node; |
| 94 | struct release_heap; | 99 | struct release_heap; |
| 100 | struct rt_server; | ||
| 101 | struct dgl_group_req; | ||
| 95 | 102 | ||
| 96 | struct rt_job { | 103 | struct rt_job { |
| 97 | /* Time instant the the job was or will be released. */ | 104 | /* Time instant the the job was or will be released. */ |
| @@ -128,6 +135,8 @@ struct rt_param { | |||
| 128 | /* is the task present? (true if it can be scheduled) */ | 135 | /* is the task present? (true if it can be scheduled) */ |
| 129 | unsigned int present:1; | 136 | unsigned int present:1; |
| 130 | 137 | ||
| 138 | unsigned int is_server:1; | ||
| 139 | |||
| 131 | #ifdef CONFIG_LITMUS_LOCKING | 140 | #ifdef CONFIG_LITMUS_LOCKING |
| 132 | /* Is the task being priority-boosted by a locking protocol? */ | 141 | /* Is the task being priority-boosted by a locking protocol? */ |
| 133 | unsigned int priority_boosted:1; | 142 | unsigned int priority_boosted:1; |
| @@ -135,6 +144,8 @@ struct rt_param { | |||
| 135 | lt_t boost_start_time; | 144 | lt_t boost_start_time; |
| 136 | #endif | 145 | #endif |
| 137 | 146 | ||
| 147 | struct rt_server *server; | ||
| 148 | |||
| 138 | /* user controlled parameters */ | 149 | /* user controlled parameters */ |
| 139 | struct rt_task task_params; | 150 | struct rt_task task_params; |
| 140 | 151 | ||
| @@ -213,6 +224,7 @@ struct rt_param { | |||
| 213 | struct control_page * ctrl_page; | 224 | struct control_page * ctrl_page; |
| 214 | 225 | ||
| 215 | struct color_ctrl_page *color_ctrl_page; | 226 | struct color_ctrl_page *color_ctrl_page; |
| 227 | struct dgl_group_req *req; | ||
| 216 | }; | 228 | }; |
| 217 | 229 | ||
| 218 | /* Possible RT flags */ | 230 | /* Possible RT flags */ |
diff --git a/include/litmus/rt_server.h b/include/litmus/rt_server.h new file mode 100644 index 000000000000..0f3147707a3b --- /dev/null +++ b/include/litmus/rt_server.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #ifndef __RT_SERVER_H | ||
| 2 | #define __RT_SERVER_H | ||
| 3 | |||
| 4 | #include <linux/sched.h> | ||
| 5 | #include <litmus/litmus.h> | ||
| 6 | #include <litmus/rt_domain.h> | ||
| 7 | |||
| 8 | struct rt_server; | ||
| 9 | |||
| 10 | typedef int (*need_preempt_t)(rt_domain_t *rt, struct task_struct *t); | ||
| 11 | typedef void (*server_update_t)(struct rt_server *srv); | ||
| 12 | typedef void (*server_requeue_t)(struct rt_server *srv, struct task_struct *t); | ||
| 13 | typedef struct task_struct* (*server_take_t)(struct rt_server *srv); | ||
| 14 | |||
| 15 | struct rt_server { | ||
| 16 | int sid; | ||
| 17 | int cpu; | ||
| 18 | struct task_struct* linked; | ||
| 19 | rt_domain_t* domain; | ||
| 20 | int running; | ||
| 21 | |||
| 22 | /* Does this server have a higher-priority task? */ | ||
| 23 | need_preempt_t need_preempt; | ||
| 24 | /* System state has changed, so should server */ | ||
| 25 | server_update_t update; | ||
| 26 | /* Requeue task in domain */ | ||
| 27 | server_requeue_t requeue; | ||
| 28 | /* Take next task from domain */ | ||
| 29 | server_take_t take; | ||
| 30 | }; | ||
| 31 | |||
| 32 | void init_rt_server(struct rt_server *server, | ||
| 33 | int sid, int cpu, rt_domain_t *domain, | ||
| 34 | need_preempt_t need_preempt, | ||
| 35 | server_requeue_t requeue, | ||
| 36 | server_update_t update, | ||
| 37 | server_take_t take); | ||
| 38 | |||
| 39 | #endif | ||
diff --git a/include/litmus/sched_plugin.h b/include/litmus/sched_plugin.h index 6e7cabdddae8..0f529fa78b4d 100644 --- a/include/litmus/sched_plugin.h +++ b/include/litmus/sched_plugin.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #include <litmus/locking.h> | 11 | #include <litmus/locking.h> |
| 12 | #endif | 12 | #endif |
| 13 | 13 | ||
| 14 | struct litmus_lock; | ||
| 15 | |||
| 14 | /************************ setup/tear down ********************/ | 16 | /************************ setup/tear down ********************/ |
| 15 | 17 | ||
| 16 | typedef long (*activate_plugin_t) (void); | 18 | typedef long (*activate_plugin_t) (void); |
| @@ -67,6 +69,9 @@ typedef long (*admit_task_t)(struct task_struct* tsk); | |||
| 67 | 69 | ||
| 68 | typedef void (*release_at_t)(struct task_struct *t, lt_t start); | 70 | typedef void (*release_at_t)(struct task_struct *t, lt_t start); |
| 69 | 71 | ||
| 72 | /* TODO remove me */ | ||
| 73 | typedef void (*release_ts_t)(lt_t time); | ||
| 74 | |||
| 70 | struct sched_plugin { | 75 | struct sched_plugin { |
| 71 | struct list_head list; | 76 | struct list_head list; |
| 72 | /* basic info */ | 77 | /* basic info */ |
| @@ -93,6 +98,8 @@ struct sched_plugin { | |||
| 93 | task_block_t task_block; | 98 | task_block_t task_block; |
| 94 | task_exit_t task_exit; | 99 | task_exit_t task_exit; |
| 95 | 100 | ||
| 101 | release_ts_t release_ts; | ||
| 102 | |||
| 96 | #ifdef CONFIG_LITMUS_LOCKING | 103 | #ifdef CONFIG_LITMUS_LOCKING |
| 97 | /* locking protocols */ | 104 | /* locking protocols */ |
| 98 | allocate_lock_t allocate_lock; | 105 | allocate_lock_t allocate_lock; |
diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index 7ca34cb13881..96d7666aa22c 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h | |||
| @@ -24,7 +24,8 @@ struct st_param_data { /* regular params */ | |||
| 24 | u32 phase; | 24 | u32 phase; |
| 25 | u8 partition; | 25 | u8 partition; |
| 26 | u8 class; | 26 | u8 class; |
| 27 | u8 __unused[2]; | 27 | u8 level; |
| 28 | u8 __unused[1]; | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | struct st_release_data { /* A job is was/is going to be released. */ | 31 | struct st_release_data { /* A job is was/is going to be released. */ |
| @@ -71,8 +72,8 @@ struct st_resume_data { /* A task resumes. */ | |||
| 71 | 72 | ||
| 72 | struct st_action_data { | 73 | struct st_action_data { |
| 73 | u64 when; | 74 | u64 when; |
| 74 | u8 action; | 75 | u32 action; |
| 75 | u8 __unused[7]; | 76 | u8 __unused[4]; |
| 76 | }; | 77 | }; |
| 77 | 78 | ||
| 78 | struct st_sys_release_data { | 79 | struct st_sys_release_data { |
| @@ -164,34 +165,156 @@ feather_callback void do_sched_trace_sys_release(unsigned long id, | |||
| 164 | 165 | ||
| 165 | #endif | 166 | #endif |
| 166 | 167 | ||
| 168 | #ifdef CONFIG_SCHED_LITMUS_TRACEPOINT | ||
| 169 | |||
| 170 | #include <trace/events/litmus.h> | ||
| 171 | |||
| 172 | #else | ||
| 173 | |||
| 174 | #warning this is happeing | ||
| 175 | |||
| 176 | /* Override trace macros to actually do nothing */ | ||
| 177 | #define trace_litmus_task_param(t) | ||
| 178 | #define trace_litmus_task_release(t) | ||
| 179 | #define trace_litmus_switch_to(t) | ||
| 180 | #define trace_litmus_switch_away(prev) | ||
| 181 | #define trace_litmus_task_completion(t, forced) | ||
| 182 | #define trace_litmus_task_block(t, i) | ||
| 183 | #define trace_litmus_task_resume(t, i) | ||
| 184 | #define trace_litmus_sys_release(start) | ||
| 185 | |||
| 186 | #define trace_litmus_resource_acquire(t, i); | ||
| 187 | #define trace_litmus_resource_release(t, i); | ||
| 188 | #define trace_litmus_priority_donate(t, d, i) | ||
| 189 | |||
| 190 | #define trace_litmus_container_param(cid, name) | ||
| 191 | #define trace_litmus_server_param(sid, cid, wcet, time) | ||
| 192 | #define trace_litmus_server_switch_to(sid, job, tid, tjob) | ||
| 193 | #define trace_litmus_server_switch_away(sid, job, tid, tjob) | ||
| 194 | #define trace_litmus_server_release(sid, job, release, deadline) | ||
| 195 | #define trace_litmus_server_completion(sid, job) | ||
| 196 | |||
| 197 | #endif | ||
| 198 | |||
| 167 | 199 | ||
| 168 | #define SCHED_TRACE_BASE_ID 500 | 200 | #define SCHED_TRACE_BASE_ID 500 |
| 169 | 201 | ||
| 170 | 202 | ||
| 171 | #define sched_trace_task_name(t) \ | 203 | #define sched_trace_task_name(t) \ |
| 172 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 1, do_sched_trace_task_name, t) | 204 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 1, \ |
| 173 | #define sched_trace_task_param(t) \ | 205 | do_sched_trace_task_name, t) |
| 174 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 2, do_sched_trace_task_param, t) | 206 | |
| 175 | #define sched_trace_task_release(t) \ | 207 | #define sched_trace_task_param(t) \ |
| 176 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 3, do_sched_trace_task_release, t) | 208 | do { \ |
| 177 | #define sched_trace_task_switch_to(t) \ | 209 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 2, \ |
| 178 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 4, do_sched_trace_task_switch_to, t) | 210 | do_sched_trace_task_param, t); \ |
| 179 | #define sched_trace_task_switch_away(t) \ | 211 | trace_litmus_task_param(t); \ |
| 180 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 5, do_sched_trace_task_switch_away, t) | 212 | } while (0) |
| 181 | #define sched_trace_task_completion(t, forced) \ | 213 | |
| 182 | SCHED_TRACE2(SCHED_TRACE_BASE_ID + 6, do_sched_trace_task_completion, t, \ | 214 | #define sched_trace_task_release(t) \ |
| 183 | (unsigned long) forced) | 215 | do { \ |
| 184 | #define sched_trace_task_block(t) \ | 216 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 3, \ |
| 185 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, do_sched_trace_task_block, t) | 217 | do_sched_trace_task_release, t); \ |
| 186 | #define sched_trace_task_resume(t) \ | 218 | trace_litmus_task_release(t); \ |
| 187 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, do_sched_trace_task_resume, t) | 219 | } while (0) |
| 188 | #define sched_trace_action(t, action) \ | 220 | |
| 189 | SCHED_TRACE2(SCHED_TRACE_BASE_ID + 9, do_sched_trace_action, t, \ | 221 | #define sched_trace_task_switch_to(t) \ |
| 190 | (unsigned long) action); | 222 | do { \ |
| 191 | /* when is a pointer, it does not need an explicit cast to unsigned long */ | 223 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 4, \ |
| 192 | #define sched_trace_sys_release(when) \ | 224 | do_sched_trace_task_switch_to, t); \ |
| 193 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 10, do_sched_trace_sys_release, when) | 225 | trace_litmus_switch_to(t); \ |
| 226 | } while (0) | ||
| 227 | |||
| 228 | #define sched_trace_task_switch_away(t) \ | ||
| 229 | do { \ | ||
| 230 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 5, \ | ||
| 231 | do_sched_trace_task_switch_away, t); \ | ||
| 232 | trace_litmus_switch_away(t); \ | ||
| 233 | } while (0) | ||
| 234 | |||
| 235 | #define sched_trace_task_completion(t, forced) \ | ||
| 236 | do { \ | ||
| 237 | SCHED_TRACE2(SCHED_TRACE_BASE_ID + 6, \ | ||
| 238 | do_sched_trace_task_completion, t, \ | ||
| 239 | (unsigned long) forced); \ | ||
| 240 | trace_litmus_task_completion(t, forced); \ | ||
| 241 | } while (0) | ||
| 242 | |||
| 243 | #define sched_trace_task_block(t, i) \ | ||
| 244 | do { \ | ||
| 245 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, \ | ||
| 246 | do_sched_trace_task_block, t); \ | ||
| 247 | trace_litmus_task_block(t, i); \ | ||
| 248 | } while (0) | ||
| 249 | |||
| 250 | #define sched_trace_task_resume(t, i) \ | ||
| 251 | do { \ | ||
| 252 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, \ | ||
| 253 | do_sched_trace_task_resume, t); \ | ||
| 254 | trace_litmus_task_resume(t, i); \ | ||
| 255 | } while (0) | ||
| 256 | |||
| 257 | #define sched_trace_action(t, action) \ | ||
| 258 | SCHED_TRACE2(SCHED_TRACE_BASE_ID + 9, \ | ||
| 259 | do_sched_trace_action, t, (unsigned long) action); | ||
| 194 | 260 | ||
| 261 | /* when is a pointer, it does not need an explicit cast to unsigned long */ | ||
| 262 | #define sched_trace_sys_release(when) \ | ||
| 263 | do { \ | ||
| 264 | SCHED_TRACE(SCHED_TRACE_BASE_ID + 10, \ | ||
| 265 | do_sched_trace_sys_release, when); \ | ||
| 266 | trace_litmus_sys_release(when); \ | ||
| 267 | } while (0) | ||
| 268 | |||
| 269 | #define QT_START lt_t _qt_start = litmus_clock() | ||
| 270 | #define QT_END \ | ||
| 271 | sched_trace_log_message("%d P%d [%s@%s:%d]: Took %llu\n\n", \ | ||
| 272 | TRACE_ARGS, litmus_clock() - _qt_start) | ||
| 273 | |||
| 274 | #define sched_trace_resource_acquire(t, i) \ | ||
| 275 | do { \ | ||
| 276 | trace_litmus_resource_acquire(t, i); \ | ||
| 277 | } while (0) | ||
| 278 | |||
| 279 | #define sched_trace_resource_release(t, i) \ | ||
| 280 | do { \ | ||
| 281 | trace_litmus_resource_release(t, i); \ | ||
| 282 | } while (0) | ||
| 283 | |||
| 284 | #define sched_trace_priority_donate(t, d, i) \ | ||
| 285 | do { \ | ||
| 286 | trace_litmus_priority_donate(t, d, i); \ | ||
| 287 | } while (0) | ||
| 288 | |||
| 289 | #define sched_trace_container_param(cid, name) \ | ||
| 290 | do { \ | ||
| 291 | trace_litmus_container_param(cid, name); \ | ||
| 292 | } while (0) | ||
| 293 | |||
| 294 | #define sched_trace_server_param(sid, cid, wcet, period) \ | ||
| 295 | do { \ | ||
| 296 | trace_litmus_server_param(sid, cid, wcet, period); \ | ||
| 297 | } while(0) | ||
| 298 | |||
| 299 | #define sched_trace_server_switch_to(sid, job, tid, tjob) \ | ||
| 300 | do { \ | ||
| 301 | trace_litmus_server_switch_to(sid, job, tid, tjob); \ | ||
| 302 | } while(0) | ||
| 303 | |||
| 304 | #define sched_trace_server_switch_away(sid, job, tid, tjob) \ | ||
| 305 | do { \ | ||
| 306 | trace_litmus_server_switch_away(sid, job, tid, tjob); \ | ||
| 307 | } while (0) | ||
| 308 | |||
| 309 | #define sched_trace_server_release(sid, job, rel, dead) \ | ||
| 310 | do { \ | ||
| 311 | trace_litmus_server_release(sid, job, rel, dead); \ | ||
| 312 | } while (0) | ||
| 313 | |||
| 314 | #define sched_trace_server_completion(sid, job) \ | ||
| 315 | do { \ | ||
| 316 | trace_litmus_server_completion(sid, job); \ | ||
| 317 | } while (0) | ||
| 195 | 318 | ||
| 196 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ | 319 | #define sched_trace_quantum_boundary() /* NOT IMPLEMENTED */ |
| 197 | 320 | ||
