DRM_PAGEMAP REFERENCE-COUNTING IN XE:(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the xe_pagemap struct derives from struct drm_pagemap and just uses its reference count. Iconic inheritance moment, no cap ✨
  • SVM-enabled VMs β€” SVM-enabled VMs look up all the xe_pagemaps on the same device and keep a reference to them. Obsessed with the loyalty fr fr πŸ’–
  • VMAs β€” vmas keep a reference on the drm_pagemap indicated by a gpu_madvise call. 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 πŸ¦‹


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