Commit 9b86071c authored by Sebastian Sanchez's avatar Sebastian Sanchez Committed by Doug Ledford

IB/hfi1: Remove critical section gap in sc_buffer_alloc()

In sc_buffer_alloc(), the sc->alloc_lock is released
before calling sc_release_update(), and it is reacquired
after the function call. This causes CPU lock trading.
Fix it by not dropping the lock before calling
Reviewed-by: default avatarMike Marciniszyn <>
Signed-off-by: default avatarSebastian Sanchez <>
Signed-off-by: default avatarDennis Dalessandro <>
Signed-off-by: default avatarDoug Ledford <>
parent b777f154
......@@ -1419,9 +1419,7 @@ struct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len,
(sc->fill - sc->alloc_free);
if (blocks > avail) {
/* still no room, actively update */
spin_unlock_irqrestore(&sc->alloc_lock, flags);
spin_lock_irqsave(&sc->alloc_lock, flags);
sc->alloc_free = ACCESS_ONCE(sc->free);
goto retry;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment