From f89fe7049d3ae91835bf3c5da72462b60e35d095 Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Sat, 2 Jun 2018 14:51:59 +0200 Subject: mem-cache: Move tagsInUse to children Move tagsInUse to children, as sector caches have different tag invalidation and insertion, and thus they must handle updating this variable. Change-Id: I875c9b7364a909c76daf610d1e226c4e82063870 Reviewed-on: https://gem5-review.googlesource.com/10721 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris --- src/mem/cache/tags/base.cc | 1 - src/mem/cache/tags/base.hh | 1 - src/mem/cache/tags/base_set_assoc.cc | 3 +++ src/mem/cache/tags/base_set_assoc.hh | 7 +++++-- src/mem/cache/tags/fa_lru.cc | 7 ++++++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc index 13e1245c6..caed594b8 100644 --- a/src/mem/cache/tags/base.cc +++ b/src/mem/cache/tags/base.cc @@ -99,7 +99,6 @@ BaseTags::insertBlock(PacketPtr pkt, CacheBlk *blk) blk->insert(extractTag(addr), pkt->isSecure(), master_id, pkt->req->taskId()); - tagsInUse++; if (!warmedUp && tagsInUse.value() >= warmupBound) { warmedUp = true; warmupCycle = curTick(); diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index 27771982a..0cc79020d 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -253,7 +253,6 @@ class BaseTags : public ClockedObject assert(blk); assert(blk->isValid()); - tagsInUse--; occupancies[blk->srcMasterId]--; totalRefs += blk->refCount; sampledRefs++; diff --git a/src/mem/cache/tags/base_set_assoc.cc b/src/mem/cache/tags/base_set_assoc.cc index ae98dcf3d..18da53273 100644 --- a/src/mem/cache/tags/base_set_assoc.cc +++ b/src/mem/cache/tags/base_set_assoc.cc @@ -113,6 +113,9 @@ BaseSetAssoc::invalidate(CacheBlk *blk) { BaseTags::invalidate(blk); + // Decrease the number of tags in use + tagsInUse--; + // Invalidate replacement data replacementPolicy->invalidate(blk->replacementData); } diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index d19a00ed9..b41c3096c 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -122,8 +122,8 @@ class BaseSetAssoc : public BaseTags virtual ~BaseSetAssoc() {}; /** - * This function updates the tags when a block is invalidated but does - * not invalidate the block itself. It also updates the replacement data. + * This function updates the tags when a block is invalidated. It also + * updates the replacement data. * * @param blk The block to invalidate. */ @@ -252,6 +252,9 @@ class BaseSetAssoc : public BaseTags // Insert block BaseTags::insertBlock(pkt, blk); + // Increment tag counter + tagsInUse++; + // Update replacement policy replacementPolicy->reset(blk->replacementData); } diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index 8eab62845..b5950f6cf 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -122,6 +122,9 @@ FALRU::invalidate(CacheBlk *blk) { BaseTags::invalidate(blk); + // Decrease the number of tags in use + tagsInUse--; + // Move the block to the tail to make it the next victim moveToTail((FALRUBlk*)blk); @@ -169,7 +172,6 @@ FALRU::accessBlock(Addr addr, bool is_secure, Cycles &lat, return blk; } - CacheBlk* FALRU::findBlock(Addr addr, bool is_secure) const { @@ -215,6 +217,9 @@ FALRU::insertBlock(PacketPtr pkt, CacheBlk *blk) // Do common block insertion functionality BaseTags::insertBlock(pkt, blk); + // Increment tag counter + tagsInUse++; + // New block is the MRU moveToHead(falruBlk); -- cgit v1.2.3