changeset fbd597034299 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=fbd597034299
description:
mem: Add snoop filters to L2 crossbars, and check size
This patch adds a snoop filter to the L2XBar. For now we refrain from
globally adding a snoop filter to the SystemXBar, since the latter is
also used in systems without caches. In scenarios without caches the
snoop filter will not see any writeback/clean evicts from the CPU
ports, despite the fact that they are snooping. To avoid inadvertent
use of the snoop filter in these cases we leave it out for now.
A size check is added to the snoop filter, merely to ensure it does
not grow beyond the total capacity of the caches above it. The size
has to be set manually, and a value of 8 MByte is choosen as suitably
high default.
diffstat:
src/mem/XBar.py | 8 ++++++++
src/mem/snoop_filter.cc | 4 ++++
src/mem/snoop_filter.hh | 5 ++++-
3 files changed, 16 insertions(+), 1 deletions(-)
diffs (61 lines):
diff -r 22e739752f47 -r fbd597034299 src/mem/XBar.py
--- a/src/mem/XBar.py Fri Sep 25 07:26:57 2015 -0400
+++ b/src/mem/XBar.py Fri Sep 25 07:26:57 2015 -0400
@@ -112,6 +112,9 @@
system = Param.System(Parent.any, "System that the crossbar belongs to.")
+ # Sanity check on max capacity to track, adjust if needed.
+ max_capacity = Param.MemorySize('8MB', "Maximum capacity of snoop filter")
+
# We use a coherent crossbar to connect multiple masters to the L2
# caches. Normally this crossbar would be part of the cache itself.
class L2XBar(CoherentXBar):
@@ -125,6 +128,11 @@
response_latency = 1
snoop_response_latency = 1
+ # Use a snoop-filter by default, and set the latency to zero as
+ # the lookup is assumed to overlap with the frontend latency of
+ # the crossbar
+ snoop_filter = SnoopFilter(lookup_latency = 0)
+
# One of the key coherent crossbar instances is the system
# interconnect, tying together the CPU clusters, GPUs, and any I/O
# coherent masters, and DRAM controllers.
diff -r 22e739752f47 -r fbd597034299 src/mem/snoop_filter.cc
--- a/src/mem/snoop_filter.cc Fri Sep 25 07:26:57 2015 -0400
+++ b/src/mem/snoop_filter.cc Fri Sep 25 07:26:57 2015 -0400
@@ -184,6 +184,10 @@
auto sf_it = cachedLocations.find(line_addr);
bool is_hit = (sf_it != cachedLocations.end());
+ panic_if(!is_hit && (cachedLocations.size() >= maxEntryCount),
+ "snoop filter exceeded capacity of %d cache blocks\n",
+ maxEntryCount);
+
// If the snoop filter has no entry and its an uncacheable
// request, do not create a new snoop filter entry, simply return
// a NULL portlist.
diff -r 22e739752f47 -r fbd597034299 src/mem/snoop_filter.hh
--- a/src/mem/snoop_filter.hh Fri Sep 25 07:26:57 2015 -0400
+++ b/src/mem/snoop_filter.hh Fri Sep 25 07:26:57 2015 -0400
@@ -90,7 +90,8 @@
SnoopFilter (const SnoopFilterParams *p) :
SimObject(p), reqLookupResult(cachedLocations.end()), retryItem{0, 0},
- linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency)
+ linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency),
+ maxEntryCount(p->max_capacity / p->system->cacheLineSize())
{
}
@@ -254,6 +255,8 @@
const unsigned linesize;
/** Latency for doing a lookup in the filter */
const Cycles lookupLatency;
+ /** Max capacity in terms of cache blocks tracked, for sanity checking */
+ const unsigned maxEntryCount;
/** Statistics */
Stats::Scalar totRequests;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev