From: Sebastian Sanchez Date: Thu, 8 Dec 2016 03:33:33 +0000 (-0800) Subject: IB/hfi1: Remove critical section gap in sc_buffer_alloc() X-Git-Tag: v4.10-rc1~97^2~3^2~15 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9b86071c5ef7a8c0a0d6d541cb79df5a8b115d91;p=karo-tx-linux.git 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 sc_release_update(). Reviewed-by: Mike Marciniszyn Signed-off-by: Sebastian Sanchez Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford --- diff --git a/drivers/infiniband/hw/hfi1/pio.c b/drivers/infiniband/hw/hfi1/pio.c index 86a7f365b624..75c4dea84c4b 100644 --- a/drivers/infiniband/hw/hfi1/pio.c +++ b/drivers/infiniband/hw/hfi1/pio.c @@ -1419,9 +1419,7 @@ retry: (sc->fill - sc->alloc_free); if (blocks > avail) { /* still no room, actively update */ - spin_unlock_irqrestore(&sc->alloc_lock, flags); sc_release_update(sc); - spin_lock_irqsave(&sc->alloc_lock, flags); sc->alloc_free = ACCESS_ONCE(sc->free); trycount++; goto retry;