From 872cb227fdc0b4d60acc7840889d567a6936b6e1 Mon Sep 17 00:00:00 2001 From: Tommaso Marinelli Date: Sat, 30 May 2020 06:45:15 +0200 Subject: [PATCH] mem-cache: prevent prefetcher from saturating the write buffer When the write buffer is full, it still has space to store an additional number of entries (reserve) equal to the number of MSHRs so that if any of them requires a writeback this can be handled. Even if the slave port is blocked, a prefetcher can generate new MSHR entries that may lead to additional writebacks and eventually saturate the reserve space. This is solved by checking if the cache is blocked for accesses before prefetching data. Change-Id: Iaad04dd6786a09eab7afae4a53d1b1299c341f33 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29615 Reviewed-by: Daniel Carvalho Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- src/mem/cache/base.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 1e16008f6..018770332 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -514,7 +514,7 @@ BaseCache::recvTimingResp(PacketPtr pkt) // Request the bus for a prefetch if this deallocation freed enough // MSHRs for a prefetch to take place - if (prefetcher && mshrQueue.canPrefetch()) { + if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) { Tick next_pf_time = std::max(prefetcher->nextPrefetchReadyTime(), clockEdge()); if (next_pf_time != MaxTick) @@ -764,7 +764,7 @@ BaseCache::getNextQueueEntry() // fall through... no pending requests. Try a prefetch. assert(!miss_mshr && !wq_entry); - if (prefetcher && mshrQueue.canPrefetch()) { + if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) { // If we have a miss queue slot, we can try a prefetch PacketPtr pkt = prefetcher->getPacket(); if (pkt) { @@ -1643,7 +1643,7 @@ BaseCache::nextQueueReadyTime() const // Don't signal prefetch ready time if no MSHRs available // Will signal once enoguh MSHRs are deallocated - if (prefetcher && mshrQueue.canPrefetch()) { + if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) { nextReady = std::min(nextReady, prefetcher->nextPrefetchReadyTime()); } -- 2.30.2