Page MenuHomeFreeBSD

bitset: Fix BIT_TEST_SET_ATOMIC and BIT_TEST_CLR_ATOMIC.
AbandonedPublic

Authored by mmel on Jan 2 2021, 12:06 PM.
Tags
None
Referenced Files
F108027585: D27891.diff
Mon, Jan 20, 4:47 PM
Unknown Object (File)
Thu, Jan 16, 6:08 PM
Unknown Object (File)
Fri, Jan 10, 3:48 PM
Unknown Object (File)
Sat, Dec 28, 8:06 AM
Unknown Object (File)
Nov 23 2024, 5:22 PM
Unknown Object (File)
Nov 11 2024, 10:45 PM
Unknown Object (File)
Oct 3 2024, 9:38 PM
Unknown Object (File)
Oct 3 2024, 6:53 PM
Subscribers
None

Details

Reviewers
rlibby
markj
Summary

The last argument to atomic_testandset/clear_long should be the bit position in the long, not full bitset index.
This completes a fix for 942951ba46ecd5ebab18de006a24dc52e2d3f745 started in D27886.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mmel requested review of this revision.Jan 2 2021, 12:06 PM
mmel created this revision.

Actually atomic(9) says that it will do the mod:

atomic_testandset(p, v)
        bit = 1 << (v % (sizeof(*p) * NBBY));
        tmp = (*p & bit) != 0;
        *p |= bit;
        return (tmp);

Hmm, right. It would be better to read the manual before coding. My bad.

You're right that 32-bit arm also has a bug though and needs more follow up.