FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-117657: Quiet erroneous TSAN reports of data races in `_PySeqLock` by mpage · Pull Request #117955 · python/cpython · GitHub

/ cpython Public

gh-117657: Quiet erroneous TSAN reports of data races in _PySeqLock - #117955

Merged
DinoV merged 2 commits into
python:mainfrom
mpage:gh-117657-seq-lock
Apr 17, 2024
Merged

gh-117657: Quiet erroneous TSAN reports of data races in _PySeqLock#117955
DinoV merged 2 commits into
python:mainfrom
mpage:gh-117657-seq-lock

Conversation

mpage commented Apr 17, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

TSAN reports a couple of data races between the compare/exchange in _PySeqLock_LockWrite:

else if (_Py_atomic_compare_exchange_uint32(&seqlock->sequence, &prev, prev + 1)) {

and the non-atomic loads in _PySeqLock_AbandonWrite (example race):

cpython/Python/lock.c

Lines 493 to 495 in a23fa33

void _PySeqLock_AbandonWrite(_PySeqLock *seqlock)
{
uint32_t new_seq = seqlock->sequence - 1;

and _PySeqLock_UnlockWrite (example race):

cpython/Python/lock.c

Lines 500 to 502 in a23fa33

void _PySeqLock_UnlockWrite(_PySeqLock *seqlock)
{
uint32_t new_seq = seqlock->sequence + 1;

This is another instance of TSAN incorrectly modeling failed compare/exchange as a write instead of a load.

TSAN reports a couple of data races between the compare/exchange in
`_PySeqLock_LockWrite` and the non-atomic loads in `_PySeqLock_{Abandon,Unlock}Write`.
This is another instance of TSAN incorrectly modeling failed compare/exchange
as a write instead of a load.
mpage requested review from DinoV and colesbury April 17, 2024 04:40
mpage marked this pull request as ready for review April 17, 2024 05:40

DinoV left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM!

ghost commented Apr 17, 2024
edited by ghost
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL