diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel_iface.c | 15 | ||||
-rw-r--r-- | src/syscalls.c | 7 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/kernel_iface.c b/src/kernel_iface.c index 6286810..bd47d5c 100644 --- a/src/kernel_iface.c +++ b/src/kernel_iface.c | |||
@@ -43,6 +43,8 @@ int init_kernel_iface(void) | |||
43 | int err = 0; | 43 | int err = 0; |
44 | long page_size = sysconf(_SC_PAGESIZE); | 44 | long page_size = sysconf(_SC_PAGESIZE); |
45 | 45 | ||
46 | BUILD_BUG_ON(sizeof(union np_flag) != sizeof(uint32_t)); | ||
47 | |||
46 | err = map_file(LITMUS_CTRL_DEVICE, (void**) &ctrl_page, CTRL_PAGES * page_size); | 48 | err = map_file(LITMUS_CTRL_DEVICE, (void**) &ctrl_page, CTRL_PAGES * page_size); |
47 | if (err) { | 49 | if (err) { |
48 | fprintf(stderr, "%s: cannot open LITMUS^RT control page (%m)\n", | 50 | fprintf(stderr, "%s: cannot open LITMUS^RT control page (%m)\n", |
@@ -55,7 +57,7 @@ int init_kernel_iface(void) | |||
55 | void enter_np(void) | 57 | void enter_np(void) |
56 | { | 58 | { |
57 | if (likely(ctrl_page != NULL) || init_kernel_iface() == 0) | 59 | if (likely(ctrl_page != NULL) || init_kernel_iface() == 0) |
58 | ctrl_page->np_flag++; | 60 | ctrl_page->sched.np.flag++; |
59 | else | 61 | else |
60 | fprintf(stderr, "enter_np: control page not mapped!\n"); | 62 | fprintf(stderr, "enter_np: control page not mapped!\n"); |
61 | } | 63 | } |
@@ -63,10 +65,12 @@ void enter_np(void) | |||
63 | 65 | ||
64 | void exit_np(void) | 66 | void exit_np(void) |
65 | { | 67 | { |
66 | if (likely(ctrl_page != NULL) && --ctrl_page->np_flag == 0) { | 68 | if (likely(ctrl_page != NULL) && |
69 | ctrl_page->sched.np.flag && | ||
70 | !(--ctrl_page->sched.np.flag)) { | ||
67 | /* became preemptive, let's check for delayed preemptions */ | 71 | /* became preemptive, let's check for delayed preemptions */ |
68 | __sync_synchronize(); | 72 | __sync_synchronize(); |
69 | if (ctrl_page->delayed_preemption) | 73 | if (ctrl_page->sched.np.preempt) |
70 | sched_yield(); | 74 | sched_yield(); |
71 | } | 75 | } |
72 | } | 76 | } |
@@ -78,6 +82,11 @@ void request_resource(int resource, int replicas) | |||
78 | } | 82 | } |
79 | } | 83 | } |
80 | 84 | ||
85 | int requested_to_preempt(void) | ||
86 | { | ||
87 | return (likely(ctrl_page != NULL) && ctrl_page->sched.np.preempt); | ||
88 | } | ||
89 | |||
81 | /* init and return a ptr to the control page for | 90 | /* init and return a ptr to the control page for |
82 | * preemption and migration overhead analysis | 91 | * preemption and migration overhead analysis |
83 | * | 92 | * |
diff --git a/src/syscalls.c b/src/syscalls.c index ef1ea17..c68f15b 100644 --- a/src/syscalls.c +++ b/src/syscalls.c | |||
@@ -8,8 +8,6 @@ | |||
8 | /* for syscall() */ | 8 | /* for syscall() */ |
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | 10 | ||
11 | //#include <sys/types.h> | ||
12 | |||
13 | #include "litmus.h" | 11 | #include "litmus.h" |
14 | 12 | ||
15 | /* Syscall stub for setting RT mode and scheduling options */ | 13 | /* Syscall stub for setting RT mode and scheduling options */ |
@@ -88,8 +86,3 @@ int null_call(cycles_t *timestamp) | |||
88 | { | 86 | { |
89 | return syscall(__NR_null_call, timestamp); | 87 | return syscall(__NR_null_call, timestamp); |
90 | } | 88 | } |
91 | |||
92 | int set_rt_task_mc_param(pid_t pid, struct mc_task *param) | ||
93 | { | ||
94 | return syscall(__NR_set_rt_task_mc_param, pid, param); | ||
95 | } | ||