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
F174469608: D27891.diff
Sat, Oct 3, 12:17 PM
Unknown Object (File)
Thu, Oct 1, 7:04 PM
Unknown Object (File)
Fri, Sep 25, 12:24 PM
Unknown Object (File)
Fri, Sep 11, 7:40 AM
Unknown Object (File)
Tue, Sep 8, 10:43 PM
Unknown Object (File)
Sun, Sep 6, 2:24 PM
Unknown Object (File)
Sat, Sep 5, 8:33 PM
Unknown Object (File)
Sat, Sep 5, 2:00 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.