mem-cache: Fix double block invalidation
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Fri, 26 Oct 2018 14:40:51 +0000 (16:40 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Mon, 5 Nov 2018 13:35:00 +0000 (13:35 +0000)
Block was being invalidated twice when not a tempBlock.
Make explicit that the else case is only to be applied
when handling the tempBlock, as otherwise the Tags
should be taking care of the invalidation.

Change-Id: Ie7603fdbe156c54e94bbdc83541b55e66f8d250f
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/13895
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

src/mem/cache/base.cc

index 7bb0e0fdbf7c17832522f77c3cb9e5f63bea482f..6f3914ccde2c702e41d4ed9845b5ae3b1c6af757 100644 (file)
@@ -1305,9 +1305,13 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks)
 void
 BaseCache::invalidateBlock(CacheBlk *blk)
 {
-    if (blk != tempBlock)
+    // If handling a block present in the Tags, let it do its invalidation
+    // process, which will update stats and invalidate the block itself
+    if (blk != tempBlock) {
         tags->invalidate(blk);
-    blk->invalidate();
+    } else {
+        tempBlock->invalidate();
+    }
 }
 
 void