diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-18 11:13:07 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-01-18 11:14:15 -0500 |
commit | cc9f46d0ce73ae30e3918999976ef587b0e8a04d (patch) | |
tree | 85c3da741b968ce8ad0f3b75daa86238cd93a054 /include/litmus | |
parent | e6b58b65441925c307f40ce5bd9d5676750f7601 (diff) |
/proc hooks for locking protocols.
RSM locks only make use of /proc for now.
Diffstat (limited to 'include/litmus')
-rw-r--r-- | include/litmus/litmus_proc.h | 7 | ||||
-rw-r--r-- | include/litmus/locking.h | 17 | ||||
-rw-r--r-- | include/litmus/rsm_lock.h | 3 |
3 files changed, 26 insertions, 1 deletions
diff --git a/include/litmus/litmus_proc.h b/include/litmus/litmus_proc.h index 6800e725d48c..0c5c07ea0ef5 100644 --- a/include/litmus/litmus_proc.h +++ b/include/litmus/litmus_proc.h | |||
@@ -23,3 +23,10 @@ void remove_plugin_proc_dir(struct sched_plugin* plugin); | |||
23 | * -EFAULT. */ | 23 | * -EFAULT. */ |
24 | int copy_and_chomp(char *kbuf, unsigned long ksize, | 24 | int copy_and_chomp(char *kbuf, unsigned long ksize, |
25 | __user const char* ubuf, unsigned long ulength); | 25 | __user const char* ubuf, unsigned long ulength); |
26 | |||
27 | |||
28 | #ifdef CONFIG_LITMUS_LOCKING | ||
29 | struct proc_dir_entry* litmus_add_proc_lock(struct litmus_lock *l, read_proc_t func); | ||
30 | void litmus_remove_proc_lock(struct litmus_lock* l); | ||
31 | #endif | ||
32 | |||
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 4a5f198a0407..22f7372bf621 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
@@ -24,6 +24,11 @@ static inline struct task_struct* top_priority(struct binheap* handle) { | |||
24 | void print_hp_waiters(struct binheap_node* n, int depth); | 24 | void print_hp_waiters(struct binheap_node* n, int depth); |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define LOCK_NAME_LEN 16 | ||
28 | struct litmus_lock_proc_ops { | ||
29 | void (*add)(struct litmus_lock *l); | ||
30 | void (*remove)(struct litmus_lock *l); | ||
31 | }; | ||
27 | 32 | ||
28 | /* Generic base struct for LITMUS^RT userspace semaphores. | 33 | /* Generic base struct for LITMUS^RT userspace semaphores. |
29 | * This structure should be embedded in protocol-specific semaphores. | 34 | * This structure should be embedded in protocol-specific semaphores. |
@@ -41,6 +46,10 @@ struct litmus_lock { | |||
41 | struct lock_class_key key; | 46 | struct lock_class_key key; |
42 | //#endif | 47 | //#endif |
43 | #endif | 48 | #endif |
49 | |||
50 | struct litmus_lock_proc_ops *proc; | ||
51 | struct proc_dir_entry *proc_entry; | ||
52 | char name[LOCK_NAME_LEN]; | ||
44 | }; | 53 | }; |
45 | 54 | ||
46 | #ifdef CONFIG_LITMUS_DGL_SUPPORT | 55 | #ifdef CONFIG_LITMUS_DGL_SUPPORT |
@@ -131,12 +140,16 @@ struct litmus_lock_ops { | |||
131 | /* DGL requires a big lock to implement nested inheritance */ | 140 | /* DGL requires a big lock to implement nested inheritance */ |
132 | #define lock_global_irqsave(lock, flags) raw_spin_lock_irqsave((lock), (flags)) | 141 | #define lock_global_irqsave(lock, flags) raw_spin_lock_irqsave((lock), (flags)) |
133 | #define lock_global(lock) raw_spin_lock((lock)) | 142 | #define lock_global(lock) raw_spin_lock((lock)) |
143 | #define trylock_global_irqsave(lock, flags) raw_spin_trylock_irqsave((lock), (flags)) | ||
144 | #define trylock_global(lock) raw_spin_trylock((lock)) | ||
134 | #define unlock_global_irqrestore(lock, flags) raw_spin_unlock_irqrestore((lock), (flags)) | 145 | #define unlock_global_irqrestore(lock, flags) raw_spin_unlock_irqrestore((lock), (flags)) |
135 | #define unlock_global(lock) raw_spin_unlock((lock)) | 146 | #define unlock_global(lock) raw_spin_unlock((lock)) |
136 | 147 | ||
137 | /* fine-grain locking are no-ops with DGL support */ | 148 | /* fine-grain locking are no-ops with DGL support */ |
138 | #define lock_fine_irqsave(lock, flags) | 149 | #define lock_fine_irqsave(lock, flags) |
139 | #define lock_fine(lock) | 150 | #define lock_fine(lock) |
151 | #define trylock_fine_irqsave(lock, flags) | ||
152 | #define trylock_fine(lock) | ||
140 | #define unlock_fine_irqrestore(lock, flags) | 153 | #define unlock_fine_irqrestore(lock, flags) |
141 | #define unlock_fine(lock) | 154 | #define unlock_fine(lock) |
142 | 155 | ||
@@ -145,11 +158,15 @@ struct litmus_lock_ops { | |||
145 | /* global locking are no-ops without DGL support */ | 158 | /* global locking are no-ops without DGL support */ |
146 | #define lock_global_irqsave(lock, flags) | 159 | #define lock_global_irqsave(lock, flags) |
147 | #define lock_global(lock) | 160 | #define lock_global(lock) |
161 | #define trylock_global_irqsave(lock, flags) | ||
162 | #define trylock_global(lock) | ||
148 | #define unlock_global_irqrestore(lock, flags) | 163 | #define unlock_global_irqrestore(lock, flags) |
149 | #define unlock_global(lock) | 164 | #define unlock_global(lock) |
150 | 165 | ||
151 | #define lock_fine_irqsave(lock, flags) raw_spin_lock_irqsave((lock), (flags)) | 166 | #define lock_fine_irqsave(lock, flags) raw_spin_lock_irqsave((lock), (flags)) |
152 | #define lock_fine(lock) raw_spin_lock((lock)) | 167 | #define lock_fine(lock) raw_spin_lock((lock)) |
168 | #define trylock_fine_irqsave(lock, flags) raw_spin_trylock_irqsave((lock), (flags)) | ||
169 | #define trylock_fine(lock) raw_spin_trylock((lock)) | ||
153 | #define unlock_fine_irqrestore(lock, flags) raw_spin_unlock_irqrestore((lock), (flags)) | 170 | #define unlock_fine_irqrestore(lock, flags) raw_spin_unlock_irqrestore((lock), (flags)) |
154 | #define unlock_fine(lock) raw_spin_unlock((lock)) | 171 | #define unlock_fine(lock) raw_spin_unlock((lock)) |
155 | 172 | ||
diff --git a/include/litmus/rsm_lock.h b/include/litmus/rsm_lock.h index a15189683de4..f0d263322a69 100644 --- a/include/litmus/rsm_lock.h +++ b/include/litmus/rsm_lock.h | |||
@@ -51,4 +51,5 @@ void rsm_mutex_free(struct litmus_lock* l); | |||
51 | struct litmus_lock* rsm_mutex_new(struct litmus_lock_ops*); | 51 | struct litmus_lock* rsm_mutex_new(struct litmus_lock_ops*); |
52 | 52 | ||
53 | 53 | ||
54 | #endif \ No newline at end of file | 54 | #endif |
55 | |||