diff options
author | Zelin Tong <ztong@cs.unc.edu> | 2021-10-24 19:16:16 -0400 |
---|---|---|
committer | Zelin Tong <ztong@cs.unc.edu> | 2021-10-24 19:16:16 -0400 |
commit | a1f9c31fb1405394390b69c103c20a67671a0e8b (patch) | |
tree | f970b72a5dd108d5af08f0b18ac4d41f10e757c1 | |
parent | 8119553094cd2d3f6985bfbd97b79525b03a3b20 (diff) |
Fixed b-OMLP bugs
-rw-r--r-- | litmus/sched_gsn_edf.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index d4635c74df1c..52db1435d5c9 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c | |||
@@ -1137,16 +1137,17 @@ int gsnedf_omlp_budgeted_lock(struct litmus_lock* l, lt_t fz_len) | |||
1137 | 1137 | ||
1138 | spin_lock_irqsave(&sem->fifo_wait.lock, flags); | 1138 | spin_lock_irqsave(&sem->fifo_wait.lock, flags); |
1139 | 1139 | ||
1140 | /* resource is not free => must suspend and wait */ | ||
1141 | litmus_current_budget(&budget_used, &budget_remaining); | ||
1142 | if (budget_remaining < fz_len) { | ||
1143 | /* Not enough budget for the CS => deny forbidden zone access */ | ||
1144 | TRACE_CUR("failed forbidden zone check, %llu / %llu budget needed\n", | ||
1145 | budget_remaining, fz_len); | ||
1146 | spin_unlock_irqrestore(&sem->fifo_wait.lock, flags); | ||
1147 | return -EACCES; | ||
1148 | } | ||
1149 | |||
1140 | if (sem->owner) { | 1150 | if (sem->owner) { |
1141 | /* resource is not free => must suspend and wait */ | ||
1142 | litmus_current_budget(&budget_used, &budget_remaining); | ||
1143 | if (fz_len < budget_remaining) { | ||
1144 | /* Not enough budget for the CS => deny forbidden zone access */ | ||
1145 | TRACE_CUR("failed forbidden zone check, %llu / %llu budget needed\n", | ||
1146 | budget_remaining, fz_len); | ||
1147 | spin_unlock_irqrestore(&sem->fifo_wait.lock, flags); | ||
1148 | return -EACCES; | ||
1149 | } | ||
1150 | 1151 | ||
1151 | init_prio_waitqueue_entry(&pwq, t, get_deadline(t)); | 1152 | init_prio_waitqueue_entry(&pwq, t, get_deadline(t)); |
1152 | 1153 | ||
@@ -1183,7 +1184,7 @@ int gsnedf_omlp_budgeted_lock(struct litmus_lock* l, lt_t fz_len) | |||
1183 | 1184 | ||
1184 | int gsnedf_omlp_lock(struct litmus_lock* l) | 1185 | int gsnedf_omlp_lock(struct litmus_lock* l) |
1185 | { | 1186 | { |
1186 | return gsnedf_omlp_budgeted_lock(l, ULLONG_MAX); | 1187 | return gsnedf_omlp_budgeted_lock(l, 0); |
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | int gsnedf_omlp_unlock(struct litmus_lock* l) | 1190 | int gsnedf_omlp_unlock(struct litmus_lock* l) |
@@ -1236,7 +1237,13 @@ int gsnedf_omlp_unlock(struct litmus_lock* l) | |||
1236 | 1237 | ||
1237 | /* we make ourself preemptive again and lose priority inheritance (if any) */ | 1238 | /* we make ourself preemptive again and lose priority inheritance (if any) */ |
1238 | take_np(t); | 1239 | take_np(t); |
1239 | clear_priority_inheritance(t); | 1240 | if (tsk_rt(t)->inh_task) |
1241 | clear_priority_inheritance(t); | ||
1242 | else { | ||
1243 | raw_spin_lock(&gsnedf_lock); | ||
1244 | check_for_preemptions(); | ||
1245 | raw_spin_unlock(&gsnedf_lock); | ||
1246 | } | ||
1240 | 1247 | ||
1241 | spin_unlock_irqrestore(&sem->fifo_wait.lock, flags); | 1248 | spin_unlock_irqrestore(&sem->fifo_wait.lock, flags); |
1242 | 1249 | ||