Attachment 'mc2_liblitmus_2015.1-rtns18.patch'
Download 1 diff --git Makefile Makefile
2 index 4742fd2..839341f 100644
3 --- Makefile
4 +++ Makefile
5 @@ -19,7 +19,7 @@ LITMUS_KERNEL ?= ../litmus-rt
6 # Internal configuration.
7
8 # compiler flags
9 -flags-debug = -O2 -Wall -Werror -g -Wdeclaration-after-statement
10 +flags-debug = -O0 -Wall -g -Wdeclaration-after-statement
11 flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
12
13 # architecture-specific flags
14 @@ -52,7 +52,7 @@ headers += -I${LIBLITMUS}/arch/${include-${ARCH}}/include/generated/uapi
15 # combine options
16 CPPFLAGS = ${flags-api} ${flags-${ARCH}} -DARCH=${ARCH} ${headers}
17 CFLAGS = ${flags-debug}
18 -LDFLAGS = ${flags-${ARCH}}
19 +LDFLAGS = ${flags-${ARCH}}
20
21 # how to link against liblitmus
22 liblitmus-flags = -L${LIBLITMUS} -llitmus
23 @@ -73,7 +73,8 @@ AR := ${CROSS_COMPILE}${AR}
24
25 all = lib ${rt-apps}
26 rt-apps = cycles base_task rt_launch rtspin release_ts measure_syscall \
27 - base_mt_task uncache runtests
28 + base_mt_task uncache runtests synthetic matrix loadGen \
29 + frameCopy yuv2gray
30
31 .PHONY: all lib clean dump-config TAGS tags cscope help doc
32
33 @@ -234,6 +235,20 @@ obj-release_ts = release_ts.o
34 obj-measure_syscall = null_call.o
35 lib-measure_syscall = -lm
36
37 +obj-synthetic = synthetic.o common.o
38 +lib-synthetic = -lrt -static
39 +
40 +obj-frameCopy = frame_poller.o webcam_lib.o common.o
41 +lib-frameCopy = -lrt -static
42 +
43 +obj-yuv2gray = frame_conv.o webcam_lib.o common.o
44 +lib-yuv2gray = -lrt -static
45 +
46 +obj-matrix = matrix.o common.o
47 +lib-matrix = -lrt -static -lm
48 +
49 +obj-loadGen = loadGen.o common.o
50 +lib-loadGen = -lrt -static
51 # ##############################################################################
52 # Build everything that depends on liblitmus.
53
54 diff --git bin/uncache.c bin/uncache.c
55 index 5170155..70419c8 100644
56 --- bin/uncache.c
57 +++ bin/uncache.c
58 @@ -59,7 +59,7 @@ inline int linear_read(pbuf_t addr, int size, char val)
59 }
60
61 /* write to *data nr times. */
62 -inline int hammer_write(pbuf_t data, char val, int nr)
63 +static inline int hammer_write(pbuf_t data, char val, int nr)
64 {
65 int i;
66 for (i = 0; i < nr; ++i)
67 @@ -68,7 +68,7 @@ inline int hammer_write(pbuf_t data, char val, int nr)
68 }
69
70 /* read from *data nr times. */
71 -inline int hammer_read(pbuf_t data, char val, int nr)
72 +static inline int hammer_read(pbuf_t data, char val, int nr)
73 {
74 int i;
75 for (i = 0; i < nr; ++i) {
76 @@ -78,7 +78,7 @@ inline int hammer_read(pbuf_t data, char val, int nr)
77 return 0;
78 }
79
80 -inline int test(pbuf_t data, int size, int trials)
81 +static inline int test(pbuf_t data, int size, int trials)
82 {
83 int HAMMER_TIME = 10000; /* can't cache this! */
84 char VAL = 0x55;
85 @@ -109,7 +109,7 @@ inline int test(pbuf_t data, int size, int trials)
86 return 0;
87 }
88
89 -inline void timespec_normalize(struct timespec* ts, time_t sec, int64_t nsec)
90 +static inline void timespec_normalize(struct timespec* ts, time_t sec, int64_t nsec)
91 {
92 while(nsec > 1000000000LL) {
93 asm("" : "+rm"(nsec));
94 @@ -126,21 +126,21 @@ inline void timespec_normalize(struct timespec* ts, time_t sec, int64_t nsec)
95 ts->tv_nsec = nsec;
96 }
97
98 -inline struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
99 +static inline struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
100 {
101 struct timespec delta;
102 timespec_normalize(&delta, lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec);
103 return delta;
104 }
105
106 -inline struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
107 +static inline struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
108 {
109 struct timespec delta;
110 timespec_normalize(&delta, lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec);
111 return delta;
112 }
113
114 -inline int64_t timespec_to_us(struct timespec ts)
115 +static inline int64_t timespec_to_us(struct timespec ts)
116 {
117 int64_t t;
118 t = ts.tv_sec * 1000000LL;
119 diff --git include/litmus.h include/litmus.h
120 index b9dbdb5..92df26e 100644
121 --- include/litmus.h
122 +++ include/litmus.h
123 @@ -40,12 +40,22 @@ extern "C" {
124
125 #include "migration.h"
126
127 +#include "litmus/mc2_common.h"
128 +
129 /**
130 * @private
131 - * The numeric ID of the LITMUS^RT scheduling class.
132 + * Number of semaphore protocol object types
133 */
134 #define SCHED_LITMUS 7
135
136 +#define CACHELINE_SIZE 32
137 +#define INTS_IN_CACHELINE (CACHELINE_SIZE/sizeof(int))
138 +#define CACHELINES_IN_1KB (1024 / sizeof(cacheline_t))
139 +typedef struct cacheline
140 +{
141 + int line[INTS_IN_CACHELINE];
142 +} __attribute__((aligned(CACHELINE_SIZE))) cacheline_t;
143 +
144 /**
145 * Initialise a real-time task param struct
146 * @param param Pointer to the struct to initialise
147 @@ -146,6 +156,12 @@ int sporadic_clustered(lt_t e_ns, lt_t p_ns, int cluster);
148 /** Convert microseconds to nanoseconds
149 * @param us Time units in microseconds */
150 #define us2ns(us) ((us)*1000LL)
151 +#define ns2s(ns) ((ns)/1000000000LL)
152 +#define ns2ms(ns) ((ns)/1000000LL)
153 +#define ns2us(ns) ((ns)/1000LL)
154 +#define us2ms(us) ((us)/1000LL)
155 +#define us2s(us) ((us)/1000000LL)
156 +#define ms2s(ms) ((ms)/1000LL)
157
158 /**
159 * Locking protocols for allocated shared objects
160 @@ -286,6 +302,12 @@ void exit_np(void);
161 */
162 int requested_to_preempt(void);
163
164 +/* pgm support */
165 +void enter_pgm_wait(void);
166 +void exit_pgm_wait(void);
167 +void enter_pgm_send(void);
168 +void exit_pgm_send(void);
169 +
170 /***** Task System support *****/
171 /**
172 * Wait until task master releases all real-time tasks
173 @@ -416,6 +438,24 @@ int null_call(cycles_t *timestamp);
174 */
175 struct control_page* get_ctrl_page(void);
176
177 +int reservation_create(int rtype, void *config);
178 +
179 +int reservation_destroy(unsigned int reservation_id, int cpu);
180 +
181 +int set_mc2_task_param(pid_t pid, struct mc2_task* param);
182 +
183 +int set_page_color(int cpu);
184 +
185 +int test_call(unsigned int param);
186 +
187 +int run_bench(int type, int size, cacheline_t *src, cacheline_t *dst, lt_t __user *ts);
188 +
189 +int lock_buffer(void* vaddr, size_t size, unsigned int lock_way, unsigned int unlock_way);
190 +
191 +int test_call(unsigned int param);
192 +
193 +int recolor_mem(void* vaddr, int n_pages, int cpu);
194 +
195 #ifdef __cplusplus
196 }
197 #endif
198 diff --git src/syscalls.c src/syscalls.c
199 index c68f15b..62c2ee5 100644
200 --- src/syscalls.c
201 +++ src/syscalls.c
202 @@ -86,3 +86,43 @@ int null_call(cycles_t *timestamp)
203 {
204 return syscall(__NR_null_call, timestamp);
205 }
206 +
207 +int reservation_create(int rtype, void *config)
208 +{
209 + return syscall(__NR_reservation_create, rtype, config);
210 +}
211 +
212 +int reservation_destroy(unsigned int reservation_id, int cpu)
213 +{
214 + return syscall(__NR_reservation_destroy, reservation_id, cpu);
215 +}
216 +
217 +int set_mc2_task_param(pid_t pid, struct mc2_task *param)
218 +{
219 + return syscall(__NR_set_mc2_task_param, pid, param);
220 +}
221 +
222 +int set_page_color(int cpu)
223 +{
224 + return syscall(__NR_set_page_color, cpu);
225 +}
226 +
227 +int run_bench(int type, int wss, cacheline_t *src, cacheline_t *dst, lt_t *ts)
228 +{
229 + return syscall(__NR_run_test, type, wss, src, dst, ts);
230 +}
231 +
232 +int lock_buffer(void* vaddr, size_t size, unsigned int lock_way, unsigned int unlock_way)
233 +{
234 + return syscall(__NR_lock_buffer, vaddr, size, lock_way, unlock_way);
235 +}
236 +
237 +int test_call(unsigned int param)
238 +{
239 + return syscall(__NR_test_call, param);
240 +}
241 +
242 +int recolor_mem(void* vaddr, int num_pages, int cpu)
243 +{
244 + return syscall(__NR_recolor_mem, vaddr, num_pages, cpu);
245 +}
246
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.