Wait for exiting VMM tasks and retain failed vGPU cleanup - #485
Merged
Merged
Conversation
yummybomb
marked this pull request as ready for review
September 17, 2026 17:10
yummybomb
requested review from
hiroTamada
and removed request for
sjmiller609
September 17, 2026 17:57
hiroTamada
approved these changes
Sep 18, 2026
hiroTamada
left a comment
Contributor
There was a problem hiding this comment.
reviewed the process-liveness checks, deletion ordering, and regression tests. no actionable findings.
local targeted tests could not compile because required embedded VMM and guest-agent binaries were missing; test results were not independently verified.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
QEMU's main thread can exit while a kernel worker is still releasing GPU resources. After an API restart, our fallback process check treated that as fully exited, so GPU cleanup could start too early.
If cleanup failed, delete still removed the instance metadata. That lost the record of which GPU allocation needed to be released.
What changed
wait4, which already waits for the whole group to exit.The task check covers Linux 6.4+ vhost workers, which share QEMU's thread group. Older kernels use separate kernel threads. Process-identity checks and handling of fully exited zombies are unchanged.
What callers will see
DELETE now returns an error if GPU release fails, rather than reporting success and forgetting the allocation. The existing reconciler retries the retained GPU claim; callers still need to retry DELETE to finish removing the instance.
A permanently stuck GPU leaves the instance visible. The response is still a generic 500 with no retry hint, and this PR does not add force-delete or recover allocations whose metadata was already deleted.
Testing
Passed under the race detector:
lib/devicessuite.New regressions exercise a real zombie leader with a remaining task, a separate observer taking the non-child
ECHILDpath, and failed cleanup followed by a successful delete or reconciliation from persisted metadata. These regressions fail against the old implementation.Test commands
No end-to-end GPU test was run. The earlier full instances integration run did not pass: it hit missing
mkfs.erofs, insufficient bridge/network permissions, and race reports in the umoci image-unpacking path.Independent of #484. No dependency or generated-file changes.
Automated review summary