From 4920f0d7e5a4c29ada074bf3a73f36510e138016 Mon Sep 17 00:00:00 2001 From: Mitch Hayenga Date: Wed, 27 Mar 2013 18:36:09 -0500 Subject: [PATCH] mem: Fix cache latency bug Fixes a latency calculation bug for accesses during a cache line fill. Under a cache miss, before the line is filled, accesses to the cache are associated with a MSHR and marked as targets. Once the line fill completes, MSHR target packets pay an additional latency of "responseLatency + busSerializationLatency". However, the "whenReady" field of the cache line is only set to an additional delay of "busSerializationLatency". This lacks the responseLatency component of the fill. It is possible for accesses that occur on the cycle of (or briefly after) the line fill to respond without properly paying the responseLatency. This also creates the situation where two accesses to the same address may be serviced in an order opposite of how they were received by the cache. For stores to the same address, this means that although the cache performs the stores in the order they were received, acknowledgements may be sent in a different order. Adding the responseLatency component to the whenReady field preserves the penalty that should be paid and prevents these ordering issues. Committed by: Nilay Vaish --- src/mem/cache/cache_impl.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 2be41642d..68b86b121 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1242,7 +1242,8 @@ Cache::handleFill(PacketPtr pkt, BlkType *blk, std::memcpy(blk->data, pkt->getPtr(), blkSize); } - blk->whenReady = curTick() + pkt->busLastWordDelay; + blk->whenReady = curTick() + responseLatency * clockPeriod() + + pkt->busLastWordDelay; return blk; } -- 2.30.2