DRM_PAGEMAP REFERENCE-COUNTING IN XE:(9)
π
drm_pagemap reference-counting in xe:(9) π
okay bestie, this one's straight out of the Kernel API Manual and it's literally all about who's holding a reference to what, so nobody's memory gets freed while it's still main character energy π
So here's the tea β: the drm_pagemap already does its own internal reference counting through its zone device data β that part's handled, no notes. But on top of that, the xe driver is out here holding the following long-time references, and you need to know about every single one π«Ά
struct xe_pagemapβ thexe_pagemapstruct derives fromstruct drm_pagemapand just uses its reference count. Iconic inheritance moment, no cap β¨- SVM-enabled VMs β SVM-enabled VMs look up all the
xe_pagemapson the same device and keep a reference to them. Obsessed with the loyalty fr fr π - VMAs β vmas keep a reference on the
drm_pagemapindicated by agpu_madvisecall. That's the whole vibe πΈ
And lowkey the big one π: in addition, all drm_pagemap or xe_pagemap pointers where the lifetime cannot be guaranteed by a vma reference under the vm lock should keep a reference. That includes the range->pages.dpagemap pointer β yes, that one too, don't skip it bestie, it's giving "tiny detail that will absolutely wreck your day if you ignore it" π
π¨ reminder: "cannot be guaranteed by a vma reference under the vm lock" means keep a reference. Not a suggestion, it's a vibe check you have to pass π
β¨ SEE ALSO β¨
Kernel file ./drivers/gpu/drm/xe/xe_svm.c plus this whole friend group of functions β go say hi, they're all linked together for a reason π¦
xe_svm_init(9)xe_svm_close(9)xe_svm_fini(9)xe_svm_range_validate(9)xe_svm_find_vma_start(9)xe_svm_range_needs_migrate_to_vram(9)xe_svm_handle_pagefault(9)xe_svm_has_mapping(9)xe_svm_unmap_address_range(9)xe_svm_bo_evict(9)xe_svm_range_find_or_insert(9)xe_svm_range_get_pages(9)xe_svm_ranges_zap_ptes_in_range(9)xe_vma_resolve_pagemap(9)xe_svm_alloc_vram(9)xe_pagemap_create(9)xe_pagemap_find_or_create(9)xe_pagemap_shrinker_create(9)xe_pagemap_cache_create(9)xe_drm_pagemap_from_fd(9)xe_svm_flush(9)
okay that's the whole page, you ate that π this came from ./drivers/gpu/drm/xe and it's dated October 2026 β go forth and please keep your references alive, mwah ππ§
π¦ 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