mem: Respond to InvalidateReq when the block is (pending) dirty
Previously when an InvalidateReq snooped a cache with a dirty block or a pending modified MSHR, it would invalidate the block or set the postInv flag. The cache would not send an InvalidateResp. though, causing memory order violations. This patches changes this behavior, making the cache with the dirty block or pending modified MSHR the ordering point. Change-Id: Ib4c31012f4f6693ffb137cd77258b160fbc239ca Reviewed-by: Andreas Hansson <andreas.hansson@arm.com>
This commit is contained in:
parent
9916e4276c
commit
0054f1ad53
2 changed files with 5 additions and 10 deletions
12
src/mem/cache/cache.cc
vendored
12
src/mem/cache/cache.cc
vendored
|
@ -1783,9 +1783,6 @@ Cache::handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks,
|
||||||
// dirty as part of satisfyRequest
|
// dirty as part of satisfyRequest
|
||||||
if (pkt->cmd == MemCmd::WriteLineReq) {
|
if (pkt->cmd == MemCmd::WriteLineReq) {
|
||||||
assert(!pkt->hasSharers());
|
assert(!pkt->hasSharers());
|
||||||
// at the moment other caches do not respond to the
|
|
||||||
// invalidation requests corresponding to a whole-line write
|
|
||||||
assert(!pkt->cacheResponding());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we deal with setting the appropriate state of the line,
|
// here we deal with setting the appropriate state of the line,
|
||||||
|
@ -1985,11 +1982,10 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
|
||||||
|
|
||||||
// We may end up modifying both the block state and the packet (if
|
// We may end up modifying both the block state and the packet (if
|
||||||
// we respond in atomic mode), so just figure out what to do now
|
// we respond in atomic mode), so just figure out what to do now
|
||||||
// and then do it later. If we find dirty data while snooping for
|
// and then do it later. We respond to all snoops that need
|
||||||
// an invalidate, we don't need to send a response. The
|
// responses provided we have the block in dirty state. The
|
||||||
// invalidation itself is taken care of below.
|
// invalidation itself is taken care of below.
|
||||||
bool respond = blk->isDirty() && pkt->needsResponse() &&
|
bool respond = blk->isDirty() && pkt->needsResponse();
|
||||||
pkt->cmd != MemCmd::InvalidateReq;
|
|
||||||
bool have_writable = blk->isWritable();
|
bool have_writable = blk->isWritable();
|
||||||
|
|
||||||
// Invalidate any prefetch's from below that would strip write permissions
|
// Invalidate any prefetch's from below that would strip write permissions
|
||||||
|
@ -2160,7 +2156,7 @@ Cache::recvTimingSnoopReq(PacketPtr pkt)
|
||||||
// state to determine if it is dirty and writable, we use the
|
// state to determine if it is dirty and writable, we use the
|
||||||
// command and fields of the writeback packet
|
// command and fields of the writeback packet
|
||||||
bool respond = wb_pkt->cmd == MemCmd::WritebackDirty &&
|
bool respond = wb_pkt->cmd == MemCmd::WritebackDirty &&
|
||||||
pkt->needsResponse() && pkt->cmd != MemCmd::InvalidateReq;
|
pkt->needsResponse();
|
||||||
bool have_writable = !wb_pkt->hasSharers();
|
bool have_writable = !wb_pkt->hasSharers();
|
||||||
bool invalidate = pkt->isInvalidate();
|
bool invalidate = pkt->isInvalidate();
|
||||||
|
|
||||||
|
|
3
src/mem/cache/mshr.cc
vendored
3
src/mem/cache/mshr.cc
vendored
|
@ -402,8 +402,7 @@ MSHR::handleSnoop(PacketPtr pkt, Counter _order)
|
||||||
|
|
||||||
// Start by determining if we will eventually respond or not,
|
// Start by determining if we will eventually respond or not,
|
||||||
// matching the conditions checked in Cache::handleSnoop
|
// matching the conditions checked in Cache::handleSnoop
|
||||||
bool will_respond = isPendingModified() && pkt->needsResponse() &&
|
bool will_respond = isPendingModified() && pkt->needsResponse();
|
||||||
pkt->cmd != MemCmd::InvalidateReq;
|
|
||||||
|
|
||||||
// The packet we are snooping may be deleted by the time we
|
// The packet we are snooping may be deleted by the time we
|
||||||
// actually process the target, and we consequently need to
|
// actually process the target, and we consequently need to
|
||||||
|
|
Loading…
Reference in a new issue