aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-09-27 14:47:26 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-09-27 14:47:26 -0400
commitf21e1d0ef90c2e88ae6a563afc31ea601ed968c7 (patch)
treed7a0cf75344c890c81fbd402f0da1764937eebc8 /include
parent2fe725ef2142dd6c1bbf72e8d1b0a6f7e885d7ed (diff)
Timer merging
Diffstat (limited to 'include')
-rw-r--r--include/litmus/event_group.h50
-rw-r--r--include/litmus/rt_domain.h13
-rw-r--r--include/litmus/rt_param.h3
-rw-r--r--include/litmus/sched_mc.h7
4 files changed, 60 insertions, 13 deletions
diff --git a/include/litmus/event_group.h b/include/litmus/event_group.h
index 58692a11b683..37d5012d770e 100644
--- a/include/litmus/event_group.h
+++ b/include/litmus/event_group.h
@@ -3,13 +3,14 @@
3 3
4#define EVENT_QUEUE_SLOTS 127 /* prime */ 4#define EVENT_QUEUE_SLOTS 127 /* prime */
5 5
6typedef void (*fire_event_t)(void *data); 6struct rt_event;
7typedef void (*fire_event_t)(struct rt_event *e);
7 8
8struct event_group { 9struct event_group {
9 lt_t res; 10 lt_t res;
10 int cpu; 11 int cpu;
11 struct list_head event_queue[EVENT_QUEUE_SLOTS]; 12 struct list_head event_queue[EVENT_QUEUE_SLOTS];
12 raw_spinlock_t queue_lock; 13 raw_spinlock_t queue_lock;
13}; 14};
14 15
15/** 16/**
@@ -23,8 +24,8 @@ struct event_list {
23 struct hrtimer timer; 24 struct hrtimer timer;
24 struct hrtimer_start_on_info info; 25 struct hrtimer_start_on_info info;
25 26
26 struct list_head list; /* For event_queue */ 27 struct list_head list; /* For event_queue */
27 struct event_group *group; /* For callback */ 28 struct event_group* group; /* For callback */
28}; 29};
29 30
30/** 31/**
@@ -32,10 +33,8 @@ struct event_list {
32 */ 33 */
33struct rt_event { 34struct rt_event {
34 /* Function to call on event expiration */ 35 /* Function to call on event expiration */
35 fire_event_t fire; 36 fire_event_t function;
36 /* To be passed into fire */ 37 /* Priority of this event (lower is better) */
37 void *data;
38 /* Priority of this event (lower is better */
39 int prio; 38 int prio;
40 39
41 /* For membership in the event_list */ 40 /* For membership in the event_list */
@@ -48,9 +47,38 @@ struct rt_event {
48 struct event_list *event_list; 47 struct event_list *event_list;
49}; 48};
50 49
51void init_event_group(struct event_group*, lt_t, int); 50/**
52void add_event(struct event_group*, struct rt_event*, lt_t); 51 * init_event_group() - Prepare group for events.
53void cancel_event(struct event_group*, struct rt_event*); 52 * @group Group to prepare
53 * @res Timer resolution. Two events of @res distance will be merged
54 * @cpu Cpu on which to fire timers
55 */
56void init_event_group(struct event_group* group, lt_t res, int cpu);
57
58/**
59 * add_event() - Add timer to event group.
60 * @group Group with which to merge event
61 * @e Event to be fired at a specific time
62 * @time Time to fire event
63 */
64void add_event(struct event_group* group, struct rt_event* e, lt_t time);
65
66/**
67 * cancel_event() - Remove event from the group.
68 */
69void cancel_event(struct rt_event*);
70
71/**
72 * init_event() - Create an event.
73 * @e Event to create
74 * @prio Priority of the event (lower is better)
75 * @function Function to fire when event expires
76 * @el Pre-allocated event list for timer merging
77 */
78void init_event(struct rt_event* e, int prio, fire_event_t function,
79 struct event_list *el);
80
54struct event_list* event_list_alloc(int); 81struct event_list* event_list_alloc(int);
82void event_list_free(struct event_list *el);
55 83
56#endif 84#endif
diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h
index 0e4e75cd1e67..59350fb78d4f 100644
--- a/include/litmus/rt_domain.h
+++ b/include/litmus/rt_domain.h
@@ -7,6 +7,7 @@
7 7
8#include <litmus/bheap.h> 8#include <litmus/bheap.h>
9#include <litmus/domain.h> 9#include <litmus/domain.h>
10#include <litmus/event_group.h>
10 11
11#define RELEASE_QUEUE_SLOTS 127 /* prime */ 12#define RELEASE_QUEUE_SLOTS 127 /* prime */
12 13
@@ -30,7 +31,10 @@ typedef struct _rt_domain {
30 raw_spinlock_t release_lock; 31 raw_spinlock_t release_lock;
31 struct release_queue release_queue; 32 struct release_queue release_queue;
32 33
33#ifdef CONFIG_RELEASE_MASTER 34#ifdef CONFIG_MERGE_TIMERS
35 struct event_group* event_group;
36 int prio;
37#elif CONFIG_RELEASE_MASTER
34 int release_master; 38 int release_master;
35#endif 39#endif
36 40
@@ -54,13 +58,18 @@ struct release_heap {
54 lt_t release_time; 58 lt_t release_time;
55 /* all tasks to be released at release_time */ 59 /* all tasks to be released at release_time */
56 struct bheap heap; 60 struct bheap heap;
61
62#ifdef CONFIG_MERGE_TIMERS
63 /* used to merge timer calls */
64 struct rt_event event;
65#else
57 /* used to trigger the release */ 66 /* used to trigger the release */
58 struct hrtimer timer; 67 struct hrtimer timer;
59
60#ifdef CONFIG_RELEASE_MASTER 68#ifdef CONFIG_RELEASE_MASTER
61 /* used to delegate releases */ 69 /* used to delegate releases */
62 struct hrtimer_start_on_info info; 70 struct hrtimer_start_on_info info;
63#endif 71#endif
72#endif
64 /* required for the timer callback */ 73 /* required for the timer callback */
65 rt_domain_t* dom; 74 rt_domain_t* dom;
66}; 75};
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index e247fb515e8c..e6288e8807f0 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -123,6 +123,9 @@ struct rt_param {
123 /* mixed criticality specific data */ 123 /* mixed criticality specific data */
124 struct mc_data *mc_data; 124 struct mc_data *mc_data;
125#endif 125#endif
126#ifdef CONFIG_MERGE_TIMERS
127 struct rt_event *event;
128#endif
126 129
127 /* user controlled parameters */ 130 /* user controlled parameters */
128 struct rt_task task_params; 131 struct rt_task task_params;
diff --git a/include/litmus/sched_mc.h b/include/litmus/sched_mc.h
index 95cd22cd7202..9ddf860c83a7 100644
--- a/include/litmus/sched_mc.h
+++ b/include/litmus/sched_mc.h
@@ -31,6 +31,13 @@ struct mc_data {
31#define tsk_mc_data(t) (tsk_rt(t)->mc_data) 31#define tsk_mc_data(t) (tsk_rt(t)->mc_data)
32#define tsk_mc_crit(t) (tsk_mc_data(t)->mc_task.crit) 32#define tsk_mc_crit(t) (tsk_mc_data(t)->mc_task.crit)
33#define is_ghost(t) (tsk_mc_data(t)->mc_job.is_ghost) 33#define is_ghost(t) (tsk_mc_data(t)->mc_job.is_ghost)
34#define TS "(%s/%d:%d:%s)"
35#define TA(t) (t) ? (is_ghost(t)) ? "ghost" : t->comm : "NULL", \
36 (t) ? t->pid : 1, \
37 (t) ? t->rt_param.job_params.job_no : 1, \
38 (t && get_task_domain(t)) ? get_task_domain(t)->name : ""
39#define TRACE_MC_TASK(t, fmt, args...) \
40 TRACE(TS " " fmt "\n", TA(t), ##args)
34 41
35/* 42/*
36 * Cache the budget along with the struct PID for a task so that we don't need 43 * Cache the budget along with the struct PID for a task so that we don't need