drm_gpusvm_unmap_pages(9)
π drm_gpusvm_unmap_pages(9) β from the Kernel API Manual, bestie β¨
okay so picture this: you're deep in drivers/gpu/drm, it's late, and you need to unmap some GPU SVM pages. this is that page. the function is drm_gpusvm_unmap_pages, and yes it's a kernel API manual entry, and yes we're gonna get through it together π«Ά
β¨ NAME β¨
drm_gpusvm_unmap_pages β literally just unmaps GPU svm pages π
no cap, that's the whole job
πΈ SYNOPSIS πΈ
void drm_gpusvm_unmap_pages (struct drm_gpusvm *gpusvm , struct
drm_gpusvm_pages *svm_pages , unsigned long npages , const struct
drm_gpusvm_ctx *ctx );
returns void, takes four things, that's the vibe π
π ARGUMENTS π
gpusvmβ pointer to the GPU SVM structure. iconic. it's the whole world this function lives in β¨svm_pagesβ pointer to the GPU SVM pages structure. the actual pages-containing little guy π¦npagesβ number of pages insvm_pages. like, how many. counting matters, bestie π₯ctxβ GPU SVM context. theconstone. we respect it π
π DESCRIPTION π
so this function unmaps pages associated with a GPU SVM pages struct. that's the main character move π―
now here's the part where you gotta pay attention, because it's giving important:
if in_notifier is set, it is assumed that gpusvm->notifier_lock is held in write mode. if it's clear, it acquires gpusvm->notifier_lock in read mode. two different lock situations, and you do NOT get to vibe-check your way past it π
β οΈ and this one's non-negotiable: it must be called in the invalidate callback of the corresponding notifier for the IOMMU security model. like, must must. not "eh probably". fr fr π
π SEE ALSO π
okay this list is LONG, so buckle up, we're going through all of it, no skipping, i love you but i'm not summarising 40+ entries π
- Kernel file
./drivers/gpu/drm/drm_gpusvm.c Overview(9)Locking(9)Partial Unmapping of Ranges(9)Examples(9)npages_in_range(9)drm_gpusvm_notifier_find(9)drm_gpusvm_range_find(9)drm_gpusvm_notifier_invalidate(9)drm_gpusvm_init(9)to_drm_gpusvm_notifier(9)drm_gpusvm_notifier_insert(9)drm_gpusvm_notifier_remove(9)drm_gpusvm_fini(9)drm_gpusvm_notifier_alloc(9)drm_gpusvm_notifier_free(9)to_drm_gpusvm_range(9)drm_gpusvm_range_insert(9)__drm_gpusvm_range_remove(9)drm_gpusvm_range_alloc(9)drm_gpusvm_hmm_pfn_to_order(9)drm_gpusvm_check_pages(9)drm_gpusvm_scan_mm(9)drm_gpusvm_range_chunk_size(9)drm_gpusvm_driver_lock_held(9)drm_gpusvm_find_vma_start(9)drm_gpusvm_range_find_or_insert(9)__drm_gpusvm_unmap_pages(9)__drm_gpusvm_free_pages(9)drm_gpusvm_free_pages(9)drm_gpusvm_range_remove(9)drm_gpusvm_range_get(9)drm_gpusvm_range_destroy(9)drm_gpusvm_range_put(9)drm_gpusvm_pages_valid(9)drm_gpusvm_pages_valid_unlocked(9)drm_gpusvm_get_pages(9)drm_gpusvm_range_evict(9)drm_gpusvm_has_mapping(9)drm_gpusvm_range_set_unmapped(9)
and that's the page, bestie π go forth and unmap responsibly π§
π source path ./drivers/gpu/drm, dated October 2026 β that's the sign-off, mwah, slay, periodt π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms