Repository navigation
tests: asahi: synchronize tbnet refill-worker teardown checks - #205
Conversation
retry-running-teardown assumes its stop thread has entered cancellation within a fixed 30 ms sleep. If the thread is not scheduled in that window, the control aborts before teardown runs. It also reads cancel_waiting without the fixture mutex. Broadcast the fixture condition when cancellation starts and wait for that event under the mutex, with a bounded two-second deadline. Keep the retry worker paused until the teardown assertions have run. A missing cancel still fails rather than timing out the entire suite. Fixes: 71700a1 ("net: thunderbolt: retry receive refill after allocation failure") Signed-off-by: Chris Kearney <303316+chriskearney@users.noreply.github.com> Generated-by: LLM
[Low impact] The PR appears safe to merge; it removes the scheduling assumption without weakening the teardown checks. SummaryThe PR replaces the fixed sleep in
Reviews (1) · Last reviewed commit: "tests: asahi: synchronize tbnet refill-w..." · Reviewed by Greptile |
maralcbr
left a comment
There was a problem hiding this comment.
@chriskearney looks right. The old control slept 30 ms and then read cancel_waiting without gate, so a slow stop thread failed the assert before teardown ran. Now cancel_delayed_work_sync() sets cancel_waiting and broadcasts cv while holding gate (tbnet-refill-fixture.h:96-106), and wait_cancel() waits for that flag under the same mutex (tbnet-refill-tests.py:59-70). So the check runs exactly when the old test meant it to: cancel has started, the paused worker is still holding up teardown, and ring_stops == 0 && pool_destroy_calls == 0.
The extra broadcast is harmless, because every other waiter on cv loops on its own condition. A missing cancel now fails at the two-second deadline, before the runner's five-second per-case timeout. The Fixes: target, 71700a1, is the commit that added this control. The other usleep controls (:94, :104-105) still use a fixed sleep. If one of them flakes, it can get the same treatment.
Approving.
b9d340b
The merge-queue run for #202 failed
retry-running-teardownat 16 KiB pages, while the build, KUnit and QEMU boot passed. This fixture and the Thunderbolt driver are unchanged by #202. The control sleeps 30 ms and then assumes the stop thread has reached cancellation; delaying that thread by 100 ms reproduces an assertion failure before teardown runs.Wait for the fixture's cancellation event under its mutex, with a two-second deadline, then check that rings and the page pool remain intact. This also removes the unlocked
cancel_waitingread. No production driver or CI acceptance-rule changes.Validation:
checkpatch --strictreports no findings on the code diff.Failing merge-queue job. The CI log identifies the case and SIGABRT; the scheduling-delay reproduction above is local evidence, not a captured CI stack trace. Implementation and validation assisted by Codex.