aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2017-05-01 16:02:05 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2017-05-01 16:02:05 -0400
commit11765fcf37057053065abd3715cf9cb46f2fa4db (patch)
tree8403d716bbcbd96493c481a82e7e02b5da9231e8
parentbfee87a910560e022b04c81a026b1f88522cd62f (diff)
RTSS17 submitwip-modechange
-rw-r--r--Makefile49
-rw-r--r--bin/mc2bench.c503
-rw-r--r--bin/mc2mem.c (renamed from bin/mc2shm.c)278
-rw-r--r--bin/mc2spin.c83
-rw-r--r--bin/mode_request.c48
-rw-r--r--bin/mode_skeleton.c (renamed from bin/rt_transitive.c)618
-rw-r--r--bin/rt_field.c379
-rw-r--r--bin/rt_field_spin.c385
-rw-r--r--bin/rt_matrix.c851
-rw-r--r--bin/rt_matrix_spin.c833
-rw-r--r--bin/rt_mode_poll.c102
-rw-r--r--bin/rt_neighborhood.c381
-rw-r--r--bin/rt_neighborhood_spin.c337
-rw-r--r--bin/rt_pointer.c430
-rw-r--r--bin/rt_pointer_spin.c439
-rw-r--r--bin/rt_update.c387
-rw-r--r--bin/rt_update_spin.c398
-rw-r--r--bin/test1.c453
-rw-r--r--src/kernel_iface.c6
19 files changed, 441 insertions, 6519 deletions
diff --git a/Makefile b/Makefile
index c2a1105..3e6ee15 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ LITMUS_KERNEL ?= ../litmus-rt
20 20
21# compiler flags 21# compiler flags
22flags-debug = -O0 -Wall -g -Wdeclaration-after-statement 22flags-debug = -O0 -Wall -g -Wdeclaration-after-statement
23flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DCONFIG_PGMRT_SUPPORT 23flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
24 24
25# architecture-specific flags 25# architecture-specific flags
26flags-i386 = -m32 26flags-i386 = -m32
@@ -73,13 +73,14 @@ AR := ${CROSS_COMPILE}${AR}
73 73
74all = lib ${rt-apps} 74all = lib ${rt-apps}
75rt-apps = cycles base_task rt_launch rtspin release_ts measure_syscall \ 75rt-apps = cycles base_task rt_launch rtspin release_ts measure_syscall \
76 base_mt_task uncache runtests resctrl mc2spin test1 \ 76 base_mt_task uncache runtests resctrl mc2mem \
77 mc2thrash mc2shm mc2thrash1 mc2thrash2 mc2thrash3 mc2bench\ 77 mc2spin mtdag mode_request rt_mode_poll
78 mtdag 78
79#mc2thrash mc2thrash1 mc2thrash2 mc2thrash3
79 80
80.PHONY: all lib clean dump-config TAGS tags cscope help doc 81.PHONY: all lib clean dump-config TAGS tags cscope help doc
81 82
82all: ${all} inc/config.makefile 83all: ${all} inc/config.makefile post-build
83 84
84# Write a distilled version of the flags for clients of the library. Ideally, 85# Write a distilled version of the flags for clients of the library. Ideally,
85# this should depend on liblitmus.a, but that requires LIBLITMUS to be a 86# this should depend on liblitmus.a, but that requires LIBLITMUS to be a
@@ -128,6 +129,7 @@ clean:
128 rm -f inc/config.makefile 129 rm -f inc/config.makefile
129 rm -f tags TAGS cscope.files cscope.out 130 rm -f tags TAGS cscope.files cscope.out
130 rm -r -f docs 131 rm -r -f docs
132 rm -f mc2mem*
131 133
132# Emacs Tags 134# Emacs Tags
133TAGS: 135TAGS:
@@ -145,6 +147,8 @@ cscope:
145 @find . -type f -and -iname '*.[ch]' | xargs printf "%s\n" > cscope.files 147 @find . -type f -and -iname '*.[ch]' | xargs printf "%s\n" > cscope.files
146 @cscope -b 148 @cscope -b
147 149
150post-build:
151
148# ############################################################################## 152# ##############################################################################
149# Kernel headers. 153# Kernel headers.
150# The kernel does not like being #included directly, so let's 154# The kernel does not like being #included directly, so let's
@@ -242,38 +246,17 @@ obj-resctrl = resctrl.o
242obj-mc2spin = mc2spin.o common.o 246obj-mc2spin = mc2spin.o common.o
243lib-mc2spin = -lrt -static 247lib-mc2spin = -lrt -static
244 248
245obj-mc2pollute = mc2pollute.o common.o 249obj-mc2mem = mc2mem.o common.o
246lib-mc2pollute = -lrt -static 250lib-mc2mem = -lrt -static
247
248obj-mc2syn = mc2syn.o common.o
249lib-mc2syn = -lrt -static
250
251obj-memthrash = memthrash.o
252lib-memthrash = -lrt
253
254obj-test1 = test1.o common.o
255lib-test1 = -lrt -static
256
257obj-mc2thrash = mc2thrash.o common.o
258lib-mc2thrash = -lrt -static
259
260obj-mc2thrash1 = mc2thrash.o common.o
261lib-mc2thrash1 = -lrt -static
262
263obj-mc2thrash2 = mc2thrash.o common.o
264lib-mc2thrash2 = -lrt -static
265
266obj-mc2thrash3 = mc2thrash.o common.o
267lib-mc2thrash3 = -lrt -static
268
269obj-mc2shm = mc2shm.o common.o
270lib-mc2shm = -lrt -static
271 251
272obj-mtdag = mtdag.o common.o 252obj-mtdag = mtdag.o common.o
273ldf-mtdag = -lrt -pthread -static 253ldf-mtdag = -lrt -pthread -static
274 254
275obj-mc2bench = mc2bench.o common.o 255obj-mode_request = mode_request.o common.o
276lib-mc2bench = -lrt -static 256lib-mode_request = -lrt -static
257
258obj-rt_mode_poll = rt_mode_poll.o common.o
259lib-rt_mode_poll = -lrt -static
277# ############################################################################## 260# ##############################################################################
278# Build everything that depends on liblitmus. 261# Build everything that depends on liblitmus.
279 262
diff --git a/bin/mc2bench.c b/bin/mc2bench.c
deleted file mode 100644
index dfb4f15..0000000
--- a/bin/mc2bench.c
+++ /dev/null
@@ -1,503 +0,0 @@
1#include <sys/time.h>
2#include <sys/mman.h>
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <unistd.h>
7#include <time.h>
8#include <string.h>
9#include <assert.h>
10#include <limits.h>
11#include <fcntl.h>
12
13#include "litmus.h"
14#include "common.h"
15#include "color_shm.h"
16
17#define PAGE_SIZE (4096)
18//#define CACHELINE_SIZE 32
19//#define INTS_IN_CACHELINE (CACHELINE_SIZE/sizeof(int))
20//#define CACHELINES_IN_1KB (1024 / sizeof(cacheline_t))
21#define INTS_IN_1KB (1024 / sizeof(int))
22
23//typedef struct cacheline
24//{
25// int line[INTS_IN_CACHELINE];
26//} __attribute__((aligned(CACHELINE_SIZE))) cacheline_t;
27
28static int loops = 100000;
29static cacheline_t* arena = NULL;
30static cacheline_t* local_buf = NULL;
31
32struct timeval t1,t2;
33
34lt_t exectime[100000];
35
36inline unsigned long get_cyclecount (void)
37{
38 unsigned long value;
39 // Read CCNT Register
40 asm volatile ("MRC p15, 0, %0, c9, c13, 0\t\n": "=r"(value));
41 return value;
42}
43
44#define UNCACHE_DEV "/dev/litmus/uncache"
45
46static cacheline_t* alloc_shm(int cs, size_t size, int use_huge_pages, int use_uncache_pages)
47{
48 struct color_ioctl_cmd shm_info;
49 struct color_ioctl_offset shm_offset;
50 cacheline_t* arena = NULL;
51
52
53 shm_info.color = 0x0000ffff;
54
55 if (cs == 1 || cs == 2)
56 shm_info.bank = 0x00000020; // hi crit. bank
57 else if (cs == 3)
58 shm_info.bank = 0x00000040; // levelC
59
60 shm_offset.offset = 0;
61 shm_offset.lock = 1;
62
63 arena = color_mmap(size, shm_info, shm_offset);
64 if (arena == MAP_FAILED) {
65 printf("mmap failed.\n");
66 return NULL;
67 }
68
69 mlockall(MCL_CURRENT | MCL_FUTURE);
70 /* finish allocation */
71
72 assert(arena);
73
74 return arena;
75}
76
77static cacheline_t* alloc_local(size_t size, int use_huge_pages, int use_uncache_pages)
78{
79 int flags = MAP_PRIVATE | MAP_POPULATE;
80 cacheline_t* arena = NULL;
81 int fd;
82
83 if(use_huge_pages)
84 flags |= MAP_HUGETLB;
85
86 if(use_uncache_pages) {
87 fd = open(UNCACHE_DEV, O_RDWR|O_SYNC);
88 if (fd == -1)
89 bail_out("Failed to open uncache device. Are you running the LITMUS^RT kernel?");
90 }
91 else {
92 fd = -1;
93 flags |= MAP_ANONYMOUS;
94 }
95
96 arena = mmap(0, size, PROT_READ | PROT_WRITE, flags, fd, 0);
97
98