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, Sep 22, 4:27 AM
Unknown Object (File)
Thu, Sep 19, 11:40 PM
Unknown Object (File)
Sat, Aug 31, 7:11 AM
Unknown Object (File)
Aug 22 2024, 11:27 AM
Unknown Object (File)
Aug 22 2024, 11:27 AM
Unknown Object (File)
Aug 22 2024, 10:56 AM
Unknown Object (File)
Aug 18 2024, 9:51 PM
Unknown Object (File)
Jul 22 2024, 8:24 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.