aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2012-08-18 21:19:44 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2012-08-18 21:19:44 -0400
commit136093a31ba46669d25b64470842c7dc9713d45e (patch)
treecdeb1409ffb7c2579384efaf9afb7ee215d73aa4
parent1fa247930d7a9f129c6aefc81e3d71103bce41d3 (diff)
Fix spinlock bug
-rw-r--r--litmus/sched_gfl_split.c8
-rw-r--r--litmus/sched_gsn_edf_split.c6
2 files changed, 4 insertions, 10 deletions
diff --git a/litmus/sched_gfl_split.c b/litmus/sched_gfl_split.c
index 983c98d088e9..70099ee3c64f 100644
--- a/litmus/sched_gfl_split.c
+++ b/litmus/sched_gfl_split.c
@@ -882,17 +882,13 @@ int gflsplit_fmlp_lock(struct litmus_lock* l)
882 if (!is_realtime(t)) 882 if (!is_realtime(t))
883 return -EPERM; 883 return -EPERM;
884 884
885 /* TODO: Check if it is safe to call cancel_split_timer here, i.e. 885 spin_lock_irqsave(&sem->wait.lock, flags);
886 * that interrupts are disabled. */ 886
887 tsk_rt(t)->in_crit_section = 1; 887 tsk_rt(t)->in_crit_section = 1;
888 if (entry->timer_armed) { 888 if (entry->timer_armed) {
889 cancel_split_timer(entry); 889 cancel_split_timer(entry);
890 } 890 }
891 891
892 spin_lock_irqsave(&sem->wait.lock, flags);
893
894 tsk_rt(t)->in_crit_section = 1;
895
896 if (sem->owner) { 892 if (sem->owner) {
897 /* resource is not free => must suspend and wait */ 893 /* resource is not free => must suspend and wait */
898 894
diff --git a/litmus/sched_gsn_edf_split.c b/litmus/sched_gsn_edf_split.c
index ba9f9f525600..74629de619bf 100644
--- a/litmus/sched_gsn_edf_split.c
+++ b/litmus/sched_gsn_edf_split.c
@@ -898,15 +898,13 @@ int gsnedfsplit_fmlp_lock(struct litmus_lock* l)
898 if (!is_realtime(t)) 898 if (!is_realtime(t))
899 return -EPERM; 899 return -EPERM;
900 900
901 /* TODO: Check if it is safe to call cancel_split_timer here, i.e. 901 spin_lock_irqsave(&sem->wait.lock, flags);
902 * that interrupts are disabled. */ 902
903 tsk_rt(t)->in_crit_section = 1; 903 tsk_rt(t)->in_crit_section = 1;
904 if (entry->timer_armed) { 904 if (entry->timer_armed) {
905 cancel_split_timer(entry); 905 cancel_split_timer(entry);
906 } 906 }
907 907
908 spin_lock_irqsave(&sem->wait.lock, flags);
909
910 if (sem->owner) { 908 if (sem->owner) {
911 /* resource is not free => must suspend and wait */ 909 /* resource is not free => must suspend and wait */
912 910