IB/hfi1: Remove critical section gap in sc_buffer_alloc()
authorSebastian Sanchez <sebastian.sanchez@intel.com>
Thu, 8 Dec 2016 03:33:33 +0000 (19:33 -0800)
committerDoug Ledford <dledford@redhat.com>
Sun, 11 Dec 2016 20:29:42 +0000 (15:29 -0500)
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 <mike.marciniszyn@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/pio.c

index 86a7f365b62481cc92ead966653feb7a47d66cf2..75c4dea84c4bf99f919be48ea817ce59b73aa797 100644 (file)
@@ -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;