changeset 524c44cf8278 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=524c44cf8278
description:
mem: Clarify cache MSHR handling on fill
This patch addresses the upgrading of deferred targets in the MSHR,
and makes it clearer by explicitly calling out what is happening
(deferred targets are promoted if we get exclusivity without asking
for it).
diffstat:
src/mem/cache/cache.cc | 16 ++++++++++------
src/mem/cache/mshr.cc | 7 +++----
src/mem/cache/mshr.hh | 2 +-
3 files changed, 14 insertions(+), 11 deletions(-)
diffs (78 lines):
diff -r 741b3059946e -r 524c44cf8278 src/mem/cache/cache.cc
--- a/src/mem/cache/cache.cc Sun Oct 25 16:01:52 2015 -0700
+++ b/src/mem/cache/cache.cc Thu Oct 29 08:48:20 2015 -0400
@@ -1190,7 +1190,6 @@
// Initial target is used just for stats
MSHR::Target *initial_tgt = mshr->getTarget();
- CacheBlk *blk = tags->findBlock(pkt->getAddr(), pkt->isSecure());
int stats_cmd_idx = initial_tgt->pkt->cmdToIndex();
Tick miss_latency = curTick() - initial_tgt->recvTime;
PacketList writebacks;
@@ -1212,16 +1211,20 @@
miss_latency;
}
+ // upgrade deferred targets if we got exclusive
+ if (!pkt->sharedAsserted()) {
+ mshr->promoteExclusive();
+ }
+
bool is_fill = !mshr->isForward &&
(pkt->isRead() || pkt->cmd == MemCmd::UpgradeResp);
+ CacheBlk *blk = tags->findBlock(pkt->getAddr(), pkt->isSecure());
+
if (is_fill && !is_error) {
DPRINTF(Cache, "Block for addr %#llx being updated in Cache\n",
pkt->getAddr());
- // give mshr a chance to do some dirty work
- mshr->handleFill(pkt, blk);
-
blk = handleFill(pkt, blk, writebacks);
assert(blk != NULL);
}
@@ -1262,9 +1265,10 @@
// from above.
if (tgt_pkt->cmd == MemCmd::WriteLineReq) {
assert(!is_error);
-
+ // we got the block in exclusive state, so promote any
+ // deferred targets if possible
+ mshr->promoteExclusive();
// NB: we use the original packet here and not the response!
- mshr->handleFill(tgt_pkt, blk);
blk = handleFill(tgt_pkt, blk, writebacks);
assert(blk != NULL);
diff -r 741b3059946e -r 524c44cf8278 src/mem/cache/mshr.cc
--- a/src/mem/cache/mshr.cc Sun Oct 25 16:01:52 2015 -0700
+++ b/src/mem/cache/mshr.cc Thu Oct 29 08:48:20 2015 -0400
@@ -430,11 +430,10 @@
void
-MSHR::handleFill(PacketPtr pkt, CacheBlk *blk)
+MSHR::promoteExclusive()
{
- if (!pkt->sharedAsserted()
- && !(hasPostInvalidate() || hasPostDowngrade())
- && deferredTargets.needsExclusive) {
+ if (deferredTargets.needsExclusive &&
+ !(hasPostInvalidate() || hasPostDowngrade())) {
// We got an exclusive response, but we have deferred targets
// which are waiting to request an exclusive copy (not because
// of a pending invalidate). This can happen if the original
diff -r 741b3059946e -r 524c44cf8278 src/mem/cache/mshr.hh
--- a/src/mem/cache/mshr.hh Sun Oct 25 16:01:52 2015 -0700
+++ b/src/mem/cache/mshr.hh Thu Oct 29 08:48:20 2015 -0400
@@ -282,7 +282,7 @@
bool promoteDeferredTargets();
- void handleFill(PacketPtr pkt, CacheBlk *blk);
+ void promoteExclusive();
bool checkFunctional(PacketPtr pkt);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev