From 0c5a98f9d18c6fdae287b1b608d1ffb1c13fb9c9 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 25 Sep 2015 07:26:57 -0400 Subject: 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. --- src/mem/snoop_filter.hh | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/mem/snoop_filter.hh') 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 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 @@ -234,9 +237,14 @@ class SnoopFilter : public SimObject { void eraseIfNullEntry(SnoopFilterCache::iterator& sf_it); /** 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; -- cgit v1.2.3