summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system
diff options
context:
space:
mode:
authorMarco Elver <marco.elver@ed.ac.uk>2014-04-19 09:00:30 -0500
committerMarco Elver <marco.elver@ed.ac.uk>2014-04-19 09:00:30 -0500
commitd9fa950396e8f331bbfb1023348c8c680967b1be (patch)
treede8a7a5902da5952c70f88d43fd8fc89c496377a /src/mem/ruby/system
parent097aadc2cddafdd6433aa8f57b141f0e01222e45 (diff)
downloadgem5-d9fa950396e8f331bbfb1023348c8c680967b1be.tar.xz
ruby: recorder: Fix (de-)serializing with different cache block-sizes
Upon aggregating records, serialize system's cache-block size, as the cache-block size can be different when restoring from a checkpoint. This way, we can correctly read all records when restoring from a checkpoints, even if the cache-block size is different. Note, that it is only possible to restore from a checkpoint if the desired cache-block size is smaller or equal to the cache-block size when the checkpoint was taken; we can split one larger request into multiple small ones, but it is not reliable to do the opposite. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/mem/ruby/system')
-rw-r--r--src/mem/ruby/system/System.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index b2f439178..dad5b8aa6 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -182,9 +182,16 @@ RubySystem::serialize(std::ostream &os)
}
}
+ // Store the cache-block size, so we are able to restore on systems with a
+ // different cache-block size. CacheRecorder depends on the correct
+ // cache-block size upon unserializing.
+ uint64 block_size_bytes = getBlockSizeBytes();
+ SERIALIZE_SCALAR(block_size_bytes);
+
DPRINTF(RubyCacheTrace, "Recording Cache Trace\n");
// Create the CacheRecorder and record the cache trace
- m_cache_recorder = new CacheRecorder(NULL, 0, sequencer_map);
+ m_cache_recorder = new CacheRecorder(NULL, 0, sequencer_map,
+ block_size_bytes);
for (int cntrl = 0; cntrl < m_abs_cntrl_vec.size(); cntrl++) {
m_abs_cntrl_vec[cntrl]->recordCacheTrace(cntrl, m_cache_recorder);
@@ -277,6 +284,12 @@ RubySystem::unserialize(Checkpoint *cp, const string &section)
{
uint8_t *uncompressed_trace = NULL;
+ // This value should be set to the checkpoint-system's block-size.
+ // Optional, as checkpoints without it can be run if the
+ // checkpoint-system's block-size == current block-size.
+ uint64 block_size_bytes = getBlockSizeBytes();
+ UNSERIALIZE_OPT_SCALAR(block_size_bytes);
+
if (m_mem_vec != NULL) {
string memory_trace_file;
uint64 memory_trace_size = 0;
@@ -320,7 +333,7 @@ RubySystem::unserialize(Checkpoint *cp, const string &section)
}
m_cache_recorder = new CacheRecorder(uncompressed_trace, cache_trace_size,
- sequencer_map);
+ sequencer_map, block_size_bytes);
}
void