diff -r 3a4d1b5cd05c -r dd9708ed6940 src/mem/cache/cache.cc --- a/src/mem/cache/cache.cc Wed Oct 14 13:32:28 2015 -0400 +++ b/src/mem/cache/cache.cc Mon Oct 19 15:18:48 2015 +0100 @@ -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 3a4d1b5cd05c -r dd9708ed6940 src/mem/cache/mshr.hh --- a/src/mem/cache/mshr.hh Wed Oct 14 13:32:28 2015 -0400 +++ b/src/mem/cache/mshr.hh Mon Oct 19 15:18:48 2015 +0100 @@ -282,7 +282,7 @@ bool promoteDeferredTargets(); - void handleFill(PacketPtr pkt, CacheBlk *blk); + void promoteExclusive(); bool checkFunctional(PacketPtr pkt); diff -r 3a4d1b5cd05c -r dd9708ed6940 src/mem/cache/mshr.cc --- a/src/mem/cache/mshr.cc Wed Oct 14 13:32:28 2015 -0400 +++ b/src/mem/cache/mshr.cc Mon Oct 19 15:18:48 2015 +0100 @@ -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