HLE/gameinput: write callback token before registration and order blo… #534

Open
pug205gti6 wants to merge 1 commit from upstream-pr/534 into main
pug205gti6 commented 2026-11-25 02:01:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by pug205gti6 on 2026-11-25T02:01:10Z.


…cking enumeration

  • Write *out = registration.token before inserting the callback into state.callbacks in register_device so no callback invocation (blocking, async, or poll-driven) can observe an uninitialized token or race with the write to *out.
  • Track tokens currently running blocking enumeration in State::enumerating and buffer any concurrent poll() transitions for those tokens in State::deferred, draining them on the registering thread before clearing enumerating (and dropping them on forget()). This prevents poll() from delivering DISCONNECTED ahead of or concurrently with initial CONNECTED enumeration without holding hub.state() across user callbacks.
  • Add synthetic concurrency test blocking_enumeration_writes_token_first_and_orders_concurrent_poll.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6595419353 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/534). Originally posted by [pug205gti6](https://github.com/pug205gti6) on 2026-11-25T02:01:10Z. --- …cking enumeration - Write `*out = registration.token` before inserting the callback into `state.callbacks` in `register_device` so no callback invocation (blocking, async, or poll-driven) can observe an uninitialized token or race with the write to `*out`. - Track tokens currently running blocking enumeration in `State::enumerating` and buffer any concurrent `poll()` transitions for those tokens in `State::deferred`, draining them on the registering thread before clearing `enumerating` (and dropping them on `forget()`). This prevents `poll()` from delivering `DISCONNECTED` ahead of or concurrently with initial `CONNECTED` enumeration without holding `hub.state()` across user callbacks. - Add synthetic concurrency test `blocking_enumeration_writes_token_first_and_orders_concurrent_poll`.
Revens2 commented 2026-11-25 08:09:01 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T07:37:31Z.


Duplicate of #485: @AscilCH opened this patch 38 minutes earlier, and gh pr diff returns the same bytes for both (+156/-14 on 1 file(s), same title).

Please continue in #485 so the review history and any test data stay in one place.
Thanks.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7156070152 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/534#issuecomment-7156070152). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T07:37:31Z. --- Duplicate of #485: @AscilCH opened this patch 38 minutes earlier, and `gh pr diff` returns the same bytes for both (+156/-14 on 1 file(s), same title). Please continue in #485 so the review history and any test data stay in one place. Thanks.
Headache3318 commented 2026-11-25 10:11:11 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-25T09:24:17Z.


Independent verification: PR #534 merges cleanly onto main (310c6eb), no conflicts. Build: success (8.04s). Tests: fail due to pre-existing issue (E0433 in victory-loader for console_insn module) — identical failure on main without this PR. PR modifies only crates/victory-hle/src/modules/gameinput.rs (+156/-14) — gameinput callback token ordering fix. PR introduces no new failures. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7158283653 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/534#issuecomment-7158283653). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T09:24:17Z. --- Independent verification: PR #534 merges cleanly onto main (310c6eb), no conflicts. Build: success (8.04s). Tests: fail due to pre-existing issue (E0433 in victory-loader for console_insn module) — identical failure on main without this PR. PR modifies only crates/victory-hle/src/modules/gameinput.rs (+156/-14) — gameinput callback token ordering fix. PR introduces no new failures. Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/534:upstream-pr/534'
git switch 'upstream-pr/534'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/534'
git switch 'upstream-pr/534'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/534'
git switch 'upstream-pr/534'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/534'
git switch 'main'
git merge --squash 'upstream-pr/534'
git switch 'main'
git merge --ff-only 'upstream-pr/534'
git switch 'main'
git merge 'upstream-pr/534'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!534
No description provided.