Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
458dde3c
Commit
458dde3c
authored
Jan 29, 2020
by
Soby Mathew
Committed by
TrustedFirmware Code Review
Jan 29, 2020
Browse files
Merge "T589: Fix insufficient ordering guarantees in bakery lock" into integration
parents
8efec9e0
c0018913
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/locks/bakery/bakery_lock_coherent.c
View file @
458dde3c
...
@@ -137,10 +137,11 @@ void bakery_lock_get(bakery_lock_t *bakery)
...
@@ -137,10 +137,11 @@ void bakery_lock_get(bakery_lock_t *bakery)
}
}
/*
/*
* Lock acquired. Ensure that any reads from a shared resource in the
* Lock acquired. Ensure that any reads and writes from a shared
* critical section read values after the lock is acquired.
* resource in the critical section read/write values after the lock is
* acquired.
*/
*/
dmb
ld
();
dmb
ish
();
}
}
...
@@ -154,11 +155,14 @@ void bakery_lock_release(bakery_lock_t *bakery)
...
@@ -154,11 +155,14 @@ void bakery_lock_release(bakery_lock_t *bakery)
/*
/*
* Ensure that other observers see any stores in the critical section
* Ensure that other observers see any stores in the critical section
* before releasing the lock. Release the lock by resetting ticket.
* before releasing the lock. Also ensure all loads in the critical
* Then signal other waiting contenders.
* section are complete before releasing the lock. Release the lock by
* resetting ticket. Then signal other waiting contenders.
*/
*/
dmb
st
();
dmb
ish
();
bakery
->
lock_data
[
me
]
=
0U
;
bakery
->
lock_data
[
me
]
=
0U
;
/* Required to ensure ordering of the following sev */
dsb
();
dsb
();
sev
();
sev
();
}
}
lib/locks/bakery/bakery_lock_normal.c
View file @
458dde3c
...
@@ -219,10 +219,11 @@ void bakery_lock_get(bakery_lock_t *lock)
...
@@ -219,10 +219,11 @@ void bakery_lock_get(bakery_lock_t *lock)
}
}
/*
/*
* Lock acquired. Ensure that any reads from a shared resource in the
* Lock acquired. Ensure that any reads and writes from a shared
* critical section read values after the lock is acquired.
* resource in the critical section read/write values after the lock is
* acquired.
*/
*/
dmb
ld
();
dmb
ish
();
}
}
void
bakery_lock_release
(
bakery_lock_t
*
lock
)
void
bakery_lock_release
(
bakery_lock_t
*
lock
)
...
@@ -240,11 +241,14 @@ void bakery_lock_release(bakery_lock_t *lock)
...
@@ -240,11 +241,14 @@ void bakery_lock_release(bakery_lock_t *lock)
/*
/*
* Ensure that other observers see any stores in the critical section
* Ensure that other observers see any stores in the critical section
* before releasing the lock. Release the lock by resetting ticket.
* before releasing the lock. Also ensure all loads in the critical
* Then signal other waiting contenders.
* section are complete before releasing the lock. Release the lock by
* resetting ticket. Then signal other waiting contenders.
*/
*/
dmb
st
();
dmb
ish
();
my_bakery_info
->
lock_data
=
0U
;
my_bakery_info
->
lock_data
=
0U
;
write_cache_op
((
uintptr_t
)
my_bakery_info
,
is_cached
);
write_cache_op
((
uintptr_t
)
my_bakery_info
,
is_cached
);
/* This sev is ordered by the dsbish in write_cahce_op */
sev
();
sev
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment