cache: fix a bug in atomic multilevel snoops

This commit is contained in:
Steve Reinhardt 2010-08-25 21:55:55 -07:00
parent ee6a92863a
commit 1bf944be62

View file

@ -1099,6 +1099,12 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
assert(!(pending_inval && !is_deferred)); assert(!(pending_inval && !is_deferred));
assert(pkt->isRequest()); assert(pkt->isRequest());
// the packet may get modified if we or a forwarded snooper
// responds in atomic mode, so remember a few things about the
// original packet up front
bool invalidate = pkt->isInvalidate();
bool needs_exclusive = pkt->needsExclusive();
if (forwardSnoops) { if (forwardSnoops) {
// first propagate snoop upward to see if anyone above us wants to // first propagate snoop upward to see if anyone above us wants to
// handle it. save & restore packet src since it will get // handle it. save & restore packet src since it will get
@ -1141,10 +1147,9 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk,
// and then do it later // and then do it later
bool respond = blk->isDirty() && pkt->needsResponse(); bool respond = blk->isDirty() && pkt->needsResponse();
bool have_exclusive = blk->isWritable(); bool have_exclusive = blk->isWritable();
bool invalidate = pkt->isInvalidate();
if (pkt->isRead() && !pkt->isInvalidate()) { if (pkt->isRead() && !invalidate) {
assert(!pkt->needsExclusive()); assert(!needs_exclusive);
pkt->assertShared(); pkt->assertShared();
int bits_to_clear = BlkWritable; int bits_to_clear = BlkWritable;
const bool haveOwnershipState = true; // for now const bool haveOwnershipState = true; // for now