From 9adf44ed1f26f6313dbcabf83ab5f93969929c8f Mon Sep 17 00:00:00 2001 From: Erin Le Date: Mon, 22 Jul 2024 21:14:29 +0000 Subject: [PATCH] mem: use is_secure instead of hardcoded false in prefetcher crash This modifies the crash fix so that the function calls that were modified use a local variables called `is_secure` instead of a hardcoded `false`. Some of these existed previously so it made more sense to use them, while others were newly added in to mark where the code might need to be changed later. Change-Id: I0c0d14b74f0ccf70ee5fe7c8b01ed0266353b3c1 --- src/mem/cache/prefetch/pif.cc | 9 +++++---- src/mem/cache/prefetch/signature_path.cc | 2 +- src/mem/cache/prefetch/signature_path_v2.cc | 3 ++- .../cache/prefetch/spatio_temporal_memory_streaming.cc | 9 ++++++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mem/cache/prefetch/pif.cc b/src/mem/cache/prefetch/pif.cc index bfe53d0fc9..416190e2d3 100644 --- a/src/mem/cache/prefetch/pif.cc +++ b/src/mem/cache/prefetch/pif.cc @@ -176,15 +176,15 @@ PIF::notifyRetiredInst(const Addr pc) // Insert the spatial entry into the history buffer and update // the 'iterator' table to point to the new entry historyBuffer.push_back(spatialCompactor); - + bool is_secure = false; auto idx_entry = index.findEntry(spatialCompactor.trigger, - false); + is_secure); if (idx_entry != nullptr) { index.accessEntry(idx_entry); } else { idx_entry = index.findVictim(spatialCompactor.trigger); assert(idx_entry != nullptr); - index.insertEntry(spatialCompactor.trigger, false, + index.insertEntry(spatialCompactor.trigger, is_secure, idx_entry); } idx_entry->historyIt = @@ -207,6 +207,7 @@ PIF::calculatePrefetch(const PrefetchInfo &pfi, } const Addr pc = pfi.getPC(); + bool is_secure = pfi.isSecure(); // First check if the access has been prefetched, this is done by // comparing the access against the active Stream Address Buffers @@ -221,7 +222,7 @@ PIF::calculatePrefetch(const PrefetchInfo &pfi, // Check if a valid entry in the 'index' table is found and allocate a new // active prediction stream - IndexEntry *idx_entry = index.findEntry(pc, false); + IndexEntry *idx_entry = index.findEntry(pc, is_secure); if (idx_entry != nullptr) { index.accessEntry(idx_entry); diff --git a/src/mem/cache/prefetch/signature_path.cc b/src/mem/cache/prefetch/signature_path.cc index 74eccbde77..a16931828f 100644 --- a/src/mem/cache/prefetch/signature_path.cc +++ b/src/mem/cache/prefetch/signature_path.cc @@ -278,7 +278,7 @@ SignaturePath::calculatePrefetch(const PrefetchInfo &pfi, // confidence, these are prefetch candidates // - select the entry with the highest counter as the "lookahead" PatternEntry *current_pattern_entry = - patternTable.findEntry(current_signature, false); //, + patternTable.findEntry(current_signature, is_secure); PatternStrideEntry const *lookahead = nullptr; if (current_pattern_entry != nullptr) { unsigned long max_counter = 0; diff --git a/src/mem/cache/prefetch/signature_path_v2.cc b/src/mem/cache/prefetch/signature_path_v2.cc index 202a6ee7c8..dc34dbd71e 100644 --- a/src/mem/cache/prefetch/signature_path_v2.cc +++ b/src/mem/cache/prefetch/signature_path_v2.cc @@ -125,7 +125,8 @@ SignaturePathV2::handlePageCrossingLookahead(signature_t signature, GlobalHistoryEntry *gh_entry = globalHistoryRegister.findVictim(0); assert(gh_entry != nullptr); // Any address value works, as it is never used - globalHistoryRegister.insertEntry(0, false, gh_entry); // false, + bool is_secure = false; + globalHistoryRegister.insertEntry(0, is_secure, gh_entry); // false, gh_entry->signature = signature; gh_entry->lastBlock = last_offset; diff --git a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc index fe264ab5f7..a1b40d182d 100644 --- a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc +++ b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc @@ -92,13 +92,14 @@ STeMS::checkForActiveGenerationsEnd(const CacheAccessor &cache) } if (generation_ended) { // PST is indexed using the PC (secure bit is unused) + bool is_secure = false; auto pst_entry = patternSequenceTable.findEntry(pst_addr, - false); + is_secure); if (pst_entry == nullptr) { // Tipically an entry will not exist pst_entry = patternSequenceTable.findVictim(pst_addr); assert(pst_entry != nullptr); - patternSequenceTable.insertEntry(pst_addr, false, + patternSequenceTable.insertEntry(pst_addr, is_secure, pst_entry); } else { patternSequenceTable.accessEntry(pst_entry); @@ -221,9 +222,11 @@ STeMS::reconstructSequence( // Now query the PST with the PC of each RMOB entry idx = 0; + bool is_secure = false; for (auto it = rmob_it; it != rmob.end() && (idx < reconstructionEntries); it++) { - auto pst_entry = patternSequenceTable.findEntry(it->pstAddress, false); + auto pst_entry = patternSequenceTable.findEntry(it->pstAddress, + is_secure); if (pst_entry != nullptr) { patternSequenceTable.accessEntry(pst_entry); for (auto &seq_entry : pst_entry->sequence) {