summaryrefslogtreecommitdiff
path: root/src/mem/snoop_filter.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-09-25 07:26:57 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2015-09-25 07:26:57 -0400
commit0c5a98f9d18c6fdae287b1b608d1ffb1c13fb9c9 (patch)
tree06b467633133c920bb1f8a20339dd815f831e8b2 /src/mem/snoop_filter.hh
parentceec2bb02c87829f29aa1ebb4573051162264ae8 (diff)
downloadgem5-0c5a98f9d18c6fdae287b1b608d1ffb1c13fb9c9.tar.xz
mem: Store snoop filter lookup result to avoid second lookup
This patch introduces a private member storing the iterator from the lookupRequest call, such that it can be re-used when the request eventually finishes. The method previously called updateRequest is renamed finishRequest to make it more clear that the two functions must be called together.
Diffstat (limited to 'src/mem/snoop_filter.hh')
-rwxr-xr-xsrc/mem/snoop_filter.hh32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh
index ee2c82b6e..b1e33dc8f 100755
--- a/src/mem/snoop_filter.hh
+++ b/src/mem/snoop_filter.hh
@@ -88,7 +88,8 @@ class SnoopFilter : public SimObject {
public:
typedef std::vector<QueuedSlavePort*> SnoopList;
- SnoopFilter (const SnoopFilterParams *p) : SimObject(p),
+ SnoopFilter (const SnoopFilterParams *p) :
+ SimObject(p), reqLookupResult(cachedLocations.end()), retryItem{0, 0},
linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency)
{
}
@@ -104,10 +105,12 @@ class SnoopFilter : public SimObject {
}
/**
- * Lookup a request (from a slave port) in the snoop filter and return a
- * list of other slave ports that need forwarding of the resulting snoops.
- * Additionally, update the tracking structures with new request
- * information.
+ * Lookup a request (from a slave port) in the snoop filter and
+ * return a list of other slave ports that need forwarding of the
+ * resulting snoops. Additionally, update the tracking structures
+ * with new request information. Note that the caller must also
+ * call finishRequest once it is known if the request needs to
+ * retry or not.
*
* @param cpkt Pointer to the request packet. Not changed.
* @param slave_port Slave port where the request came from.
@@ -117,15 +120,15 @@ class SnoopFilter : public SimObject {
const SlavePort& slave_port);
/**
- * For a successful request, update all data structures in the snoop filter
- * reflecting the changes caused by that request
+ * For an un-successful request, revert the change to the snoop
+ * filter. Also take care of erasing any null entries. This method
+ * relies on the result from lookupRequest being stored in
+ * reqLookupResult.
*
- * @param cpkt Pointer to the request packet. Not changed.
- * @param slave_port Slave port where the request came from.
* @param will_retry This request will retry on this bus / snoop filter
+ * @param cpkt Request packet, merely for sanity checking
*/
- void updateRequest(const Packet* cpkt, const SlavePort& slave_port,
- bool will_retry);
+ void finishRequest(bool will_retry, const Packet* cpkt);
/**
* Handle an incoming snoop from below (the master port). These can upgrade the
@@ -235,8 +238,13 @@ class SnoopFilter : public SimObject {
/** Simple hash set of cached addresses. */
SnoopFilterCache cachedLocations;
/**
+ * Iterator used to store the result from lookupRequest until we
+ * call finishRequest.
+ */
+ SnoopFilterCache::iterator reqLookupResult;
+ /**
* Variable to temporarily store value of snoopfilter entry
- * incase updateRequest needs to undo changes made in lookupRequest
+ * incase finishRequest needs to undo changes made in lookupRequest
* (because of crossbar retry)
*/
SnoopItem retryItem;