From: Steve Reinhardt Date: Thu, 26 Aug 2010 04:55:55 +0000 (-0700) Subject: cache: fix a bug in atomic multilevel snoops X-Git-Tag: stable_2012_02_02~837 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1bf944be6213163279e114412a7f3cc804b5846a;p=gem5.git cache: fix a bug in atomic multilevel snoops --- diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index d471b293a..c930a886d 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1099,6 +1099,12 @@ Cache::handleSnoop(PacketPtr pkt, BlkType *blk, assert(!(pending_inval && !is_deferred)); 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) { // first propagate snoop upward to see if anyone above us wants to // handle it. save & restore packet src since it will get @@ -1141,10 +1147,9 @@ Cache::handleSnoop(PacketPtr pkt, BlkType *blk, // and then do it later bool respond = blk->isDirty() && pkt->needsResponse(); bool have_exclusive = blk->isWritable(); - bool invalidate = pkt->isInvalidate(); - if (pkt->isRead() && !pkt->isInvalidate()) { - assert(!pkt->needsExclusive()); + if (pkt->isRead() && !invalidate) { + assert(!needs_exclusive); pkt->assertShared(); int bits_to_clear = BlkWritable; const bool haveOwnershipState = true; // for now