Attachment 'gpusync_liblitmus-rtss12.patch'
Download 1 From ab4d9b18499d87cc63d2dd06999b364e5c809eb9 Mon Sep 17 00:00:00 2001
2 From: Glenn Elliott <gelliott@cs.unc.edu>
3 Date: Mon, 16 Apr 2012 14:26:53 -0400
4 Subject: [PATCH 1/2] add rsm and ikglp support
5
6 ---
7 Makefile | 16 ++++++++++++++--
8 include/litmus.h | 21 +++++++++++++++++++++
9 src/syscalls.c | 10 ++++++++++
10 3 files changed, 45 insertions(+), 2 deletions(-)
11
12 diff --git a/Makefile b/Makefile
13 index 2109a45..df9205f 100644
14 --- a/Makefile
15 +++ b/Makefile
16 @@ -71,7 +71,7 @@ AR := ${CROSS_COMPILE}${AR}
17
18 all = lib ${rt-apps}
19 rt-apps = cycles base_task rt_launch rtspin release_ts measure_syscall \
20 - base_mt_task runtests
21 + base_mt_task runtests nested locktest ikglptest dgl
22
23 .PHONY: all lib clean dump-config TAGS tags cscope help
24
25 @@ -153,7 +153,7 @@ arch/${include-${ARCH}}/include/asm/%.h: \
26 @mkdir -p ${dir $@}
27 cp $< $@
28
29 -litmus-headers = include/litmus/rt_param.h include/litmus/unistd_32.h \
30 +litmus-headers = include/litmus/rt_param.h include/litmus/binheap.h include/litmus/unistd_32.h \
31 include/litmus/unistd_64.h
32
33 unistd-headers = \
34 @@ -211,6 +211,18 @@ obj-rt_launch = rt_launch.o common.o
35 obj-rtspin = rtspin.o common.o
36 lib-rtspin = -lrt
37
38 +obj-nested = nested.o common.o
39 +lib-nested = -lrt
40 +
41 +obj-locktest = locktest.o common.o
42 +lib-locktest = -lrt
43 +
44 +obj-ikglptest = ikglptest.o common.o
45 +lib-ikglptest = -lrt
46 +
47 +obj-dgl = dgl.o common.o
48 +lib-dgl = -lrt
49 +
50 obj-release_ts = release_ts.o
51
52 obj-measure_syscall = null_call.o
53 diff --git a/include/litmus.h b/include/litmus.h
54 index 4c85d28..955f239 100644
55 --- a/include/litmus.h
56 +++ b/include/litmus.h
57 @@ -51,6 +51,8 @@ int sporadic_task_ns(
58 typedef enum {
59 FMLP_SEM = 0,
60 SRP_SEM = 1,
61 + RSM_SEM = 2,
62 + IKGLP_SEM = 3,
63 } obj_type_t;
64
65 int od_openx(int fd, obj_type_t type, int obj_id, void* config);
66 @@ -65,6 +67,16 @@ static inline int od_open(int fd, obj_type_t type, int obj_id)
67 int litmus_lock(int od);
68 int litmus_unlock(int od);
69
70 +/* Dynamic group lock support. ods arrays MUST BE PARTIALLY ORDERED!!!!!!
71 + * Use the same ordering for lock and unlock.
72 + *
73 + * Ex:
74 + * litmus_dgl_lock({A, B, C, D}, 4);
75 + * litmus_dgl_unlock({A, B, C, D}, 4);
76 + */
77 +int litmus_dgl_lock(int* ods, int dgl_size);
78 +int litmus_dgl_unlock(int* ods, int dgl_size);
79 +
80 /* job control*/
81 int get_job_no(unsigned int* job_no);
82 int wait_for_job_release(unsigned int job_no);
83 @@ -127,6 +139,15 @@ static inline int open_srp_sem(int fd, int name)
84 return od_open(fd, SRP_SEM, name);
85 }
86
87 +static inline int open_rsm_sem(int fd, int name)
88 +{
89 + return od_open(fd, RSM_SEM, name);
90 +}
91 +
92 +static inline int open_ikglp_sem(int fd, int name, void *arg)
93 +{
94 + return od_openx(fd, IKGLP_SEM, name, arg);
95 +}
96
97 /* syscall overhead measuring */
98 int null_call(cycles_t *timestamp);
99 diff --git a/src/syscalls.c b/src/syscalls.c
100 index c68f15b..e0ce941 100644
101 --- a/src/syscalls.c
102 +++ b/src/syscalls.c
103 @@ -52,6 +52,16 @@ int litmus_unlock(int od)
104 return syscall(__NR_litmus_unlock, od);
105 }
106
107 +int litmus_dgl_lock(int *ods, int dgl_size)
108 +{
109 + return syscall(__NR_litmus_dgl_lock, ods, dgl_size);
110 +}
111 +
112 +int litmus_dgl_unlock(int *ods, int dgl_size)
113 +{
114 + return syscall(__NR_litmus_dgl_unlock, ods, dgl_size);
115 +}
116 +
117 int get_job_no(unsigned int *job_no)
118 {
119 return syscall(__NR_query_job_no, job_no);
120 --
121 1.7.9.5
122
123
124 From a298df4f5c08023b8447e53aba14e062e551e10c Mon Sep 17 00:00:00 2001
125 From: Glenn Elliott <gelliott@cs.unc.edu>
126 Date: Sat, 26 May 2012 17:19:39 -0400
127 Subject: [PATCH 2/2] GPUSync RTSS12 liblitmus
128
129 ---
130 include/litmus.h | 48 +++++++++++++++++++++++++++++++++---
131 src/litmus.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
132 src/syscalls.c | 10 ++++++++
133 3 files changed, 125 insertions(+), 4 deletions(-)
134
135 diff --git a/include/litmus.h b/include/litmus.h
136 index 955f239..2e26868 100644
137 --- a/include/litmus.h
138 +++ b/include/litmus.h
139 @@ -51,8 +51,15 @@ int sporadic_task_ns(
140 typedef enum {
141 FMLP_SEM = 0,
142 SRP_SEM = 1,
143 - RSM_SEM = 2,
144 - IKGLP_SEM = 3,
145 +
146 + RSM_MUTEX = 2,
147 + IKGLP_SEM = 3,
148 + KFMLP_SEM = 4,
149 +
150 + IKGLP_SIMPLE_GPU_AFF_OBS = 5,
151 + IKGLP_GPU_AFF_OBS = 6,
152 + KFMLP_SIMPLE_GPU_AFF_OBS = 7,
153 + KFMLP_GPU_AFF_OBS = 8,
154 } obj_type_t;
155
156 int od_openx(int fd, obj_type_t type, int obj_id, void* config);
157 @@ -76,7 +83,11 @@ int litmus_unlock(int od);
158 */
159 int litmus_dgl_lock(int* ods, int dgl_size);
160 int litmus_dgl_unlock(int* ods, int dgl_size);
161 -
162 +
163 +/* nvidia graphics cards */
164 +int register_nv_device(int nv_device_id);
165 +int unregister_nv_device(int nv_device_id);
166 +
167 /* job control*/
168 int get_job_no(unsigned int* job_no);
169 int wait_for_job_release(unsigned int job_no);
170 @@ -134,6 +145,11 @@ static inline int open_fmlp_sem(int fd, int name)
171 return od_open(fd, FMLP_SEM, name);
172 }
173
174 +static inline int open_kfmlp_sem(int fd, int name, void* arg)
175 +{
176 + return od_openx(fd, KFMLP_SEM, name, arg);
177 +}
178 +
179 static inline int open_srp_sem(int fd, int name)
180 {
181 return od_open(fd, SRP_SEM, name);
182 @@ -141,14 +157,38 @@ static inline int open_srp_sem(int fd, int name)
183
184 static inline int open_rsm_sem(int fd, int name)
185 {
186 - return od_open(fd, RSM_SEM, name);
187 + return od_open(fd, RSM_MUTEX, name);
188 }
189
190 static inline int open_ikglp_sem(int fd, int name, void *arg)
191 {
192 return od_openx(fd, IKGLP_SEM, name, arg);
193 }
194 +
195 +static inline int open_kfmlp_simple_gpu_aff_obs(int fd, int name, struct gpu_affinity_observer_args *arg)
196 +{
197 + return od_openx(fd, KFMLP_SIMPLE_GPU_AFF_OBS, name, arg);
198 +}
199 +
200 +static inline int open_kfmlp_gpu_aff_obs(int fd, int name, struct gpu_affinity_observer_args *arg)
201 +{
202 + return od_openx(fd, KFMLP_GPU_AFF_OBS, name, arg);
203 +}
204 +
205 +static inline int open_ikglp_simple_gpu_aff_obs(int fd, int name, void *arg)
206 +{
207 + return od_openx(fd, IKGLP_SIMPLE_GPU_AFF_OBS, name, arg);
208 +}
209 +
210 +static inline int open_ikglp_gpu_aff_obs(int fd, int name, void *arg)
211 +{
212 + return od_openx(fd, IKGLP_GPU_AFF_OBS, name, arg);
213 +}
214
215 +// takes names "name" and "name+1"
216 +int open_kfmlp_gpu_sem(int fd, int name, int num_gpus, int gpu_offset, int num_simult_users, int affinity_aware);
217 +int open_ikglp_gpu_sem(int fd, int name, int num_gpus, int gpu_offset, int num_simult_users, int affinity_aware, int relax_max_fifo_len);
218 +
219 /* syscall overhead measuring */
220 int null_call(cycles_t *timestamp);
221
222 diff --git a/src/litmus.c b/src/litmus.c
223 index d3cc6bb..4f404e2 100644
224 --- a/src/litmus.c
225 +++ b/src/litmus.c
226 @@ -100,3 +100,74 @@ void exit_litmus(void)
227 {
228 /* nothing to do in current version */
229 }
230 +
231 +int open_kfmlp_gpu_sem(int fd, int name, int num_gpus, int gpu_offset, int num_simult_users, int affinity_aware)
232 +{
233 + int lock_od;
234 + int affinity_od;
235 + int num_replicas;
236 + struct gpu_affinity_observer_args aff_args;
237 + int aff_type;
238 +
239 + // number of GPU tokens
240 + num_replicas = num_gpus * num_simult_users;
241 +
242 + // create the GPU token lock
243 + lock_od = open_kfmlp_sem(fd, name, (void*)&num_replicas);
244 + if(lock_od < 0) {
245 + perror("open_kfmlp_sem");
246 + return -1;
247 + }
248 +
249 + // create the affinity method to use.
250 + // "no affinity" -> KFMLP_SIMPLE_GPU_AFF_OBS
251 + aff_args.obs.lock_od = lock_od;
252 + aff_args.replica_to_gpu_offset = gpu_offset;
253 + aff_args.nr_simult_users = num_simult_users;
254 +
255 + aff_type = (affinity_aware) ? KFMLP_GPU_AFF_OBS : KFMLP_SIMPLE_GPU_AFF_OBS;
256 + affinity_od = od_openx(fd, aff_type, name+1, &aff_args);
257 + if(affinity_od < 0) {
258 + perror("open_kfmlp_aff");
259 + return -1;
260 + }
261 +
262 + return lock_od;
263 +}
264 +
265 +
266 +
267 +int open_ikglp_gpu_sem(int fd, int name, int num_gpus, int gpu_offset, int num_simult_users, int affinity_aware, int relax_max_fifo_len)
268 +{
269 + int lock_od;
270 + int affinity_od;
271 + int num_replicas;
272 + struct gpu_affinity_observer_args aff_args;
273 + int aff_type;
274 +
275 + // number of GPU tokens
276 + num_replicas = num_gpus * num_simult_users;
277 +
278 + // create the GPU token lock
279 + lock_od = open_ikglp_sem(fd, name, (void*)&num_replicas);
280 + if(lock_od < 0) {
281 + perror("open_ikglp_sem");
282 + return -1;
283 + }
284 +
285 + // create the affinity method to use.
286 + // "no affinity" -> KFMLP_SIMPLE_GPU_AFF_OBS
287 + aff_args.obs.lock_od = lock_od;
288 + aff_args.replica_to_gpu_offset = gpu_offset;
289 + aff_args.nr_simult_users = num_simult_users;
290 + aff_args.relaxed_rules = (relax_max_fifo_len) ? 1 : 0;
291 +
292 + aff_type = (affinity_aware) ? IKGLP_GPU_AFF_OBS : IKGLP_SIMPLE_GPU_AFF_OBS;
293 + affinity_od = od_openx(fd, aff_type, name+1, &aff_args);
294 + if(affinity_od < 0) {
295 + perror("open_ikglp_aff");
296 + return -1;
297 + }
298 +
299 + return lock_od;
300 +}
301 diff --git a/src/syscalls.c b/src/syscalls.c
302 index e0ce941..97d1ebd 100644
303 --- a/src/syscalls.c
304 +++ b/src/syscalls.c
305 @@ -96,3 +96,13 @@ int null_call(cycles_t *timestamp)
306 {
307 return syscall(__NR_null_call, timestamp);
308 }
309 +
310 +int register_nv_device(int nv_device_id)
311 +{
312 + return syscall(__NR_register_nv_device, nv_device_id, 1);
313 +}
314 +
315 +int unregister_nv_device(int nv_device_id)
316 +{
317 + return syscall(__NR_register_nv_device, nv_device_id, 0);
318 +}
319 --
320 1.7.9.5
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.