LOCK ORDERING(9)
π lock ordering π
okay bestie, welcome to the kernel API manual corner of the internet π
this page is literally just called lock ordering and it's about the two locks that are lowkey the main characters of the queuing routines: the qp s_lock and the exp_lock. that's it, that's the vibe check π«Ά
π the actual tea π
so there are two locks involved with the queuing routines: the qp s_lock and the exp_lock. iconic duo, no cap β¨
here's the part where you gotta pay attention: since the tid space allocation gets called from the send engine, the qp s_lock is already held by the time you show up π not new info, just how it is β like walking in and the aux is already on.
the allocation routines will get the exp_lock. that's their whole thing. they grab it π«‘
now, the first_qp call is provided so that the head of the rcd wait queue can be fetched under the exp_lock β and then, right after, the exp_lock gets dropped. fetch under, drop after. that's the whole choreography, periodt π
and one last thing, very important, don't forget it: any qp in the wait list will have the qp reference count held β held so the qp stays in memory. literally keeping it alive, main character energy π
ngl the lock ordering here is not a suggestion, it's the whole plot. respect the plot π
β¨ SEE ALSO β¨
go read these next, they're all connected, iykyk π
- the kernel file
./drivers/infiniband/hw/hfi1/tid_rdma.c TID RDMA READ protocol(9)qp_to_rcd(9)kernel_tid_waiters(9)dequeue_tid_waiter(9)queue_qp_for_tid_wait(9)__trigger_tid_waiter(9)tid_rdma_schedule_tid_wakeup(9)tid_rdma_trigger_resume(9)kern_reserve_flow(9)tid_rdma_find_phys_blocks_4k(9)tid_flush_pages(9)tid_rdma_find_phys_blocks_8k(9)hfi1_kern_exp_rcv_setup(9)hfi1_kern_exp_rcv_free_flows(9)__trdma_clean_swqe(9)hfi1_schedule_tid_send(9)
okay that's the page!! mwah π this lil legend lives in ./drivers/infiniband/hw/hfi1 and it's dated October 2026 β yes, future girl vibes πΈ go forth and hold your locks in the right order, bestie, i believe in you π¦π
π¦ 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