diff options
| author | Namhoon Kim <namhoonk@cs.unc.edu> | 2017-05-01 16:02:05 -0400 |
|---|---|---|
| committer | Namhoon Kim <namhoonk@cs.unc.edu> | 2017-05-01 16:02:05 -0400 |
| commit | 11765fcf37057053065abd3715cf9cb46f2fa4db (patch) | |
| tree | 8403d716bbcbd96493c481a82e7e02b5da9231e8 | |
| parent | bfee87a910560e022b04c81a026b1f88522cd62f (diff) | |
RTSS17 submitwip-modechange
| -rw-r--r-- | Makefile | 49 | ||||
| -rw-r--r-- | bin/mc2bench.c | 503 | ||||
| -rw-r--r-- | bin/mc2mem.c (renamed from bin/mc2shm.c) | 278 | ||||
| -rw-r--r-- | bin/mc2spin.c | 83 | ||||
| -rw-r--r-- | bin/mode_request.c | 48 | ||||
| -rw-r--r-- | bin/mode_skeleton.c (renamed from bin/rt_transitive.c) | 618 | ||||
| -rw-r--r-- | bin/rt_field.c | 379 | ||||
| -rw-r--r-- | bin/rt_field_spin.c | 385 | ||||
| -rw-r--r-- | bin/rt_matrix.c | 851 | ||||
| -rw-r--r-- | bin/rt_matrix_spin.c | 833 | ||||
| -rw-r--r-- | bin/rt_mode_poll.c | 102 | ||||
| -rw-r--r-- | bin/rt_neighborhood.c | 381 | ||||
| -rw-r--r-- | bin/rt_neighborhood_spin.c | 337 | ||||
| -rw-r--r-- | bin/rt_pointer.c | 430 | ||||
| -rw-r--r-- | bin/rt_pointer_spin.c | 439 | ||||
| -rw-r--r-- | bin/rt_update.c | 387 | ||||
| -rw-r--r-- | bin/rt_update_spin.c | 398 | ||||
| -rw-r--r-- | bin/test1.c | 453 | ||||
| -rw-r--r-- | src/kernel_iface.c | 6 |
19 files changed, 441 insertions, 6519 deletions
| @@ -20,7 +20,7 @@ LITMUS_KERNEL ?= ../litmus-rt | |||
| 20 | 20 | ||
| 21 | # compiler flags | 21 | # compiler flags |
| 22 | flags-debug = -O0 -Wall -g -Wdeclaration-after-statement | 22 | flags-debug = -O0 -Wall -g -Wdeclaration-after-statement |
| 23 | flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DCONFIG_PGMRT_SUPPORT | 23 | flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE |
| 24 | 24 | ||
| 25 | # architecture-specific flags | 25 | # architecture-specific flags |
| 26 | flags-i386 = -m32 | 26 | flags-i386 = -m32 |
| @@ -73,13 +73,14 @@ AR := ${CROSS_COMPILE}${AR} | |||
| 73 | 73 | ||
| 74 | all = lib ${rt-apps} | 74 | all = lib ${rt-apps} |
| 75 | rt-apps = cycles base_task rt_launch rtspin release_ts measure_syscall \ | 75 | rt-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 | ||
| 82 | all: ${all} inc/config.makefile | 83 | all: ${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 |
| 133 | TAGS: | 135 | TAGS: |
| @@ -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 | ||
| 150 | post-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 | |||
| 242 | obj-mc2spin = mc2spin.o common.o | 246 | obj-mc2spin = mc2spin.o common.o |
| 243 | lib-mc2spin = -lrt -static | 247 | lib-mc2spin = -lrt -static |
| 244 | 248 | ||
| 245 | obj-mc2pollute = mc2pollute.o common.o | 249 | obj-mc2mem = mc2mem.o common.o |
| 246 | lib-mc2pollute = -lrt -static | 250 | lib-mc2mem = -lrt -static |
| 247 | |||
| 248 | obj-mc2syn = mc2syn.o common.o | ||
| 249 | lib-mc2syn = -lrt -static | ||
| 250 | |||
| 251 | obj-memthrash = memthrash.o | ||
| 252 | lib-memthrash = -lrt | ||
| 253 | |||
| 254 | obj-test1 = test1.o common.o | ||
| 255 | lib-test1 = -lrt -static | ||
| 256 | |||
| 257 | obj-mc2thrash = mc2thrash.o common.o | ||
| 258 | lib-mc2thrash = -lrt -static | ||
| 259 | |||
| 260 | obj-mc2thrash1 = mc2thrash.o common.o | ||
| 261 | lib-mc2thrash1 = -lrt -static | ||
| 262 | |||
| 263 | obj-mc2thrash2 = mc2thrash.o common.o | ||
| 264 | lib-mc2thrash2 = -lrt -static | ||
| 265 | |||
| 266 | obj-mc2thrash3 = mc2thrash.o common.o | ||
| 267 | lib-mc2thrash3 = -lrt -static | ||
| 268 | |||
| 269 | obj-mc2shm = mc2shm.o common.o | ||
| 270 | lib-mc2shm = -lrt -static | ||
| 271 | 251 | ||
| 272 | obj-mtdag = mtdag.o common.o | 252 | obj-mtdag = mtdag.o common.o |
| 273 | ldf-mtdag = -lrt -pthread -static | 253 | ldf-mtdag = -lrt -pthread -static |
| 274 | 254 | ||
| 275 | obj-mc2bench = mc2bench.o common.o | 255 | obj-mode_request = mode_request.o common.o |
| 276 | lib-mc2bench = -lrt -static | 256 | lib-mode_request = -lrt -static |
| 257 | |||
| 258 | obj-rt_mode_poll = rt_mode_poll.o common.o | ||
| 259 | lib-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 | |||
| 28 | static int loops = 100000; | ||
| 29 | static cacheline_t* arena = NULL; | ||
| 30 | static cacheline_t* local_buf = NULL; | ||
| 31 | |||
| 32 | struct timeval t1,t2; | ||
| 33 | |||
| 34 | lt_t exectime[100000]; | ||
| 35 | |||
| 36 | inline 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 | |||
| 46 | static 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 | |||
| 77 | static 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 | |||
