diff options
| author | R. Christian McDonald <rcm@FreeBSD.org> | 2026-10-12 20:44:32 +0000 |
|---|---|---|
| committer | R. Christian McDonald <rcm@FreeBSD.org> | 2026-10-12 20:45:29 +0000 |
| commit | 2b911d947b5c1157a495454123ea972a18e4743d (patch) | |
| tree | 4b537b8bb4cc4b1e8757be06708d90b6b6f57fd8 /usr.bin/xohtml | |
| parent | 39d6e2226484ca434c7d980eda4aa19ed0d62c9e (diff) | |
Readers check rms->writers without a fence, and rms_wunlock() drops
it with a plain store. rms_wlock() interrupts every CPU before the
first writer blocks readers, but nothing orders them when the last
writer leaves: on a weakly ordered CPU a reader can see the count
reach zero and still read what the writer replaced, such as callbacks
of a module unloaded under the lock.
Fence every CPU before the last writer drops the count: rename
rms_wlock_switch() to rms_block_readers() and add
rms_unblock_readers(), a wrapper for cpus_fence_seq_cst(). Readers
stay fence-free; the cost lands on the rare unlock.
Reviewed by: mjg
Discussed with: kib
Fixes: 1f162fef76a0 ("Add read-mostly sleepable locks")
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D60658
Diffstat (limited to 'usr.bin/xohtml')
0 files changed, 0 insertions, 0 deletions
