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
Unknown Object (File)
Sun, Apr 21, 3:47 PM
Unknown Object (File)
Mar 13 2024, 10:21 PM
Unknown Object (File)
Mar 13 2024, 5:26 PM
Unknown Object (File)
Feb 11 2024, 7:52 AM
Unknown Object (File)
Dec 31 2023, 10:47 PM
Unknown Object (File)
Dec 20 2023, 6:00 AM
Unknown Object (File)
Aug 14 2023, 11:26 PM
Unknown Object (File)
Aug 14 2023, 12:32 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.