aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/smr.h
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2020-01-31 22:21:15 +0000
committerJeff Roberson <jeff@FreeBSD.org>2020-01-31 22:21:15 +0000
commit915c367e8e9b718e5146401375d2188f14d39ac3 (patch)
treef28d2dbc991f9f0b8ed3c60e85a58d232426b23b /sys/sys/smr.h
parent82952c40657eb7957689581e4e204d117197f36b (diff)
downloadsrc-915c367e8e9b718e5146401375d2188f14d39ac3.tar.gz
src-915c367e8e9b718e5146401375d2188f14d39ac3.zip
Add two missing fences with comments describing them. These were found by
inspection and after a lengthy discussion with jhb and kib. They have not produced test failures. Don't pointer chase through cpu0's smr. Use cpu correct smr even when not in a critical section to reduce the likelihood of false sharing.
Notes
Notes: svn path=/head/; revision=357355
Diffstat (limited to 'sys/sys/smr.h')
-rw-r--r--sys/sys/smr.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/sys/smr.h b/sys/sys/smr.h
index 6df2c9b20d3f..b2c2fad07fec 100644
--- a/sys/sys/smr.h
+++ b/sys/sys/smr.h
@@ -70,10 +70,17 @@ struct smr {
* Return the current write sequence number.
*/
static inline smr_seq_t
+smr_shared_current(smr_shared_t s)
+{
+
+ return (atomic_load_int(&s->s_wr_seq));
+}
+
+static inline smr_seq_t
smr_current(smr_t smr)
{
- return (atomic_load_int(&smr->c_shared->s_wr_seq));
+ return (smr_shared_current(zpcpu_get(smr)->c_shared));
}
/*
@@ -106,7 +113,7 @@ smr_enter(smr_t smr)
* is detected and handled there.
*/
/* This is an add because we do not have atomic_store_acq_int */
- atomic_add_acq_int(&smr->c_seq, smr_current(smr));
+ atomic_add_acq_int(&smr->c_seq, smr_shared_current(smr->c_shared));
}
/*