diff -r c7358871f1e5 -r 563280b8bbc2 src/mem/cache/mshr.cc --- a/src/mem/cache/mshr.cc Mon Feb 18 12:03:37 2013 +0000 +++ b/src/mem/cache/mshr.cc Mon Feb 18 13:44:17 2013 +0000 @@ -82,7 +82,10 @@ } if (markPending) { - MSHR *mshr = dynamic_cast(pkt->senderState); + // Iterate over the SenderState stack and see if we find + // an MSHR entry. If we do, set the downstreamPending + // flag. Otherwise, do nothing. + MSHR *mshr = pkt->findNextSenderState(); if (mshr != NULL) { assert(!mshr->downstreamPending); mshr->downstreamPending = true; @@ -130,7 +133,13 @@ Iterator end_i = end(); for (Iterator i = begin(); i != end_i; ++i) { if (i->markedPending) { - MSHR *mshr = dynamic_cast(i->pkt->senderState); + // Iterate over the SenderState stack and see if we find + // an MSHR entry. If we find one, clear the + // downstreamPending flag by calling + // clearDownstreamPending(). This recursively clears the + // downstreamPending flag in all caches this packet has + // passed through. + MSHR *mshr = i->pkt->findNextSenderState(); if (mshr != NULL) { mshr->clearDownstreamPending(); } diff -r c7358871f1e5 -r 563280b8bbc2 src/mem/packet.hh --- a/src/mem/packet.hh Mon Feb 18 12:03:37 2013 +0000 +++ b/src/mem/packet.hh Mon Feb 18 13:44:17 2013 +0000 @@ -454,6 +454,25 @@ */ SenderState *popSenderState(); + /** + * Go through the sender state stack and return the first instance + * that is of type T (as determined by a dynamic_cast). If there + * is no sender state of type T, NULL is returned. + * + * @return The topmost state of type T + */ + template + T * findNextSenderState() const + { + T *t = NULL; + SenderState* sender_state = senderState; + while (t == NULL && sender_state != NULL) { + t = dynamic_cast(sender_state); + sender_state = sender_state->predecessor; + } + return t; + } + /// Return the string name of the cmd field (for debugging and /// tracing). const std::string &cmdString() const { return cmd.toString(); }