aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-02-14 15:35:52 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2013-02-14 15:35:52 -0500
commite9b88341eb6b9fbe16139796f2f78e1f65793e5a (patch)
tree92e4a45391094f904c98ea8d4d6765420311029f /include
parentc063e088be8e1bcbb6a76b8cd087f8dc8b6923b2 (diff)
Generalize IKGLP implementation
Generalized the IKGLP implementation to support non-optimal configurations. Parameters allow the IKGLP to be configured as FIFO queues (aka KFMLP), a single priority queue, or a hybrid (optimal IKGLP). The maximum number of users within the FIFO queues is also parameterized, allowing more than 'm' replica holders to hold replicas concurrently (this breaks optimality though). Also fixed a bug in locking.c where DGL prority inheritance is determined.
Diffstat (limited to 'include')
-rw-r--r--include/litmus/ikglp_lock.h31
-rw-r--r--include/litmus/kfmlp_lock.h21
-rw-r--r--include/litmus/locking.h3
-rw-r--r--include/litmus/rt_param.h17
4 files changed, 43 insertions, 29 deletions
diff --git a/include/litmus/ikglp_lock.h b/include/litmus/ikglp_lock.h
index f9178d3dfba9..91a905a5d101 100644
--- a/include/litmus/ikglp_lock.h
+++ b/include/litmus/ikglp_lock.h
@@ -58,7 +58,7 @@ struct fifo_queue
58 ikglp_donee_heap_node_t donee_heap_node; 58 ikglp_donee_heap_node_t donee_heap_node;
59 59
60 struct task_struct* hp_waiter; 60 struct task_struct* hp_waiter;
61 int count; /* number of waiters + holder */ 61 unsigned int count; /* number of waiters + holder */
62 62
63 struct nested_info nest; 63 struct nested_info nest;
64}; 64};
@@ -70,14 +70,14 @@ struct ikglp_semaphore
70 raw_spinlock_t lock; 70 raw_spinlock_t lock;
71 raw_spinlock_t real_lock; 71 raw_spinlock_t real_lock;
72 72
73 int nr_replicas; // AKA k 73 unsigned int nr_replicas; // AKA k
74 int m; 74 unsigned int max_fifo_len; // max len of a fifo queue
75 75
76 int max_fifo_len; // max len of a fifo queue 76 unsigned int max_in_fifos; // AKA m
77 int nr_in_fifos; 77 unsigned int nr_in_fifos;
78 78
79 struct binheap top_m; // min heap, base prio 79 struct binheap top_m; // min heap, base prio
80 int top_m_size; // number of nodes in top_m 80 unsigned int top_m_size; // number of nodes in top_m
81 81
82 struct binheap not_top_m; // max heap, base prio 82 struct binheap not_top_m; // max heap, base prio
83 83
@@ -103,7 +103,7 @@ int ikglp_lock(struct litmus_lock* l);
103int ikglp_unlock(struct litmus_lock* l); 103int ikglp_unlock(struct litmus_lock* l);
104int ikglp_close(struct litmus_lock* l); 104int ikglp_close(struct litmus_lock* l);
105void ikglp_free(struct litmus_lock* l); 105void ikglp_free(struct litmus_lock* l);
106struct litmus_lock* ikglp_new(int m, struct litmus_lock_ops*, void* __user arg); 106struct litmus_lock* ikglp_new(unsigned int m, struct litmus_lock_ops*, void* __user arg);
107 107
108 108
109 109
@@ -113,8 +113,8 @@ struct ikglp_queue_info
113{ 113{
114 struct fifo_queue* q; 114 struct fifo_queue* q;
115 lt_t estimated_len; 115 lt_t estimated_len;
116 int *nr_cur_users; 116 unsigned int *nr_cur_users;
117 int64_t *nr_aff_users; 117 unsigned int *nr_aff_users;
118}; 118};
119 119
120struct ikglp_affinity_ops 120struct ikglp_affinity_ops
@@ -138,12 +138,13 @@ struct ikglp_affinity
138 struct affinity_observer obs; 138 struct affinity_observer obs;
139 struct ikglp_affinity_ops *ops; 139 struct ikglp_affinity_ops *ops;
140 struct ikglp_queue_info *q_info; 140 struct ikglp_queue_info *q_info;
141 int *nr_cur_users_on_rsrc; 141 unsigned int *nr_cur_users_on_rsrc;
142 int64_t *nr_aff_on_rsrc; 142 unsigned int *nr_aff_on_rsrc;
143 int offset; 143 unsigned int offset;
144 int nr_simult; 144 unsigned int nr_simult;
145 int nr_rsrc; 145 unsigned int nr_rsrc;
146 int relax_max_fifo_len; 146
147 int relax_max_fifo_len:1;
147}; 148};
148 149
149static inline struct ikglp_affinity* ikglp_aff_obs_from_aff_obs(struct affinity_observer* aff_obs) 150static inline struct ikglp_affinity* ikglp_aff_obs_from_aff_obs(struct affinity_observer* aff_obs)
diff --git a/include/litmus/kfmlp_lock.h b/include/litmus/kfmlp_lock.h
index 3609a3a20424..2af953852e02 100644
--- a/include/litmus/kfmlp_lock.h
+++ b/include/litmus/kfmlp_lock.h
@@ -16,7 +16,7 @@ struct kfmlp_queue
16 wait_queue_head_t wait; 16 wait_queue_head_t wait;
17 struct task_struct* owner; 17 struct task_struct* owner;
18 struct task_struct* hp_waiter; 18 struct task_struct* hp_waiter;
19 int count; /* number of waiters + holder */ 19 unsigned int count; /* number of waiters + holder */
20}; 20};
21 21
22struct kfmlp_semaphore 22struct kfmlp_semaphore
@@ -25,7 +25,7 @@ struct kfmlp_semaphore
25 25
26 spinlock_t lock; 26 spinlock_t lock;
27 27
28 int num_resources; /* aka k */ 28 unsigned int num_resources; /* aka k */
29 29
30 struct kfmlp_queue *queues; /* array */ 30 struct kfmlp_queue *queues; /* array */
31 struct kfmlp_queue *shortest_queue; /* pointer to shortest queue */ 31 struct kfmlp_queue *shortest_queue; /* pointer to shortest queue */
@@ -52,7 +52,7 @@ struct kfmlp_queue_info
52{ 52{
53 struct kfmlp_queue* q; 53 struct kfmlp_queue* q;
54 lt_t estimated_len; 54 lt_t estimated_len;
55 int *nr_cur_users; 55 unsigned int *nr_cur_users;
56}; 56};
57 57
58struct kfmlp_affinity_ops 58struct kfmlp_affinity_ops
@@ -71,10 +71,10 @@ struct kfmlp_affinity
71 struct affinity_observer obs; 71 struct affinity_observer obs;
72 struct kfmlp_affinity_ops *ops; 72 struct kfmlp_affinity_ops *ops;
73 struct kfmlp_queue_info *q_info; 73 struct kfmlp_queue_info *q_info;
74 int *nr_cur_users_on_rsrc; 74 unsigned int *nr_cur_users_on_rsrc;
75 int offset; 75 unsigned int offset;
76 int nr_simult; 76 unsigned int nr_simult;
77 int nr_rsrc; 77 unsigned int nr_rsrc;
78}; 78};
79 79
80static inline struct kfmlp_affinity* kfmlp_aff_obs_from_aff_obs(struct affinity_observer* aff_obs) 80static inline struct kfmlp_affinity* kfmlp_aff_obs_from_aff_obs(struct affinity_observer* aff_obs)
@@ -86,10 +86,9 @@ int kfmlp_aff_obs_close(struct affinity_observer*);
86void kfmlp_aff_obs_free(struct affinity_observer*); 86void kfmlp_aff_obs_free(struct affinity_observer*);
87 87
88#ifdef CONFIG_LITMUS_NVIDIA 88#ifdef CONFIG_LITMUS_NVIDIA
89struct affinity_observer* kfmlp_gpu_aff_obs_new(struct affinity_observer_ops*, 89struct affinity_observer* kfmlp_gpu_aff_obs_new(
90 void* __user arg); 90 struct affinity_observer_ops*, void* __user arg);
91struct affinity_observer* kfmlp_simple_gpu_aff_obs_new(struct affinity_observer_ops*, 91struct affinity_observer* kfmlp_simple_gpu_aff_obs_new(struct affinity_observer_ops*, void* __user arg);
92 void* __user arg);
93#endif 92#endif
94 93
95#endif /* end affinity */ 94#endif /* end affinity */
diff --git a/include/litmus/locking.h b/include/litmus/locking.h
index fc437811d2b6..b9c6a2b1d01e 100644
--- a/include/litmus/locking.h
+++ b/include/litmus/locking.h
@@ -66,8 +66,9 @@ typedef struct dgl_wait_state {
66} dgl_wait_state_t; 66} dgl_wait_state_t;
67 67
68void wake_or_wait_on_next_lock(dgl_wait_state_t *dgl_wait); 68void wake_or_wait_on_next_lock(dgl_wait_state_t *dgl_wait);
69void select_next_lock(dgl_wait_state_t* dgl_wait /*, struct litmus_lock* prev_lock*/); 69struct litmus_lock* select_next_lock(dgl_wait_state_t* dgl_wait /*, struct litmus_lock* prev_lock*/);
70 70
71void init_dgl_wait_state(dgl_wait_state_t* dgl_wait);
71void init_dgl_waitqueue_entry(wait_queue_t *wq_node, dgl_wait_state_t* dgl_wait); 72void init_dgl_waitqueue_entry(wait_queue_t *wq_node, dgl_wait_state_t* dgl_wait);
72int dgl_wake_up(wait_queue_t *wq_node, unsigned mode, int sync, void *key); 73int dgl_wake_up(wait_queue_t *wq_node, unsigned mode, int sync, void *key);
73struct task_struct* __waitqueue_dgl_remove_first(wait_queue_head_t *wq, dgl_wait_state_t** dgl_wait); 74struct task_struct* __waitqueue_dgl_remove_first(wait_queue_head_t *wq, dgl_wait_state_t** dgl_wait);
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 716fc034c5f4..c4cba8551c47 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -119,11 +119,24 @@ struct affinity_observer_args
119struct gpu_affinity_observer_args 119struct gpu_affinity_observer_args
120{ 120{
121 struct affinity_observer_args obs; 121 struct affinity_observer_args obs;
122 int replica_to_gpu_offset; 122 unsigned int replica_to_gpu_offset;
123 int nr_simult_users; 123 unsigned int rho;
124 int relaxed_rules; 124 int relaxed_rules;
125}; 125};
126 126
127
128#define IKGLP_M_IN_FIFOS (0u)
129#define IKGLP_UNLIMITED_IN_FIFOS (~0u)
130#define IKGLP_OPTIMAL_FIFO_LEN (0u)
131#define IKGLP_UNLIMITED_FIFO_LEN (~0u)
132
133struct ikglp_args
134{
135 unsigned int nr_replicas;
136 unsigned int max_in_fifos;
137 unsigned int max_fifo_len;
138};
139
127/* The definition of the data that is shared between the kernel and real-time 140/* The definition of the data that is shared between the kernel and real-time
128 * tasks via a shared page (see litmus/ctrldev.c). 141 * tasks via a shared page (see litmus/ctrldev.c).
129 * 142 *