From a94c68228a29562c382a4587ce9cf18101f9babc Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 10 Mar 2009 17:37:15 -0700 Subject: [PATCH] prefetch: don't panic on requests w/o contextID (e.g., writebacks). --- src/mem/cache/prefetch/ghb.cc | 7 ++++++- src/mem/cache/prefetch/stride.cc | 5 +++++ src/mem/request.hh | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mem/cache/prefetch/ghb.cc b/src/mem/cache/prefetch/ghb.cc index c27165248..f8f7de1db 100644 --- a/src/mem/cache/prefetch/ghb.cc +++ b/src/mem/cache/prefetch/ghb.cc @@ -34,13 +34,18 @@ * 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 &addresses, std::list &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); diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc index cfd2469fa..8af4e615e 100644 --- a/src/mem/cache/prefetch/stride.cc +++ b/src/mem/cache/prefetch/stride.cc @@ -46,6 +46,11 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list &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(); diff --git a/src/mem/request.hh b/src/mem/request.hh index dde68ca37..ee62ce771 100644 --- a/src/mem/request.hh +++ b/src/mem/request.hh @@ -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 {