summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-25 20:22:36 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-25 20:24:05 +0200
commit08811e805aab3236cac08513adc5e0b7fb3006d5 (patch)
tree9f33998587fed5d25ad023db60e094a81058b708 /kern
parentd36bae77d33389ac40d881c5583c44acfb70cb1f (diff)
Add missing memory barriers in simple lock debugging
* kern/lock.c (_simple_lock, _simple_lock_try, simple_unlock): Add compiler memory barrier to separate simple_locks_taken update from information filling.
Diffstat (limited to 'kern')
-rw-r--r--kern/lock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kern/lock.c b/kern/lock.c
index 1daf1b4d..a4b82522 100644
--- a/kern/lock.c
+++ b/kern/lock.c
@@ -175,6 +175,7 @@ void _simple_lock(
l->lock_data = 1;
info = &simple_locks_info[simple_locks_taken++];
+ barrier();
info->l = l;
info->expr = expression;
info->loc = location;
@@ -193,6 +194,7 @@ boolean_t _simple_lock_try(
l->lock_data = 1;
info = &simple_locks_info[simple_locks_taken++];
+ barrier();
info->l = l;
info->expr = expression;
info->loc = location;
@@ -219,6 +221,7 @@ void simple_unlock(
simple_locks_info[i] = simple_locks_info[simple_locks_taken-1];
}
+ barrier();
simple_locks_taken--;
simple_locks_info[simple_locks_taken] = (struct simple_locks_info) {0};
}