aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/litmus/fdso.h6
-rw-r--r--include/litmus/locking.h36
-rw-r--r--include/litmus/prioq_lock.h61
-rw-r--r--include/litmus/rt_param.h9
4 files changed, 104 insertions, 8 deletions
diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h
index e1a0ac24b8a2..f7887288d8f5 100644
--- a/include/litmus/fdso.h
+++ b/include/litmus/fdso.h
@@ -35,7 +35,9 @@ typedef enum {
35 KFMLP_SIMPLE_GPU_AFF_OBS = 11, 35 KFMLP_SIMPLE_GPU_AFF_OBS = 11,
36 KFMLP_GPU_AFF_OBS = 12, 36 KFMLP_GPU_AFF_OBS = 12,
37 37
38 MAX_OBJ_TYPE = 12 38 PRIOQ_MUTEX = 13,
39
40 MAX_OBJ_TYPE = 13
39} obj_type_t; 41} obj_type_t;
40 42
41struct inode_obj_id { 43struct inode_obj_id {
@@ -84,6 +86,6 @@ static inline void* od_lookup(int od, obj_type_t type)
84#define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID)) 86#define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID))
85 87
86#define lookup_fifo_mutex(od)((struct litmus_lock*) od_lookup(od, FIFO_MUTEX)) 88#define lookup_fifo_mutex(od)((struct litmus_lock*) od_lookup(od, FIFO_MUTEX))
87 89#define lookup_prioq_mutex(od)((struct litmus_lock*) od_lookup(od, PRIOQ_MUTEX))
88 90
89#endif 91#endif
diff --git a/include/litmus/locking.h b/include/litmus/locking.h
index cc62fa0cb044..660bfc7f8174 100644
--- a/include/litmus/locking.h
+++ b/include/litmus/locking.h
@@ -11,6 +11,7 @@ struct nested_info
11 struct litmus_lock *lock; 11 struct litmus_lock *lock;
12 struct task_struct *hp_waiter_eff_prio; 12 struct task_struct *hp_waiter_eff_prio;
13 struct task_struct **hp_waiter_ptr; 13 struct task_struct **hp_waiter_ptr;
14 struct task_struct **owner_ptr;
14 struct binheap_node hp_binheap_node; 15 struct binheap_node hp_binheap_node;
15}; 16};
16 17
@@ -30,6 +31,8 @@ struct litmus_lock_proc_ops {
30 void (*remove)(struct litmus_lock *l); 31 void (*remove)(struct litmus_lock *l);
31}; 32};
32 33
34
35
33/* Generic base struct for LITMUS^RT userspace semaphores. 36/* Generic base struct for LITMUS^RT userspace semaphores.
34 * This structure should be embedded in protocol-specific semaphores. 37 * This structure should be embedded in protocol-specific semaphores.
35 */ 38 */
@@ -41,10 +44,8 @@ struct litmus_lock {
41 44
42#ifdef CONFIG_LITMUS_NESTED_LOCKING 45#ifdef CONFIG_LITMUS_NESTED_LOCKING
43 struct nested_info nest; 46 struct nested_info nest;
44//#ifdef CONFIG_DEBUG_SPINLOCK
45 char cheat_lockdep[2]; 47 char cheat_lockdep[2];
46 struct lock_class_key key; 48 struct lock_class_key key;
47//#endif
48#endif 49#endif
49 50
50 struct litmus_lock_proc_ops *proc; 51 struct litmus_lock_proc_ops *proc;
@@ -71,7 +72,32 @@ void select_next_lock(dgl_wait_state_t* dgl_wait /*, struct litmus_lock* prev_lo
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);
73void __waitqueue_dgl_remove_first(wait_queue_head_t *wq, dgl_wait_state_t** dgl_wait, struct task_struct **task); 74void __waitqueue_dgl_remove_first(wait_queue_head_t *wq, dgl_wait_state_t** dgl_wait, struct task_struct **task);
75
76
77int __attempt_atomic_dgl_acquire(struct litmus_lock *cur_lock, dgl_wait_state_t *dgl_wait);
78#endif
79
80
81
82
83static inline struct task_struct* get_queued_task(wait_queue_t* q)
84{
85 struct task_struct *queued;
86#ifdef CONFIG_LITMUS_DGL_SUPPORT
87 if(q->func == dgl_wake_up) {
88 dgl_wait_state_t *dgl_wait = (dgl_wait_state_t*) q->private;
89 queued = dgl_wait->task;
90 }
91 else {
92 queued = (struct task_struct*) q->private;
93 }
94#else
95 queued = (struct task_struct*) q->private;
74#endif 96#endif
97 return queued;
98}
99
100
75 101
76typedef int (*lock_op_t)(struct litmus_lock *l); 102typedef int (*lock_op_t)(struct litmus_lock *l);
77typedef lock_op_t lock_close_t; 103typedef lock_op_t lock_close_t;
@@ -94,16 +120,22 @@ struct litmus_lock_ops {
94 /* The lock is no longer being referenced (mandatory method). */ 120 /* The lock is no longer being referenced (mandatory method). */
95 lock_free_t deallocate; 121 lock_free_t deallocate;
96 122
123
97#ifdef CONFIG_LITMUS_NESTED_LOCKING 124#ifdef CONFIG_LITMUS_NESTED_LOCKING
98 void (*propagate_increase_inheritance)(struct litmus_lock* l, struct task_struct* t, raw_spinlock_t* to_unlock, unsigned long irqflags); 125 void (*propagate_increase_inheritance)(struct litmus_lock* l, struct task_struct* t, raw_spinlock_t* to_unlock, unsigned long irqflags);
99 void (*propagate_decrease_inheritance)(struct litmus_lock* l, struct task_struct* t, raw_spinlock_t* to_unlock, unsigned long irqflags); 126 void (*propagate_decrease_inheritance)(struct litmus_lock* l, struct task_struct* t, raw_spinlock_t* to_unlock, unsigned long irqflags);
100#endif 127#endif
101 128
129
102#ifdef CONFIG_LITMUS_DGL_SUPPORT 130#ifdef CONFIG_LITMUS_DGL_SUPPORT
103 raw_spinlock_t* (*get_dgl_spin_lock)(struct litmus_lock *l); 131 raw_spinlock_t* (*get_dgl_spin_lock)(struct litmus_lock *l);
104 int (*dgl_lock)(struct litmus_lock *l, dgl_wait_state_t* dgl_wait, wait_queue_t* wq_node); 132 int (*dgl_lock)(struct litmus_lock *l, dgl_wait_state_t* dgl_wait, wait_queue_t* wq_node);
105 int (*is_owner)(struct litmus_lock *l, struct task_struct *t); 133 int (*is_owner)(struct litmus_lock *l, struct task_struct *t);
106 void (*enable_priority)(struct litmus_lock *l, dgl_wait_state_t* dgl_wait); 134 void (*enable_priority)(struct litmus_lock *l, dgl_wait_state_t* dgl_wait);
135
136 int (*dgl_can_quick_lock)(struct litmus_lock *l, struct task_struct *t);
137 void (*dgl_quick_lock)(struct litmus_lock *l, struct litmus_lock *cur_lock,
138 struct task_struct* t, wait_queue_t *q);
107#endif 139#endif
108}; 140};
109 141
diff --git a/include/litmus/prioq_lock.h b/include/litmus/prioq_lock.h
new file mode 100644
index 000000000000..f3c11d241991
--- /dev/null
+++ b/include/litmus/prioq_lock.h
@@ -0,0 +1,61 @@
1#ifndef LITMUS_PRIOQ_H
2#define LITMUS_PRIOQ_H
3
4#include <litmus/litmus.h>
5#include <litmus/binheap.h>
6#include <litmus/locking.h>
7
8/* struct for semaphore with priority inheritance */
9struct prioq_mutex {
10 struct litmus_lock litmus_lock;
11
12 /* current resource holder */
13 struct task_struct *owner;
14
15 /* highest-priority waiter */
16 struct task_struct *hp_waiter;
17
18 /* priority-ordered queue of waiting tasks.
19 * Ironically, we don't use a binheap because that would make DGL
20 * implementation a LOT harder. */
21 wait_queue_head_t wait;
22
23 /* we do some nesting within spinlocks, so we can't use the normal
24 sleeplocks found in wait_queue_head_t. */
25 raw_spinlock_t lock;
26};
27
28static inline struct prioq_mutex* prioq_mutex_from_lock(struct litmus_lock* lock)
29{
30 return container_of(lock, struct prioq_mutex, litmus_lock);
31}
32
33#ifdef CONFIG_LITMUS_DGL_SUPPORT
34int prioq_mutex_is_owner(struct litmus_lock *l, struct task_struct *t);
35int prioq_mutex_dgl_lock(struct litmus_lock *l, dgl_wait_state_t* dgl_wait, wait_queue_t* wq_node);
36void prioq_mutex_enable_priority(struct litmus_lock *l, dgl_wait_state_t* dgl_wait);
37void prioq_mutex_dgl_quick_lock(struct litmus_lock *l, struct litmus_lock *cur_lock,
38 struct task_struct* t, wait_queue_t *q);
39int prioq_mutex_dgl_can_quick_lock(struct litmus_lock *l, struct task_struct *t);
40#endif
41
42void prioq_mutex_propagate_increase_inheritance(struct litmus_lock* l,
43 struct task_struct* t,
44 raw_spinlock_t* to_unlock,
45 unsigned long irqflags);
46
47void prioq_mutex_propagate_decrease_inheritance(struct litmus_lock* l,
48 struct task_struct* t,
49 raw_spinlock_t* to_unlock,
50 unsigned long irqflags);
51
52
53int prioq_mutex_lock(struct litmus_lock* l);
54int prioq_mutex_unlock(struct litmus_lock* l);
55int prioq_mutex_close(struct litmus_lock* l);
56void prioq_mutex_free(struct litmus_lock* l);
57struct litmus_lock* prioq_mutex_new(struct litmus_lock_ops*);
58
59
60#endif
61
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 144be3b6ee3d..716fc034c5f4 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -312,10 +312,6 @@ struct rt_param {
312 312
313 gpu_migration_dist_t gpu_migration; 313 gpu_migration_dist_t gpu_migration;
314 int last_gpu; 314 int last_gpu;
315
316 notify_rsrc_exit_t rsrc_exit_cb;
317 void* rsrc_exit_cb_args;
318
319 lt_t accum_gpu_time; 315 lt_t accum_gpu_time;
320 lt_t gpu_time_stamp; 316 lt_t gpu_time_stamp;
321 317
@@ -323,6 +319,11 @@ struct rt_param {
323#endif 319#endif
324#endif 320#endif
325 321
322#ifdef CONFIG_LITMUS_AFFINITY_LOCKING
323 notify_rsrc_exit_t rsrc_exit_cb;
324 void* rsrc_exit_cb_args;
325#endif
326
326#ifdef CONFIG_LITMUS_LOCKING 327#ifdef CONFIG_LITMUS_LOCKING
327 /* Is the task being priority-boosted by a locking protocol? */ 328 /* Is the task being priority-boosted by a locking protocol? */
328 unsigned int priority_boosted:1; 329 unsigned int priority_boosted:1;