Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ringbuffer hardware race condition bug. #3240

Closed

Commits on Aug 9, 2024

  1. Fix ringbuffer hardware race condition bug.

    When attempting to get a snapshot of the completion count and
    position, the current ringbuffer implementation uses a critical section.
    This does indeed prevent the completion_count from updating but does not
    prevent the position from updating since that is fetched directly
    from the DMA register.
    
    When the code is called right at the end of the DMA cycle,
    the position that is read may be that of the next cycle, while the
    completion_count is still that of the previous cycle. As a result it
    looks to the code as if we went backwards and an overrun error is
    emitted.
    
    In order to fix this we remove the critical section and get two
    readings, comparing the two in order to deduce that a wrap-around
    occured.
    liarokapisv committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    dd837dc View commit details
    Browse the repository at this point in the history