Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168888095
D23440.id67574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23440.id67574.diff
View Options
Index: sys/kern/subr_smr.c
===================================================================
--- sys/kern/subr_smr.c
+++ sys/kern/subr_smr.c
@@ -275,7 +275,7 @@
c = zpcpu_get_cpu(smr, i);
c_seq = SMR_SEQ_INVALID;
for (;;) {
- c_seq = atomic_load_int(&c->c_seq);
+ c_seq = atomic_load_acq_int(&c->c_seq);
if (c_seq == SMR_SEQ_INVALID)
break;
@@ -323,6 +323,8 @@
if (c_seq != SMR_SEQ_INVALID && SMR_SEQ_GT(rd_seq, c_seq))
rd_seq = c_seq;
}
+ /* Same semantic for reads of c->c_seq above as in smr_enter(). */
+ atomic_thread_fence_acq();
/*
* Advance the rd_seq as long as we observed the most recent one.
@@ -331,6 +333,7 @@
do {
if (SMR_SEQ_LEQ(rd_seq, s_rd_seq))
break;
+ atomic_thread_fence_rel();
} while (atomic_fcmpset_int(&s->s_rd_seq, &s_rd_seq, rd_seq) == 0);
out:
Index: tools/uma/smrstress/smrstress.c
===================================================================
--- tools/uma/smrstress/smrstress.c
+++ tools/uma/smrstress/smrstress.c
@@ -84,7 +84,7 @@
/* Wait for the writer to exit. */
while (smrs_completed == 0) {
smr_enter(smrs_smr);
- cur = (void *)atomic_load_ptr(&smrs_current);
+ cur = (void *)atomic_load_acq_ptr(&smrs_current);
if (cur->generation == -1)
smrs_error(cur, "read early: Use after free!\n");
atomic_add_int(&cur->count, 1);
@@ -107,6 +107,7 @@
for (i = 0; i < smrs_iterations; i++) {
cur = uma_zalloc_smr(smrs_zone, M_WAITOK);
+ atomic_thread_fence_rel();
cur = (void *)atomic_swap_ptr(&smrs_current, (uintptr_t)cur);
uma_zfree_smr(smrs_zone, cur);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 31, 3:14 PM (9 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37696590
Default Alt Text
D23440.id67574.diff (1 KB)
Attached To
Mode
D23440: smr: add some missed fences.
Attached
Detach File
Event Timeline
Log In to Comment