summaryrefslogtreecommitdiff
path: root/src/mem/snoop_filter.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:34:18 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:34:18 -0500
commitc153b669fd5b19b45fe5a37484a64b88ee4905db (patch)
treed89fc2bf339392aac4780be7e99152a010a53c3d /src/mem/snoop_filter.cc
parent7fca994d04230f1e41b9443b33f891460fc5368d (diff)
downloadgem5-c153b669fd5b19b45fe5a37484a64b88ee4905db.tar.xz
mem: Do not rely on the NeedsWritable flag for responses
This patch removes the NeedsWritable flag for all responses, as it is really only the request that needs a writable response. The response, on the other hand, should in these cases always provide the line in a writable state, as indicated by the hasSharers flag not being set. When we send requests that has NeedsWritable set, the response will always have the hasSharers flag not set. Additionally, there are cases where the request did not have NeedsWritable set, and we still get a writable response with the hasSharers flag not set. This never happens on snoops, but is used by downstream caches to pass ownership upstream. As part of this patch, the affected response types are updated, and the snoop filter is similarly modified to check only the hasSharers flag (as it should). A sanity check is also added to the packet class, asserting that we never look at the NeedsWritable flag for responses. No regressions are affected.
Diffstat (limited to 'src/mem/snoop_filter.cc')
-rwxr-xr-xsrc/mem/snoop_filter.cc36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/mem/snoop_filter.cc b/src/mem/snoop_filter.cc
index b1ccc12c9..9d02ed249 100755
--- a/src/mem/snoop_filter.cc
+++ b/src/mem/snoop_filter.cc
@@ -257,17 +257,14 @@ SnoopFilter::updateSnoopResponse(const Packet* cpkt,
panic_if(!(sf_item.requested & req_mask), "SF value %x.%x missing "\
"the original request\n", sf_item.requested, sf_item.holder);
- // Update the residency of the cache line.
- if (cpkt->needsWritable() || !cpkt->hasSharers()) {
- DPRINTF(SnoopFilter, "%s: dropping %x because needs: %i writable: %i "\
- "SF val: %x.%x\n", __func__, rsp_mask,
- cpkt->needsWritable(), !cpkt->hasSharers(),
+ // If the snoop response has no sharers the line is passed in
+ // Modified state, and we know that there are no other copies, or
+ // they will all be invalidated imminently
+ if (!cpkt->hasSharers()) {
+ DPRINTF(SnoopFilter,
+ "%s: dropping %x because non-shared snoop "
+ "response SF val: %x.%x\n", __func__, rsp_mask,
sf_item.requested, sf_item.holder);
-
- sf_item.holder &= ~rsp_mask;
- // The snoop filter does not see any ACKs from non-responding sharers
- // that have been invalidated :( So below assert would be nice, but..
- //assert(sf_item.holder == 0);
sf_item.holder = 0;
}
assert(!cpkt->isWriteback());
@@ -302,14 +299,10 @@ SnoopFilter::updateSnoopForward(const Packet* cpkt,
DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n",
__func__, sf_item.requested, sf_item.holder);
- // Remote (to this snoop filter) snoops update the filter
- // already when they arrive from below, because we may not see
- // any response.
- if (cpkt->needsWritable()) {
- // If the request to this snoop response hit an in-flight
- // transaction,
- // the holder was not reset -> no assertion & do that here, now!
- //assert(sf_item.holder == 0);
+ // If the snoop response has no sharers the line is passed in
+ // Modified state, and we know that there are no other copies, or
+ // they will all be invalidated imminently
+ if (!cpkt->hasSharers()) {
sf_item.holder = 0;
}
DPRINTF(SnoopFilter, "%s: new SF value %x.%x\n",
@@ -343,9 +336,10 @@ SnoopFilter::updateResponse(const Packet* cpkt, const SlavePort& slave_port)
panic_if(!(sf_item.requested & slave_mask), "SF value %x.%x missing "\
"request bit\n", sf_item.requested, sf_item.holder);
- // Update the residency of the cache line. Here we assume that the
- // line has been zapped in all caches that are not the responder.
- if (cpkt->needsWritable() || !cpkt->hasSharers())
+ // Update the residency of the cache line. If the response has no
+ // sharers we know that the line has been invalidated in all
+ // branches that are not where we are responding to.
+ if (!cpkt->hasSharers())
sf_item.holder = 0;
sf_item.holder |= slave_mask;
sf_item.requested &= ~slave_mask;