diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-02-20 09:59:32 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-02-20 09:59:32 -0500 |
commit | 8428e06c674ef22f3455709318cc2aeb63590c6e (patch) | |
tree | c54bd0bebb02c5af34b93fe5cf8ac016c023b8c1 /litmus/sync.c | |
parent | 18aae5bfbead48ce3ae03da8932a69b641e18f98 (diff) |
change sys_wait_for_ts_release to ret release time
Diffstat (limited to 'litmus/sync.c')
-rw-r--r-- | litmus/sync.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/litmus/sync.c b/litmus/sync.c index 908bf21dc210..01ea5d52f84b 100644 --- a/litmus/sync.c +++ b/litmus/sync.c | |||
@@ -33,7 +33,7 @@ struct ts_release_wait { | |||
33 | static LIST_HEAD(task_release_list); | 33 | static LIST_HEAD(task_release_list); |
34 | static DEFINE_MUTEX(task_release_lock); | 34 | static DEFINE_MUTEX(task_release_lock); |
35 | 35 | ||
36 | static long do_wait_for_ts_release(void) | 36 | static long do_wait_for_ts_release(struct timespec *wake) |
37 | { | 37 | { |
38 | DECLARE_TS_RELEASE_WAIT(wait); | 38 | DECLARE_TS_RELEASE_WAIT(wait); |
39 | 39 | ||
@@ -51,13 +51,18 @@ static long do_wait_for_ts_release(void) | |||
51 | 51 | ||
52 | if (!ret) { | 52 | if (!ret) { |
53 | if (is_realtime(current)) { | 53 | if (is_realtime(current)) { |
54 | lt_t phasedRelease = wait.ts_release_time | ||
55 | + current->rt_param.task_params.phase; | ||
56 | *wake = ns_to_timespec(phasedRelease); | ||
57 | |||
54 | /* Completion succeeded, setup release. */ | 58 | /* Completion succeeded, setup release. */ |
55 | litmus->release_at(current, wait.ts_release_time | 59 | litmus->release_at(current, phasedRelease |
56 | + current->rt_param.task_params.phase | 60 | - current->rt_param.task_params.period); |
57 | - current->rt_param.task_params.period); | ||
58 | /* trigger advance to next job release at the programmed time */ | 61 | /* trigger advance to next job release at the programmed time */ |
59 | ret = complete_job(); | 62 | ret = complete_job(); |
60 | } | 63 | } |
64 | else | ||
65 | *wake = ns_to_timespec(wait.ts_release_time); | ||
61 | } else { | 66 | } else { |
62 | /* We were interrupted, must cleanup list. */ | 67 | /* We were interrupted, must cleanup list. */ |
63 | mutex_lock(&task_release_lock); | 68 | mutex_lock(&task_release_lock); |
@@ -125,11 +130,16 @@ out: | |||
125 | } | 130 | } |
126 | 131 | ||
127 | 132 | ||
128 | asmlinkage long sys_wait_for_ts_release(void) | 133 | asmlinkage long sys_wait_for_ts_release(struct timespec __user *__wake) |
129 | { | 134 | { |
135 | struct timespec wake; | ||
130 | long ret = -EPERM; | 136 | long ret = -EPERM; |
131 | 137 | ||
132 | ret = do_wait_for_ts_release(); | 138 | ret = do_wait_for_ts_release(&wake); |
139 | |||
140 | if (__wake && access_ok(VERIFY_WRITE, __wake, sizeof(struct timespec))) { | ||
141 | __copy_to_user(__wake, &wake, sizeof(wake)); | ||
142 | } | ||
133 | 143 | ||
134 | return ret; | 144 | return ret; |
135 | } | 145 | } |
@@ -149,7 +159,8 @@ asmlinkage long sys_release_ts(lt_t __user *__delay) | |||
149 | 159 | ||
150 | if (ret == 0) { | 160 | if (ret == 0) { |
151 | /* round up to next larger integral millisecond */ | 161 | /* round up to next larger integral millisecond */ |
152 | start_time = ((litmus_clock() / ONE_MS) + 1) * ONE_MS; | 162 | // start_time = ((litmus_clock() / ONE_MS) + 1) * ONE_MS; |
163 | start_time = litmus_clock(); | ||
153 | 164 | ||
154 | /* Note: Non-rt tasks that participate in a sync release cannot be | 165 | /* Note: Non-rt tasks that participate in a sync release cannot be |
155 | delayed. They will be released immediately. */ | 166 | delayed. They will be released immediately. */ |