aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-01-08 18:19:43 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2013-01-09 18:09:00 -0500
commit29496770fea3c801553b0dc5a2a8e295e490a915 (patch)
tree974d2ed0a53be72592383de33bd89f797c5f3ef4
parentc158b5fbe42dacd34393082b6b8f9f6573ab8c5c (diff)
Extend non-rt support to sync-releases.
Note that non-rt tasks are released immediately. That is, the 'delay' provided to the release_ts() system-call is ignored for non-rt tasks. Conflicts: litmus/sync.c
-rw-r--r--litmus/sync.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/litmus/sync.c b/litmus/sync.c
index 873b3ffb2e7e..a796c20f0e9f 100644
--- a/litmus/sync.c
+++ b/litmus/sync.c
@@ -50,12 +50,14 @@ static long do_wait_for_ts_release(void)
50 ret = wait_for_completion_interruptible(&wait.completion); 50 ret = wait_for_completion_interruptible(&wait.completion);
51 51
52 if (!ret) { 52 if (!ret) {
53 /* Completion succeeded, setup release. */ 53 if (is_realtime(current)) {
54 litmus->release_at(current, wait.ts_release_time 54 /* Completion succeeded, setup release. */
55 + current->rt_param.task_params.phase 55 litmus->release_at(current, wait.ts_release_time
56 - current->rt_param.task_params.period); 56 + current->rt_param.task_params.phase
57 /* trigger advance to next job release at the programmed time */ 57 - current->rt_param.task_params.period);
58 ret = complete_job(); 58 /* trigger advance to next job release at the programmed time */
59 ret = complete_job();
60 }
59 } else { 61 } else {
60 /* We were interrupted, must cleanup list. */ 62 /* We were interrupted, must cleanup list. */
61 mutex_lock(&task_release_lock); 63 mutex_lock(&task_release_lock);
@@ -106,6 +108,9 @@ static long do_release_ts(lt_t start)
106 list_entry(pos, struct ts_release_wait, list); 108 list_entry(pos, struct ts_release_wait, list);
107 109
108 task_count++; 110 task_count++;
111
112 /* RT tasks can be delayed. Non-RT tasks are released
113 immediately. */
109 wait->ts_release_time = start; 114 wait->ts_release_time = start;
110 complete(&wait->completion); 115 complete(&wait->completion);
111 } 116 }
@@ -123,10 +128,8 @@ out:
123asmlinkage long sys_wait_for_ts_release(void) 128asmlinkage long sys_wait_for_ts_release(void)
124{ 129{
125 long ret = -EPERM; 130 long ret = -EPERM;
126 struct task_struct *t = current;
127 131
128 if (is_realtime(t)) 132 ret = do_wait_for_ts_release();
129 ret = do_wait_for_ts_release();
130 133
131 return ret; 134 return ret;
132} 135}
@@ -135,16 +138,21 @@ asmlinkage long sys_wait_for_ts_release(void)
135 138
136asmlinkage long sys_release_ts(lt_t __user *__delay) 139asmlinkage long sys_release_ts(lt_t __user *__delay)
137{ 140{
138 long ret; 141 long ret = 0;
139 lt_t delay; 142 lt_t delay = 0;
140 lt_t start_time; 143 lt_t start_time;
141 144
142 /* FIXME: check capabilities... */ 145 /* FIXME: check capabilities... */
143 146
144 ret = copy_from_user(&delay, __delay, sizeof(delay)); 147 if (__delay)
148 ret = copy_from_user(&delay, __delay, sizeof(delay));
149
145 if (ret == 0) { 150 if (ret == 0) {
146 /* round up to next larger integral millisecond */ 151 /* round up to next larger integral millisecond */
147 start_time = ((litmus_clock() / ONE_MS) + 1) * ONE_MS; 152 start_time = ((litmus_clock() / ONE_MS) + 1) * ONE_MS;
153
154 /* Note: Non-rt tasks that participate in a sync release cannot be
155 delayed. They will be released immediately. */
148 ret = do_release_ts(start_time + delay); 156 ret = do_release_ts(start_time + delay);
149 } 157 }
150 158