aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/locking.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/litmus/locking.h')
-rw-r--r--include/litmus/locking.h36
1 files changed, 34 insertions, 2 deletions
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