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

firmware: fix race conditions in control out transfers (-2 bytes XRAM). #703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

purdeaandrei
Copy link
Contributor

This PR depends on whitequark/libfx2#18
This PR is ready for review but it should only be merged after the libfx2 PR is merged,
and then this PR should also include an update to the submodule reference.

Before this change, the EP0BUF buffer used by control out transfers could be overwritten by new control transfers before the firmware is finished processing the previous control transfer.

The easiest way to illustrate this problem would be to run in a different terminal the following:

while true; do lsusb -v -d 20b7:9db1 > /dev/null; done

While this is running, glasglow is completely unusable. Presumably even a single lsusb run could cause corruption, if it happens to be issued at the wrong time.

With this change glasgow is now usable, even if the above loop is running.

Before this change, the EP0BUF buffer used by control out transfers
could be overwritten by new control transfers before the firmware is
finished processing the previous control transfer.

The easiest way to illustrate this problem would be to run in a
different terminal the following:

```bash
while true; do lsusb -v -d 20b7:9db1 > /dev/null; done
```

While this is running, glasglow is completely unusable.
Presumably even a single lsusb run could cause corruption, if it
happens to be issued at the wrong time.

With this change glasgow is now usable, even if the above loop is
running.

Please see whitequark/libfx2#18 for more
details.
@purdeaandrei purdeaandrei force-pushed the f_fix_control_out_transfer_race_conditions branch from a628e16 to b1e7539 Compare September 27, 2024 04:26
@purdeaandrei purdeaandrei changed the title firmware: fix race conditions in control out transfers (+0 bytes XRAM). firmware: fix race conditions in control out transfers (-2 bytes XRAM). Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant