prefetch: don't panic on requests w/o contextID (e.g., writebacks).
authorSteve Reinhardt <steve.reinhardt@amd.com>
Wed, 11 Mar 2009 00:37:15 +0000 (17:37 -0700)
committerSteve Reinhardt <steve.reinhardt@amd.com>
Wed, 11 Mar 2009 00:37:15 +0000 (17:37 -0700)
src/mem/cache/prefetch/ghb.cc
src/mem/cache/prefetch/stride.cc
src/mem/request.hh

index c2716524896c2c0d55f42a99108e32d6116a5069..f8f7de1dbfa17938ad17b8afb9d4eebf7063128c 100644 (file)
  * GHB Prefetcher implementation.
  */
 
+#include "base/trace.hh"
 #include "mem/cache/prefetch/ghb.hh"
-#include "arch/isa_traits.hh"
 
 void
 GHBPrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
                                  std::list<Tick> &delays)
 {
+    if (useContextId && !pkt->req->hasContextId()) {
+        DPRINTF(HWPrefetch, "ignoring request with no context ID");
+        return;
+    }
+
     Addr blk_addr = pkt->getAddr() & ~(Addr)(blkSize-1);
     int ctx_id = useContextId ? pkt->req->contextId() : 0;
     assert(ctx_id < Max_Contexts);
index cfd2469fade99cff3e8fb4f5fbc7e495391408e4..8af4e615e8ac2728c6e3ebd41a0c79aa179a0fb0 100644 (file)
@@ -46,6 +46,11 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
         return;
     }
 
+    if (useContextId && !pkt->req->hasContextId()) {
+        DPRINTF(HWPrefetch, "ignoring request with no context ID");
+        return;
+    }
+
     Addr blk_addr = pkt->getAddr() & ~(Addr)(blkSize-1);
     int ctx_id = useContextId ? pkt->req->contextId() : 0;
     Addr pc = pkt->req->getPC();
index dde68ca3734954c7c3e0ee9d8788bddb0a03058a..ee62ce77162e4a9531717f003cf63a431756b08c 100644 (file)
@@ -409,6 +409,12 @@ class Request : public FastAlloc
         flags.set(VALID_EXTRA_DATA);
     }
 
+    bool
+    hasContextId() const
+    {
+        return flags.isSet(VALID_CONTEXT_ID);
+    }
+
     /** Accessor function for context ID.*/
     int
     contextId() const
@@ -425,13 +431,13 @@ class Request : public FastAlloc
         return _threadId;
     }
 
-    /** Accessor function for pc.*/
     bool
     hasPC() const
     {
         return flags.isSet(VALID_PC);
     }
 
+    /** Accessor function for pc.*/
     Addr
     getPC() const
     {