Avoid device memory spans in DMA address limit check - #1301
Open
tracycam wants to merge 2 commits into
Open
Conversation
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.
Problem
nv_get_max_sysmem_address()currently uses the largestnode_end_pfn()among online NUMA nodes. UVM HMM device-private ranges can stretch a node span to the physical-address ceiling even though those PFNs are not system pages available toGFP_KERNEL.On a reproduced 52-bit physical-address host:
0x3007fffffff(about 3 TiB)0xfffffffffffff0x7fffffffffff)The node-span comparison therefore selected
GFP_DMA32for ordinary NVIDIA system-memory allocations even though all allocatable RAM was reachable by the devices. Independent CUDA contexts then exhausted the small usable DMA32 pool; the fourth context failed while allocating a 96 MiB system-memory object.Fix
Compute the maximum address only from managed zones that
NV_GFP_KERNELcan allocate from:ZONE_NORMALto cover DMA, DMA32, and NormalGFP_KERNELcannot returnReal managed Normal memory above a device DMA mask still raises the limit and retains the existing DMA32 fallback. The explicit
force_dma32_allocpath is unchanged.This is the driver-side analogue of Linux commit 7170130e4c72, which prevents device-private ranges from inflating the generic
max_pfnDMA-reachability check.Validation
make modules -j120passed for current main (610.57.04) against Linux 7.0.0-29gfp=0x6dc0(GFP_DMA32bit clear)first_pfn=2138991(above 4 GiB)nv_alloc_system_pages_ret=0NV_ERR, kernel warning, or leaked test process remained after cleanupThe helper remains a lockless topology snapshot, matching the existing behavior for concurrent memory hotplug.