drm_gpuvm_for_each_va_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– drm_gpuvm_for_each_va_range(9) β€” the Kernel API Manual entry you didn't know you needed πŸ’–

okay bestie, so this is a page from the Kernel API Manual and it's about a macro-iterator situation β€” drm_gpuvm_for_each_va_range β€” and honestly it's giving "loops but make it fancy" ✨ stay with me, we're gonna walk through it together 🫢


🌸 NAME 🌸

drm_gpuvm_for_each_va_range β€” literally iterate over a range of &drm_gpuvas, that's the whole vibe πŸ’…


✨ SYNOPSIS ✨

drm_gpuvm_for_each_va_range (va__ , gpuvm__ , start__ , end__ );

four little args, no cap πŸŽ€


πŸŽ€ ARGUMENTS πŸŽ€

  • va__ β€” the drm_gpuva structure you assign to on each iteration step, like it gets refreshed every loop around the block πŸ”
  • gpuvm__ β€” the drm_gpuvm you're walking over, your main character 🌟
  • start__ β€” the starting offset; the first gpuva will overlap this, she doesn't start after it, she overlaps it πŸ’«
  • end__ β€” the ending offset; the last gpuva will start before this (but may overlap it, so don't come for her 😌)

πŸ¦‹ DESCRIPTION πŸ¦‹

so this iterator walks over all the drm_gpuvas in the drm_gpuvm that lie between start__ and end__ β€” and it's implemented similarly to list_for_each, but plot twist: it's using the drm_gpuvm's internal interval tree to accelerate the search for the starting drm_gpuva 🌈 iconic behaviour honestly.

⚠️ and because of all that, it isn't safe against removal of elements β€” do NOT be out here deleting stuff mid-loop, that's not the move 😭

it assumes that end__ is within (or is the upper limit of) the drm_gpuvm, so like, read the room and pass a valid end__ fr fr.

one more thing bestie: this iterator does not skip over the drm_gpuvm's kernel_alloc_node πŸ™ˆ it's in the mix, no exceptions, periodt.


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/drm/drm_gpuvm.h, plus the whole extended friend group β€” every single one of them, no gatekeeping πŸ‘‘


πŸ‘‘ sign-off πŸ‘‘

this lil masterpiece lives in ./include/drm, dated October 2026, and it's drm_gpuvm_for_each_va_range(9) from the Kernel API Manual β€” go read the docs bestie, ily, bye πŸ’œπŸ§šπŸ“

πŸ“¦ where this page comes from