changeset 965c042379df in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=965c042379df
description:
mem: Delay deleting of incoming packets by one call.
This patch is a temporary fix until Andreas' four-phase patches
get reviewed and committed. Removing FastAlloc seems to have exposed
an issue which previously was reasonable rare in which packets are freed
before the sending cache is done with them. This change puts incoming
packets
no a pendingDelete queue which are deleted at the start of the next
call and
thus breaks the dependency between when the caller returns true and
when the
packet is actually used by the sending cache.
Running valgrind on a multi-core linux boot and the memtester results
in no
valgrind warnings.
diffstat:
src/mem/cache/cache.hh | 7 +++++++
src/mem/cache/cache_impl.hh | 18 ++++++++++++++++--
src/mem/tport.cc | 11 ++++++++++-
src/mem/tport.hh | 8 ++++++++
4 files changed, 41 insertions(+), 3 deletions(-)
diffs (105 lines):
diff -r 21f92aa46e8f -r 965c042379df src/mem/cache/cache.hh
--- a/src/mem/cache/cache.hh Thu Jun 07 08:11:00 2012 -0500
+++ b/src/mem/cache/cache.hh Thu Jun 07 10:59:03 2012 -0400
@@ -191,6 +191,13 @@
const bool prefetchOnAccess;
/**
+ * @todo this is a temporary workaround until the 4-phase code is
committed.
+ * upstream caches need this packet until true is returned, so hold it for
+ * deletion until a subsequent call
+ */
+ std::vector<PacketPtr> pendingDelete;
+
+ /**
* Does all the processing necessary to perform the provided request.
* @param pkt The memory request to perform.
* @param lat The latency of the access.
diff -r 21f92aa46e8f -r 965c042379df src/mem/cache/cache_impl.hh
--- a/src/mem/cache/cache_impl.hh Thu Jun 07 08:11:00 2012 -0500
+++ b/src/mem/cache/cache_impl.hh Thu Jun 07 10:59:03 2012 -0400
@@ -378,6 +378,13 @@
//@todo Add back in MemDebug Calls
// MemDebug::cacheAccess(pkt);
+
+ /// @todo temporary hack to deal with memory corruption issue until
+ /// 4-phase transactions are complete
+ for (int x = 0; x < pendingDelete.size(); x++)
+ delete pendingDelete[x];
+ pendingDelete.clear();
+
// we charge hitLatency for doing just about anything here
Tick time = curTick() + hitLatency;
@@ -421,7 +428,11 @@
}
// since we're the official target but we aren't responding,
// delete the packet now.
- delete pkt;
+
+ /// @todo nominally we should just delete the packet here,
+ /// however, until 4-phase stuff we can't because sending
+ /// cache is still relying on it
+ pendingDelete.push_back(pkt);
return true;
}
@@ -489,7 +500,10 @@
pkt->makeTimingResponse();
cpuSidePort->respond(pkt, curTick()+lat);
} else {
- delete pkt;
+ /// @todo nominally we should just delete the packet here,
+ /// however, until 4-phase stuff we can't because sending
+ /// cache is still relying on it
+ pendingDelete.push_back(pkt);
}
} else {
// miss
diff -r 21f92aa46e8f -r 965c042379df src/mem/tport.cc
--- a/src/mem/tport.cc Thu Jun 07 08:11:00 2012 -0500
+++ b/src/mem/tport.cc Thu Jun 07 10:59:03 2012 -0400
@@ -62,6 +62,12 @@
bool
SimpleTimingPort::recvTimingReq(PacketPtr pkt)
{
+ /// @todo temporary hack to deal with memory corruption issue until
+ /// 4-phase transactions are complete. Remove me later
+ for (int x = 0; x < pendingDelete.size(); x++)
+ delete pendingDelete[x];
+ pendingDelete.clear();
+
if (pkt->memInhibitAsserted()) {
// snooper will supply based on copy of packet
// still target's responsibility to delete packet
@@ -78,7 +84,10 @@
assert(pkt->isResponse());
queue.schedSendTiming(pkt, curTick() + latency);
} else {
- delete pkt;
+ /// @todo nominally we should just delete the packet here.
+ /// Until 4-phase stuff we can't because the sending
+ /// cache is still relying on it
+ pendingDelete.push_back(pkt);
}
return true;
diff -r 21f92aa46e8f -r 965c042379df src/mem/tport.hh
--- a/src/mem/tport.hh Thu Jun 07 08:11:00 2012 -0500
+++ b/src/mem/tport.hh Thu Jun 07 10:59:03 2012 -0400
@@ -73,6 +73,14 @@
virtual Tick recvAtomic(PacketPtr pkt) = 0;
+ /**
+ * @todo this is a temporary workaround until the 4-phase code is
committed.
+ * upstream caches need this packet until true is returned, so hold it for
+ * deletion until a subsequent call
+ */
+ std::vector<PacketPtr> pendingDelete;
+
+
public:
/**
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev