hwspin_lock_timeout(9)
π hwspin_lock_timeout β from the Kernel API Manual, bestie
okay so real talk: this page lives in the Kernel API Manual and it's about locking an hwspinlock but with a timeout limit so you don't just sit there forever like a clown. let's get into it π
β¨ NAME β¨
hwspin_lock_timeout β lock an hwspinlock with timeout limit πβ°
πΈ SYNOPSIS πΈ
int hwspin_lock_timeout (struct hwspinlock *hwlock , unsigned int to );
π¦ ARGUMENTS π¦
hwlockβ the hwspinlock to be locked. this is the thing you want, bestie πtoβ timeout value in msecs. yes, milliseconds, keep that energy π
π DESCRIPTION π
so this function locks the underlying hwlock. that's the whole vibe. but here's the tea: if the hwlock is already taken, the function will busy loop waiting for it to be released β except it gives up when timeout msecs have elapsed. so it's not gonna wait on it forever like some people we know π
upon a successful return from this function, preemption is disabled β so the caller must not sleep. like, at all. not even a little nap π and you're advised to release the hwspinlock as soon as possible. this is required in order to minimize remote cores polling on the hardware interconnect. no cap, that part matters π₯
it returns 0 when the hwlock was successfully taken, and an appropriate error code otherwise β most notably an -ETIMEDOUT if the hwlock is still busy after timeout msecs. and the icon behavior: the function will never sleep πβ¨
fr fr, do not sleep in there. preemption is off. it's giving "main character who cannot be interrupted."
π SEE ALSO π
kernel file ./include/linux/hwspinlock.h, plus the whole friend group:
hwspin_trylock_irqsave(9)hwspin_trylock_irq(9)hwspin_trylock_raw(9)hwspin_trylock_in_atomic(9)hwspin_trylock(9)hwspin_lock_timeout_irqsave(9)hwspin_lock_timeout_irq(9)hwspin_lock_timeout_raw(9)hwspin_lock_timeout_in_atomic(9)hwspin_unlock_irqrestore(9)hwspin_unlock_irq(9)hwspin_unlock_raw(9)hwspin_unlock_in_atomic(9)hwspin_unlock(9)
that's the whole page, mwah π this one's brought to you by ./include/linux and dated October 2026 β go off, kernel docs π«Άβ
π¦ 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