diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-05-03 16:50:32 -0400 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-05-03 17:17:52 -0400 |
| commit | bb35f3fc684667598d7ae39fd2d49a16f77beb39 (patch) | |
| tree | 6a70f13510e36e2771652bb3fc6d60321bf1daf6 /include | |
| parent | e0e02579c34b9920781b3ce3fc9d6d7bcafb4d5b (diff) | |
Added color schedule
Diffstat (limited to 'include')
| -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 | ||||
| -rw-r--r-- | include/trace/events/litmus.h | 425 | ||||
| -rw-r--r-- | include/trace/ftrace.h | 5 |
13 files changed, 767 insertions, 35 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 | ||
diff --git a/include/trace/events/litmus.h b/include/trace/events/litmus.h new file mode 100644 index 000000000000..136a80db54a4 --- /dev/null +++ b/include/trace/events/litmus.h | |||
| @@ -0,0 +1,425 @@ | |||
| 1 | /* | ||
| 2 | * LITMUS^RT kernel style scheduling tracepoints | ||
| 3 | */ | ||
| 4 | #undef TRACE_SYSTEM | ||
| 5 | #define TRACE_SYSTEM litmus | ||
| 6 | |||
| 7 | #if !defined(_SCHED_TASK_TRACEPOINT_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 8 | #define _SCHED_TASK_TRACEPOINT_H | ||
| 9 | |||
| 10 | #include <linux/tracepoint.h> | ||
| 11 | |||
| 12 | #include <litmus/litmus.h> | ||
| 13 | #include <litmus/rt_param.h> | ||
| 14 | |||
| 15 | TRACE_EVENT(litmus_task_param, | ||
| 16 | |||
| 17 | TP_PROTO(struct task_struct *t), | ||
| 18 | |||
| 19 | TP_ARGS(t), | ||
| 20 | |||
| 21 | TP_STRUCT__entry( | ||
| 22 | __field( pid_t, pid ) | ||
| 23 | __field( unsigned int, job ) | ||
| 24 | __field( unsigned long long, wcet ) | ||
| 25 | __field( unsigned long long, period ) | ||
| 26 | __field( unsigned long long, phase ) | ||
| 27 | __field( int, partition ) | ||
| 28 | ), | ||
| 29 | |||
| 30 | TP_fast_assign( | ||
| 31 | __entry->pid = t ? t->pid : 0; | ||
| 32 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
| 33 | __entry->wcet = get_exec_cost(t); | ||
| 34 | __entry->period = get_rt_period(t); | ||
| 35 | __entry->phase = get_rt_phase(t); | ||
| 36 | __entry->partition = get_partition(t); | ||
| 37 | ), | ||
| 38 | |||
| 39 | TP_printk("period(%d, %Lu).\nwcet(%d, %Lu).\n", | ||
| 40 | __entry->pid, __entry->period, | ||
| 41 | __entry->pid, __entry->wcet) | ||
| 42 | ); | ||
| 43 | |||
| 44 | /* | ||
| 45 | * Tracing jobs release | ||
| 46 | */ | ||
| 47 | TRACE_EVENT(litmus_task_release, | ||
| 48 | |||
| 49 | TP_PROTO(struct task_struct *t), | ||
| 50 | |||
| 51 | TP_ARGS(t), | ||
| 52 | |||
| 53 | TP_STRUCT__entry( | ||
| 54 | __field( pid_t, pid ) | ||
| 55 | __field( unsigned int, job ) | ||
| 56 | __field( unsigned long long, release ) | ||
| 57 | __field( unsigned long long, deadline ) | ||
| 58 | ), | ||
| 59 | |||
| 60 | TP_fast_assign( | ||
| 61 | __entry->pid = t ? t->pid : 0; | ||
| 62 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
| 63 | __entry->release = get_release(t); | ||
| 64 | __entry->deadline = get_deadline(t); | ||
| 65 | ), | ||
| 66 | |||
| 67 | TP_printk("release(job(%u, %u)): %Lu\ndeadline(job(%u, %u)): %Lu\n", | ||
| 68 | __entry->pid, __entry->job, __entry->release, | ||
| 69 | __entry->pid, __entry->job, __entry->deadline) | ||
| 70 | ); | ||
| 71 | |||
| 72 | /* | ||
| 73 | * Tracepoint for switching to new task | ||
| 74 | */ | ||
| 75 | TRACE_EVENT(litmus_switch_to, | ||
| 76 | |||
| 77 | TP_PROTO(struct task_struct *t), | ||
| 78 | |||
| 79 | TP_ARGS(t), | ||
| 80 | |||
| 81 | TP_STRUCT__entry( | ||
| 82 | __field( pid_t, pid ) | ||
| 83 | __field( unsigned int, job ) | ||
| 84 | __field( unsigned long long, exec_time ) | ||
| 85 | ), | ||
| 86 | |||
| 87 | TP_fast_assign( | ||
| 88 | __entry->pid = t->pid;//is_realtime(t) ? t->pid : 0; | ||
| 89 | __entry->job = t->rt_param.job_params.job_no;//is_realtime(t) ? t->rt_param.job_params.job_no : 0; | ||
| 90 | __entry->exec_time = get_exec_time(t); | ||
| 91 | ), | ||
| 92 | |||
| 93 | TP_printk("switch_to(job(%u, %u)): (exec: %Lu)\n", | ||
| 94 | __entry->pid, __entry->job, | ||
| 95 | __entry->exec_time) | ||
| 96 | ); | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Tracepoint for switching away previous task | ||
| 100 | */ | ||
| 101 | TRACE_EVENT(litmus_switch_away, | ||
| 102 | |||
| 103 | TP_PROTO(struct task_struct *t), | ||
| 104 | |||
| 105 | TP_ARGS(t), | ||
| 106 | |||
| 107 | TP_STRUCT__entry( | ||
| 108 | __field( pid_t, pid ) | ||
| 109 | __field( unsigned int, job ) | ||
| 110 | __field( unsigned long long, exec_time ) | ||
| 111 | ), | ||
| 112 | |||
| 113 | TP_fast_assign( | ||
| 114 | __entry->pid = t->pid;//is_realtime(t) ? t->pid : 0; | ||
| 115 | __entry->job = t->rt_param.job_params.job_no;//is_realtime(t) ? t->rt_param.job_params.job_no : 0; | ||
| 116 | __entry->exec_time = get_exec_time(t); | ||
| 117 | ), | ||
| 118 | |||
| 119 | TP_printk("switch_away(job(%u, %u)): (exec: %Lu)\n", | ||
| 120 | __entry->pid, __entry->job, | ||
| 121 | __entry->exec_time) | ||
| 122 | ); | ||
| 123 | |||
| 124 | /* | ||
| 125 | * Tracing jobs completion | ||
| 126 | */ | ||
| 127 | TRACE_EVENT(litmus_task_completion, | ||
| 128 | |||
| 129 | TP_PROTO(struct task_struct *t, unsigned long forced), | ||
| 130 | |||
| 131 | TP_ARGS(t, forced), | ||
| 132 | |||
| 133 | TP_STRUCT__entry( | ||
| 134 | __field( pid_t, pid ) | ||
| 135 | __field( unsigned int, job ) | ||
| 136 | __field( unsigned long, forced ) | ||
| 137 | ), | ||
| 138 | |||
| 139 | TP_fast_assign( | ||
| 140 | __entry->pid = t ? t->pid : 0; | ||
| 141 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
| 142 | __entry->forced = forced; | ||
| 143 | ), | ||
| 144 | |||
| 145 | TP_printk("completed(job(%u, %u)): (forced: %lu)\n", | ||
| 146 | __entry->pid, __entry->job, | ||
| 147 | __entry->forced) | ||
| 148 | ); | ||
| 149 | |||
| 150 | /* | ||
| 151 | * Trace blocking tasks. | ||
| 152 | */ | ||
| 153 | TRACE_EVENT(litmus_task_block, | ||
| 154 | |||
| 155 | TP_PROTO(struct task_struct *t, int lid), | ||
| 156 | |||
| 157 | TP_ARGS(t, lid), | ||
| 158 | |||
| 159 | TP_STRUCT__entry( | ||
| 160 | __field( pid_t, pid ) | ||
| 161 | __field( int, lid ) | ||
| 162 | ), | ||
| 163 | |||
| 164 | TP_fast_assign( | ||
| 165 | __entry->pid = t ? t->pid : 0; | ||
| 166 | __entry->lid = lid; | ||
| 167 | ), | ||
| 168 | |||
| 169 | TP_printk("(%u) blocks on %d\n", __entry->pid, | ||
| 170 | __entry->lid) | ||
| 171 | ); | ||
| 172 | |||
| 173 | /* | ||
| 174 | * Lock events | ||
| 175 | */ | ||
| 176 | TRACE_EVENT(litmus_resource_acquire, | ||
| 177 | |||
| 178 | TP_PROTO(struct task_struct *t, int lid), | ||
| 179 | |||
| 180 | TP_ARGS(t, lid), | ||
| 181 | |||
| 182 | TP_STRUCT__entry( | ||
| 183 | __field( pid_t, pid ) | ||
| 184 | __field( int, lid ) | ||
| 185 | ), | ||
| 186 | |||
| 187 | TP_fast_assign( | ||
| 188 | __entry->pid = t ? t->pid : 0; | ||
| 189 | __entry->lid = lid; | ||
| 190 | ), | ||
| 191 | |||
| 192 | TP_printk("(%u) acquires %d\n", __entry->pid, | ||
| 193 | __entry->lid) | ||
| 194 | ); | ||
| 195 | |||
| 196 | TRACE_EVENT(litmus_resource_release, | ||
| 197 | |||
| 198 | TP_PROTO(struct task_struct *t, int lid), | ||
| 199 | |||
| 200 | TP_ARGS(t, lid), | ||
| 201 | |||
| 202 | TP_STRUCT__entry( | ||
| 203 | __field( pid_t, pid ) | ||
| 204 | __field( int, lid ) | ||
| 205 | ), | ||
| 206 | |||
| 207 | TP_fast_assign( | ||
| 208 | __entry->pid = t ? t->pid : 0; | ||
| 209 | __entry->lid = lid; | ||
| 210 | ), | ||
| 211 | |||
| 212 | TP_printk("(%u) releases %d\n", __entry->pid, | ||
| 213 | __entry->lid) | ||
| 214 | ); | ||
| 215 | |||
| 216 | TRACE_EVENT(litmus_priority_donate, | ||
| 217 | |||
| 218 | TP_PROTO(struct task_struct *t, struct task_struct *donor, int lid), | ||
| 219 | |||
| 220 | TP_ARGS(t, donor, lid), | ||
| 221 | |||
| 222 | TP_STRUCT__entry( | ||
| 223 | __field( pid_t, t_pid ) | ||
| 224 | __field( pid_t, d_pid ) | ||
| 225 | __field( unsigned long long, prio) | ||
| 226 | __field( int, lid ) | ||
| 227 | ), | ||
| 228 | |||
| 229 | TP_fast_assign( | ||
| 230 | __entry->t_pid = t ? t->pid : 0; | ||
| 231 | __entry->d_pid = donor ? donor->pid : 0; | ||
| 232 | __entry->prio = get_deadline(donor); | ||
| 233 | __entry->lid = lid; | ||
| 234 | ), | ||
| 235 | |||
| 236 | TP_printk("(%u) inherits %llu from (%u) on %d\n", __entry->t_pid, | ||
| 237 | __entry->d_pid, __entry->prio, __entry->lid) | ||
| 238 | ); | ||
| 239 | |||
| 240 | /* | ||
| 241 | * Tracing jobs resume | ||
| 242 | */ | ||
| 243 | TRACE_EVENT(litmus_task_resume, | ||
| 244 | |||
| 245 | TP_PROTO(struct task_struct *t, int lid), | ||
| 246 | |||
| 247 | TP_ARGS(t, lid), | ||
| 248 | |||
| 249 | TP_STRUCT__entry( | ||
| 250 | __field( pid_t, pid ) | ||
| 251 | __field( int, lid ) | ||
| 252 | __field( unsigned int, job ) | ||
| 253 | ), | ||
| 254 | |||
| 255 | TP_fast_assign( | ||
| 256 | __entry->pid = t ? t->pid : 0; | ||
| 257 | __entry->job = t ? t->rt_param.job_params.job_no : 0; | ||
| 258 | __entry->lid = lid; | ||
| 259 | ), | ||
| 260 | |||
| 261 | TP_printk("resume(job(%u, %u)) on %d\n", | ||
| 262 | __entry->pid, __entry->job, | ||
| 263 | __entry->lid) | ||
| 264 | ); | ||
| 265 | |||
| 266 | /* | ||
| 267 | * Trace synchronous release | ||
| 268 | */ | ||
| 269 | TRACE_EVENT(litmus_sys_release, | ||
| 270 | |||
| 271 | TP_PROTO(unsigned long long *start), | ||
| 272 | |||
| 273 | TP_ARGS(start), | ||
| 274 | |||
| 275 | TP_STRUCT__entry( | ||
| 276 | __field( unsigned long long, rel ) | ||
| 277 | ), | ||
| 278 | |||
| 279 | TP_fast_assign( | ||
| 280 | __entry->rel = *start; | ||
| 281 | ), | ||
| 282 | |||
| 283 | TP_printk("SynRelease(%Lu)\n", __entry->rel) | ||
| 284 | ); | ||
| 285 | |||
| 286 | /* | ||
| 287 | * Containers | ||
| 288 | */ | ||
| 289 | TRACE_EVENT(litmus_container_param, | ||
| 290 | |||
| 291 | TP_PROTO(int cid, const char *name), | ||
| 292 | |||
| 293 | TP_ARGS(cid, name), | ||
| 294 | |||
| 295 | TP_STRUCT__entry( | ||
| 296 | __field( int, cid ) | ||
| 297 | __array( char, name, TASK_COMM_LEN ) | ||
| 298 | ), | ||
| 299 | |||
| 300 | TP_fast_assign( | ||
| 301 | memcpy(__entry->name, name, TASK_COMM_LEN); | ||
| 302 | __entry->cid = cid; | ||
| 303 | ), | ||
| 304 | |||
| 305 | TP_printk("container, name: %s, id: %d\n", __entry->name, __entry->cid) | ||
| 306 | ); | ||
| 307 | |||
| 308 | TRACE_EVENT(litmus_server_param, | ||
| 309 | |||
| 310 | TP_PROTO(int sid, int cid, unsigned long long wcet, unsigned long long period), | ||
| 311 | |||
| 312 | TP_ARGS(sid, cid, wcet, period), | ||
| 313 | |||
| 314 | TP_STRUCT__entry( | ||
| 315 | __field( int, sid ) | ||
| 316 | __field( int, cid ) | ||
| 317 | __field( unsigned long long, wcet ) | ||
| 318 | __field( unsigned long long, period ) | ||
| 319 | ), | ||
| 320 | |||
| 321 | TP_fast_assign( | ||
| 322 | __entry->cid = cid; | ||
| 323 | __entry->sid = sid; | ||
| 324 | __entry->wcet = wcet; | ||
| 325 | __entry->period = period; | ||
| 326 | ), | ||
| 327 | |||
| 328 | TP_printk("server(%llu, %llu), sid: %llu, cont: %llu\n", | ||
| 329 | __entry->wcet, __entry->period, __entry->sid, __entry->cid) | ||
| 330 | ); | ||
| 331 | |||
| 332 | TRACE_EVENT(litmus_server_switch_to, | ||
| 333 | |||
| 334 | TP_PROTO(int sid, unsigned int job, int tid, unsigned int tjob), | ||
| 335 | |||
| 336 | TP_ARGS(sid, job, tid, tjob), | ||
| 337 | |||
| 338 | TP_STRUCT__entry( | ||
| 339 | __field( int, sid) | ||
| 340 | __field( unsigned int, job) | ||
| 341 | __field( int, tid) | ||
| 342 | __field( unsigned int, tjob) | ||
| 343 | ), | ||
| 344 | |||
| 345 | TP_fast_assign( | ||
| 346 | __entry->sid = sid; | ||
| 347 | __entry->tid = tid; | ||
| 348 | __entry->job = job; | ||
| 349 | __entry->tjob = tjob; | ||
| 350 | ), | ||
| 351 | |||
| 352 | TP_printk("switch_to(server(%d, %u)): (%d, %d)\n", __entry->sid, __entry->job, __entry->tid, __entry->tjob) | ||
| 353 | ); | ||
| 354 | |||
| 355 | TRACE_EVENT(litmus_server_switch_away, | ||
| 356 | |||
| 357 | TP_PROTO(int sid, unsigned int job, int tid, unsigned int tjob), | ||
| 358 | |||
| 359 | TP_ARGS(sid, job, tid, tjob), | ||
| 360 | |||
| 361 | TP_STRUCT__entry( | ||
| 362 | __field( int, sid) | ||
| 363 | __field( unsigned int, job) | ||
| 364 | __field( int, tid) | ||
| 365 | __field( unsigned int, tjob) | ||
| 366 | ), | ||
| 367 | |||
| 368 | TP_fast_assign( | ||
| 369 | __entry->sid = sid; | ||
| 370 | __entry->tid = tid; | ||
| 371 | __entry->job = job; | ||
| 372 | __entry->tjob = tjob; | ||
| 373 | ), | ||
| 374 | |||
| 375 | TP_printk("switch_away(server(%d, %u)): (%d, %d)\n", __entry->sid, __entry->job, __entry->tid, __entry->tjob) | ||
| 376 | ); | ||
| 377 | |||
| 378 | TRACE_EVENT(litmus_server_release, | ||
| 379 | |||
| 380 | TP_PROTO(int sid, unsigned int job, | ||
| 381 | unsigned long long release, | ||
| 382 | unsigned long long deadline), | ||
| 383 | |||
| 384 | TP_ARGS(sid, job, release, deadline), | ||
| 385 | |||
| 386 | TP_STRUCT__entry( | ||
| 387 | __field( int, sid) | ||
| 388 | __field( unsigned int, job) | ||
| 389 | __field( unsigned long long, release) | ||
| 390 | __field( unsigned long long, deadline) | ||
| 391 | ), | ||
| 392 | |||
| 393 | TP_fast_assign( | ||
| 394 | __entry->sid = sid; | ||
| 395 | __entry->job = job; | ||
| 396 | __entry->release = release; | ||
| 397 | __entry->deadline = deadline; | ||
| 398 | ), | ||
| 399 | |||
| 400 | TP_printk("release(server(%d, %u)), release: %llu, deadline: %llu\n", __entry->sid, __entry->job, __entry->release, __entry->deadline) | ||
| 401 | ); | ||
| 402 | |||
| 403 | TRACE_EVENT(litmus_server_completion, | ||
| 404 | |||
| 405 | TP_PROTO(int sid, int job), | ||
| 406 | |||
| 407 | TP_ARGS(sid, job), | ||
| 408 | |||
| 409 | TP_STRUCT__entry( | ||
| 410 | __field( int, sid) | ||
| 411 | __field( unsigned int, job) | ||
| 412 | ), | ||
| 413 | |||
| 414 | TP_fast_assign( | ||
| 415 | __entry->sid = sid; | ||
| 416 | __entry->job = job; | ||
| 417 | ), | ||
| 418 | |||
| 419 | TP_printk("completion(server(%d, %d))\n", __entry->sid, __entry->job) | ||
| 420 | ); | ||
| 421 | |||
| 422 | #endif /* _SCHED_TASK_TRACEPOINT_H */ | ||
| 423 | |||
| 424 | /* Must stay outside the protection */ | ||
| 425 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 533c49f48047..4d6f3474e8fa 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/ftrace_event.h> | 19 | #include <linux/ftrace_event.h> |
| 20 | #include <litmus/litmus.h> | ||
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| 22 | * DECLARE_EVENT_CLASS can be used to add a generic function | 23 | * DECLARE_EVENT_CLASS can be used to add a generic function |
| @@ -54,7 +55,7 @@ | |||
| 54 | #define __string(item, src) __dynamic_array(char, item, -1) | 55 | #define __string(item, src) __dynamic_array(char, item, -1) |
| 55 | 56 | ||
| 56 | #undef TP_STRUCT__entry | 57 | #undef TP_STRUCT__entry |
| 57 | #define TP_STRUCT__entry(args...) args | 58 | #define TP_STRUCT__entry(args...) args __field( unsigned long long, __rt_ts ) |
| 58 | 59 | ||
| 59 | #undef DECLARE_EVENT_CLASS | 60 | #undef DECLARE_EVENT_CLASS |
| 60 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ | 61 | #define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \ |
| @@ -507,7 +508,7 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
| 507 | strcpy(__get_str(dst), src); | 508 | strcpy(__get_str(dst), src); |
| 508 | 509 | ||
| 509 | #undef TP_fast_assign | 510 | #undef TP_fast_assign |
| 510 | #define TP_fast_assign(args...) args | 511 | #define TP_fast_assign(args...) args; __entry->__rt_ts = litmus_clock(); |
| 511 | 512 | ||
| 512 | #undef TP_perf_assign | 513 | #undef TP_perf_assign |
| 513 | #define TP_perf_assign(args...) | 514 | #define TP_perf_assign(args...) |
