cpu: Fix barrier push to store buffer when full bug in Minor
authorAndrew Bardsley <Andrew.Bardsley@arm.com>
Thu, 30 Oct 2014 04:18:24 +0000 (23:18 -0500)
committerAndrew Bardsley <Andrew.Bardsley@arm.com>
Thu, 30 Oct 2014 04:18:24 +0000 (23:18 -0500)
This patch fixes a bug where a completing load or store which is also a
barrier can push a barrier into the store buffer without first checking
that there is a free slot.

The bug was not fatal but would print a warning that the store buffer
was full when inserting.

src/cpu/minor/lsq.cc

index 0a473af89b7544fb4b80e91f051e28660db86b6b..cae0d36666bea16964a93437fa47ebc5ed9e5ed4 100644 (file)
@@ -1370,9 +1370,13 @@ LSQ::findResponse(MinorDynInstPtr inst)
         /* Same instruction and complete access or a store that's
          *  capable of being moved to the store buffer */
         if (request->inst->id == inst->id) {
-            if (request->isComplete() ||
-                (request->state == LSQRequest::StoreToStoreBuffer &&
-                storeBuffer.canInsert()))
+            bool complete = request->isComplete();
+            bool can_store = storeBuffer.canInsert();
+            bool to_store_buffer = request->state ==
+                LSQRequest::StoreToStoreBuffer;
+
+            if ((complete && !(request->isBarrier() && !can_store)) ||
+                (to_store_buffer && can_store))
             {
                 ret = request;
             }