fix(core): restore access descriptors when a VMM grow rolls back - #2440
Open
aryanputta wants to merge 2 commits into
Open
fix(core): restore access descriptors when a VMM grow rolls back#2440aryanputta wants to merge 2 commits into
aryanputta wants to merge 2 commits into
Conversation
The slow-path rollback in modify_allocation remapped the old physical memory to its original address but never reapplied the access descriptors that the preceding unmap dropped, so a buffer recovered by a failed grow faulted on its next access until cuMemSetAccess was run again. Hoist the descriptor list above the transaction so the rollback applies the same descriptors the forward path does, and reapply them to the old range after the remap succeeds. Defect 1 of NVIDIA#2388. Signed-off-by: Aryan <aryansputta@gmail.com>
Contributor
Signed-off-by: Aryan <aryansputta@gmail.com>
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.
Description
Defect 1 of #2388, continuing the per-defect split from #2407 (defect 2) and #2418 (defect 4).
_grow_allocation_slow_path()unmaps the old VA range before remapping the physical memory into the new reservation. Access permissions live on the mapping, so that unmap drops the resource's access descriptors. The_remap_oldrollback restored the mapping but not the descriptors, so a buffer recovered from a failed grow was mapped and yet not accessible: it faulted on its next access untilcuMemSetAccesswas run again._remap_oldnow reapplies the access descriptors to the old range after the remap succeeds. It stays inside the same best-efforttry, so a failure while restoring access cannot mask the error that triggered the rollback.The descriptor list is now built once above the transaction and shared by the forward path and the rollback, rather than built only at the point of use near the end. The rollback restores exactly the descriptors the grow was in the middle of applying, and there is one source of truth for them.
Test
test_vmm_allocator_grow_slow_path_rollback_restores_accessfailscuMemSetAccessover the new range to drive the transaction into rollback, then asserts that the old range is remapped, that its access is reapplied, that the two happen in that order, and that the failed reservation is still freed. Reverting the three added lines fails the test on the restored-access assertion.Checks
ruff check,ruff formatmypy-cuda-corecython-lint,stubgen-pyxlychee, SPDX headers, rst hooks