mem-ruby: Not flushing data to memory when there's no dirty block

Currently, taking a checkpoint with a ruby cache involves moving all
the dirty data in cache to memory. This is done by keeping **only**
simulating the cache until all dirty data are flushed to the memory
before taking the checkpoint.

However, when the cache does not have dirty data, it is a problem if
we keep simulating the cache. E.g., calling checkpoint caused the gem5
"empty event queue" assertion fault when running the ruby cache in
atomic_noncaching mode. Since the mode bypasses the cache, all blocks
are invalid and do not contain dirty data. Subsequently, there is no
event placed to the event queue when we keep **only** simulating the
cache before taking the checkpoint.

This patch fixes this problem by checking if there is any actionable
item when trying to move dirty data to memory. If there is no block
contains dirty data, we simply choose not to continue simulating the
cache before taking the checkpoint.

Change-Id: Idfa09be51274c7fc8a340e9e33167f5b32d1b866
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69897
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Hoa Nguyen
2023-04-16 19:36:27 +00:00
parent 76d1d024da
commit 09023d4158
3 changed files with 15 additions and 0 deletions

View File

@@ -207,5 +207,11 @@ CacheRecorder::aggregateRecords(uint8_t **buf, uint64_t total_size)
return current_size;
}
uint64_t
CacheRecorder::getNumRecords() const
{
return m_records.size();
}
} // namespace ruby
} // namespace gem5

View File

@@ -85,6 +85,8 @@ class CacheRecorder
uint64_t aggregateRecords(uint8_t **data, uint64_t size);
uint64_t getNumRecords() const;
/*!
* Function for flushing the memory contents of the caches to the
* main memory. It goes through the recorded contents of the caches,

View File

@@ -218,6 +218,13 @@ RubySystem::memWriteback()
}
DPRINTF(RubyCacheTrace, "Cache Trace Complete\n");
// If there is no dirty block, we don't need to flush the cache
if (m_cache_recorder->getNumRecords() == 0)
{
m_cooldown_enabled = false;
return;
}
// save the current tick value
Tick curtick_original = curTick();
DPRINTF(RubyCacheTrace, "Recording current tick %ld\n", curtick_original);