mem-cache: add prefetch info to update probe

CacheDataUpdateProbeArg has additional info to tell listeners if the
block was prefetched and evicted without being used, as well as which
object prefetched the block.

Related JIRA:
https://gem5.atlassian.net/browse/GEM5-457
https://gem5.atlassian.net/browse/GEM5-1112

Change-Id: Id8ac9099ddbce6e94ee775655da23de5df25cf0f
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
This commit is contained in:
Tiago Mück
2022-09-08 15:55:35 -05:00
parent becba00d95
commit d8a04f902e
2 changed files with 16 additions and 5 deletions

11
src/mem/cache/base.cc vendored
View File

@@ -773,7 +773,8 @@ BaseCache::updateBlockData(CacheBlk *blk, const PacketPtr cpkt,
bool has_old_data)
{
CacheDataUpdateProbeArg data_update(
regenerateBlkAddr(blk), blk->isSecure(), accessor);
regenerateBlkAddr(blk), blk->isSecure(),
blk->getSrcRequestorId(), accessor);
if (ppDataUpdate->hasListeners()) {
if (has_old_data) {
data_update.oldData = std::vector<uint64_t>(blk->data,
@@ -790,6 +791,7 @@ BaseCache::updateBlockData(CacheBlk *blk, const PacketPtr cpkt,
if (cpkt) {
data_update.newData = std::vector<uint64_t>(blk->data,
blk->data + (blkSize / sizeof(uint64_t)));
data_update.hwPrefetched = blk->wasPrefetched();
}
ppDataUpdate->notify(data_update);
}
@@ -812,7 +814,8 @@ BaseCache::cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
// Get a copy of the old block's contents for the probe before the update
CacheDataUpdateProbeArg data_update(
regenerateBlkAddr(blk), blk->isSecure(), accessor);
regenerateBlkAddr(blk), blk->isSecure(), blk->getSrcRequestorId(),
accessor);
if (ppDataUpdate->hasListeners()) {
data_update.oldData = std::vector<uint64_t>(blk->data,
blk->data + (blkSize / sizeof(uint64_t)));
@@ -1110,7 +1113,8 @@ BaseCache::satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool, bool)
// Get a copy of the old block's contents for the probe before
// the update
CacheDataUpdateProbeArg data_update(
regenerateBlkAddr(blk), blk->isSecure(), accessor);
regenerateBlkAddr(blk), blk->isSecure(),
blk->getSrcRequestorId(), accessor);
if (ppDataUpdate->hasListeners()) {
data_update.oldData = std::vector<uint64_t>(blk->data,
blk->data + (blkSize / sizeof(uint64_t)));
@@ -1129,6 +1133,7 @@ BaseCache::satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool, bool)
if (ppDataUpdate->hasListeners()) {
data_update.newData = std::vector<uint64_t>(blk->data,
blk->data + (blkSize / sizeof(uint64_t)));
data_update.hwPrefetched = blk->wasPrefetched();
ppDataUpdate->notify(data_update);
}

View File

@@ -95,17 +95,23 @@ struct CacheDataUpdateProbeArg
Addr addr;
/** Whether the block belongs to the secure address space. */
bool isSecure;
/** Block original requestor */
const RequestorID requestorID;
/** The stale data contents. If zero-sized this update is a fill. */
std::vector<uint64_t> oldData;
/** The new data contents. If zero-sized this is an invalidation. */
std::vector<uint64_t> newData;
/** Set if the update is from a prefetch or evicting a prefetched
* block that was never used. */
bool hwPrefetched;
/** Accessor for the cache */
CacheAccessor &accessor;
CacheDataUpdateProbeArg(Addr _addr, bool is_secure,
RequestorID _requestorID,
CacheAccessor &_accessor)
: addr(_addr), isSecure(is_secure), oldData(), newData(),
accessor(_accessor)
: addr(_addr), isSecure(is_secure), requestorID(_requestorID),
oldData(), newData(), accessor(_accessor)
{
}
};