Repository navigation
Conversation
AllocateTitlePhysicalPages assigns consecutive page numbers from a global counter (NEXT_PAGE_INDEX) even across separate allocations whose home blocks are not adjacent in virtual memory. map_pages only checked that page numbers were consecutive and that the last page had a home, so MapTitlePhysicalPages(NULL, ...) on pages from two separate allocations committed and returned the first block's home over unrelated memory next to it. Check that all pages in the slice fall within one live PHYS_BLOCKS entry (contiguous_home) with checked arithmetic before treating them as a single contiguous home block. Assisted-by: OpenCode (Gemini 4 Neon)
Owner
Author
|
Upstream PR xcl-dev#1143 was closed or merged. |
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.
AllocateTitlePhysicalPagesassigns consecutive page numbers from a global counter (NEXT_PAGE_INDEX) even across separate allocations whose home blocks are not adjacent in virtual memory (e.g. separated by another UMA allocation or falling back to plain memory).map_pagesonly checked that page numbers were consecutive and thatpages[n - 1]had a home, soMapTitlePhysicalPages(NULL, ...)on pages spanning two separate allocations committed and returned[H1, H1 + n * PHYS_PAGE), overlapping unrelated memory next to the first block.This adds
contiguous_home_in/contiguous_hometo require that all consecutive pages belong to one livePHYS_BLOCKSentry (using checked arithmetic) before treating them as a single contiguous home block.What is in it
crates/xcl/src/hle/kernelx.rs: addcontiguous_home_in/contiguous_homeand use it inmap_pages; addconsecutive_pages_from_separate_allocations_do_not_map_as_one_home(reproduces the bug before the fix and verifiesNULL+ERROR_NOT_SUPPORTEDafter) andcontiguous_home_requires_one_allocation.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 743 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib consecutive_pages_from_separate_allocations_do_not_map_as_one_homeandcontiguous_home_requires_one_allocation: both pass (first verified failing before the fix)Regression run
main:
PR:
Not tested
AI use
kernelx.rs, wrote the fix and regression tests, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Mirror of xcl-dev#1143 (auto-synced, do not edit).