projects
/
lttng-modules.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: ring buffer: handle concurrent update in nested buffer wrap around check
[lttng-modules.git]
/
lib
/
ringbuffer
/
frontend_internal.h
diff --git
a/lib/ringbuffer/frontend_internal.h
b/lib/ringbuffer/frontend_internal.h
index bc284333f64c505e6e3fca646248073a8927f306..dbebdeec86f3362c30d59642ef9ab6910ca94a28 100644
(file)
--- a/
lib/ringbuffer/frontend_internal.h
+++ b/
lib/ringbuffer/frontend_internal.h
@@
-331,6
+331,12
@@
void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config,
* The subbuffer size is least 2 bytes (minimum size: 1 page).
* This guarantees that old_commit_count + 1 != commit_count.
*/
* The subbuffer size is least 2 bytes (minimum size: 1 page).
* This guarantees that old_commit_count + 1 != commit_count.
*/
+
+ /*
+ * Order prior updates to reserve count prior to the
+ * commit_cold cc_sb update.
+ */
+ smp_wmb();
if (likely(v_cmpxchg(config, &buf->commit_cold[idx].cc_sb,
old_commit_count, old_commit_count + 1)
== old_commit_count)) {
if (likely(v_cmpxchg(config, &buf->commit_cold[idx].cc_sb,
old_commit_count, old_commit_count + 1)
== old_commit_count)) {
@@
-373,6
+379,11
@@
void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config,
/* End of exclusive subbuffer access */
v_set(config, &buf->commit_cold[idx].cc_sb,
commit_count);
/* End of exclusive subbuffer access */
v_set(config, &buf->commit_cold[idx].cc_sb,
commit_count);
+ /*
+ * Order later updates to reserve count after
+ * the commit_cold cc_sb update.
+ */
+ smp_wmb();
lib_ring_buffer_vmcore_check_deliver(config, buf,
commit_count, idx);
lib_ring_buffer_vmcore_check_deliver(config, buf,
commit_count, idx);
This page took
0.022964 seconds
and
4
git commands to generate.