summaryrefslogtreecommitdiff
path: root/src/mem/cache
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-10-04 10:53:12 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-10-05 18:42:49 +0000
commit027a14087ddd37836693ab919ce44a4ecfad5db6 (patch)
treebafc49462ec58040756cf63f2ec9f3fa6bc1852c /src/mem/cache
parente2c8d06289354b539358c2425c28f2939d3ddf48 (diff)
downloadgem5-027a14087ddd37836693ab919ce44a4ecfad5db6.tar.xz
mem-cache: Fix FALRU hash invalidation
The block was being invalidated before the hash could erase its entry, therefore it was using invalid values (tag was being assigned MaxAddr and the secure bit was reset). This change reorders the calls, so that the appropriate hash entry is erased. Change-Id: I161463df0f8f5220179bc68d7be12051e5390d01 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/13210 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache')
-rw-r--r--src/mem/cache/tags/fa_lru.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index 604bd7d07..51f360eb4 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2018 Inria
* Copyright (c) 2013,2016-2018 ARM Limited
* All rights reserved.
*
@@ -39,6 +40,7 @@
*
* Authors: Erik Hallnor
* Nikos Nikoleris
+ * Daniel Carvalho
*/
/**
@@ -110,6 +112,13 @@ FALRU::regStats()
void
FALRU::invalidate(CacheBlk *blk)
{
+ // Erase block entry reference in the hash table
+ auto num_erased = tagHash.erase(std::make_pair(blk->tag, blk->isSecure()));
+
+ // Sanity check; only one block reference should be erased
+ assert(num_erased == 1);
+
+ // Invalidate block entry. Must be done after the hash is erased
BaseTags::invalidate(blk);
// Decrease the number of tags in use
@@ -117,9 +126,6 @@ FALRU::invalidate(CacheBlk *blk)
// Move the block to the tail to make it the next victim
moveToTail((FALRUBlk*)blk);
-
- // Erase block entry in the hash table
- tagHash.erase(std::make_pair(blk->tag, blk->isSecure()));
}
CacheBlk*