Add Linux Kernel 7.2 support - #1227
Closed
ThePedroo wants to merge 3 commits into
Closed
Conversation
This commit replaces all usages of "strncpy" to use "strscpy". Since Linux 7.2-rc.1, "strncpy" has been fully removed from the source, and cannot be used by drivers anymore (see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a3746ccbb0a97bed3c06ccde6b880013b1dddc1). We also replace one of the "strncpy" for "memcpy", since "strscpy" is not suitable either here, due to always NUL terminate.
This commit addresses the rename (see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5164f7e7ff8e) by adding a new conftest to see if it was renamed, and if so, use it.
…_version` This commit fixes a bug introduced by the previous strncpy→strscpy conversion in nvswitch.c. The `strscpy` call was incorrectly passed `VERSION_LENGTH` (which is `strlen(NV_VERSION_STRING)` without the NUL terminator) as the destination buffer size. `strscpy` expects the full buffer size including space for the NUL terminator, so the version string was silently truncated by one character, causing the version compatibility check to always fail. Fix it by passing `length` (the caller-provided buffer size) instead.
|
610.57.04 has the fixes for both missing strscpy and drm_atomic_state |
Author
|
Yeah, they kinda just forget PRs and let them rot. Very embarrassing. |
plopresti
added a commit
to plopresti/open-gpu-kernel-modules
that referenced
this pull request
Aug 5, 2026
nv_alloc_system_pages() sets pages to UC only after the whole array is allocated. On an out-of-memory partial allocation it jumps to failed: -> nv_free_system_pages() before that, which then calls nv_set_memory_type(at, NV_MEMORY_WRITEBACK) based on the requested at->cache_type. nv_set_memory_type() iterates over all at->num_pages with no unallocated-slot guard, unlike the two loops in nv_free_system_pages() that break at page_ptr->virt_addr == 0. For a large descriptor that failed early, most slots are unallocated (phys_addr == 0), so NV_GET_PAGE_STRUCT(0) yields PFN 0 and set_memory_wb()/ set_memory_array_wb() is invoked on [0x0-0xfff] once per slot. This floods the kernel log with "x86/PAT: freeing invalid memtype [mem 0x0-0xfff]" and spins in an O(num_pages) TLB-flushing loop while holding the RM API write lock (rmapiLockAcquire in serverAllocResource), deadlocking all other threads until reboot. Bound the cache-type reset to actually-allocated pages by breaking at the first virt_addr == 0, mirroring the existing guards in nv_free_system_pages(). Fully-allocated frees are unaffected; an OOM now returns NV_ERR_NO_MEMORY cleanly instead of wedging the system. Fixes NVIDIA#1227 Signed-off-by: Patrick LoPresti <lopresti@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.
This PR replaces
strncpywithstrscpy(removed in 7.2 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a3746ccbb0a97bed3c06ccde6b880013b1dddc1) and adds a conftest to handle a 7.2 commit (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5164f7e7ff8e) also renamingdrm_atomic_statetodrm_atomic_commit.One of
strncpywas replaced with memcpy as it is more appropriate thanstrscpy.