HomeFreeBSD

buf_ring: Keep the full head and tail values

Description

buf_ring: Keep the full head and tail values

If a thread reads the head but then sleeps for long enough that
another thread fills the ring and leaves the new head with the
expected value then the cmpset can pass when it should have failed.

To work around this keep the full head and tail value and use the
upper bits as a generation count.

Reviewed by: kib
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D46151

(cherry picked from commit 3cc603909e09c958e20dd5a8a341f62f29e33a07)

Details

Provenance
andrewAuthored on Aug 19 2024, 9:06 AM
Reviewer
kib
Differential Revision
D46151: buf_ring: Keep the full head and tail values
Parents
rGbe17061faf3b: buf_ring: Consistently use atomic_*_32
Branches
Unknown
Tags
Unknown