ib_umem_get_attr_or_va(9)
π ib_umem_get_attr_or_va β the Kernel API Manual, bestie edition π
okay so this one lives in the Kernel API Manual (ib_umem_get_attr_or_va(9)) and it's basically the chill friend of ib_umem_get_attr that will also pin your addr/size when nobody handed it a per-command UMEM attribute. sit down, grab a boba, we're doing this β¨
β¨ SYNOPSIS β¨
struct ib_umem * ib_umem_get_attr_or_va (struct ib_device *device ,
const struct uverbs_attr_bundle *attrs , u16 attr_id , u64 addr , size_t
size , int access );
π ARGUMENTS π
deviceβ your IB device. the main character of the operation fr.attrsβ the uverbs attribute bundle. heads up: this one may beNULL. no cap.attr_idβ the per-command UMEM attribute id. this is the one we go looking for first π΅οΈββοΈaddrβ the UHW user VA. we only reach for this when no per-command attribute matched, iykyk.sizeβ and here's the β¨double lifeβ¨: on the attr / legacy paths it's the minimum required umem length validated post-pin; on the VA fallback path it's the length to pin. two jobs, one parameter, she's booked and busy πaccessβ the IB access flags. slay.
π¦ DESCRIPTION π¦
okay so it's literally like ib_umem_get_attr, except when no per-command UMEM attribute is supplied, it goes ahead and pins addr/size itself. iconic behavior tbh π«Ά
IMPORTANT: size is always consumed. like, always always. on the attr / legacy paths it's used as the post-pin minimum-length check; on the VA fallback path it's the length to pin. so callers MUST pass a meaningful, validated value β even when they fully expect an attribute-supplied buffer to be the one that gets used. do not be cute and pass garbage, bestie π
so here's the tea on size π: every in-tree caller passes the same value for the two roles of size, and that's only because no driver today distinguishes a user-passed buffer length from a driver-computed minimum. that's not a flex, that's just how it is rn.
and the drivers that currently accept a user-supplied length without cross-checking it against a driver minimum? let's name names π β vmw_pvrdma CQ/QP/SRQ, qedr CQ/QP/SRQ, mana WQ/QP, ionic CQ/QP. once any of those get tightened to compute and check a real minimum, they're gonna want to introduce a separate helper that passes these as distinct values. manifesting that refactor for them π
π RETURN π
- success β a caller-owned umem π (yes, you own it, don't forget
ib_umem_release(9)vibes) - error β
ERR_PTR(...)π
πΈ SEE ALSO πΈ
Kernel file ./drivers/infiniband/core/umem.c plus the whole squad:
ib_umem_find_best_pgsz(9)ib_umem_get_desc(9)ib_umem_get_attr(9)ib_umem_get_cq_buf(9)ib_umem_get_cq_buf_or_va(9)ib_umem_release(9)
π that's the whole page, bestie, you ate that π
cute little sign-off: this one's from ./drivers/infiniband/core, dated October 2026, and it's the ib_umem_get_attr_or_va(9) page β go pin something responsibly π§ββοΈβ
π¦ 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