changeset 95eb22928d0f in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=95eb22928d0f
description:
        merged with recent commits.

diffstat:

 src/SConscript                                     |    5 +
 src/sim/SConscript                                 |    1 +
 src/sim/root.cc                                    |   24 +-
 src/sim/serialize.cc                               |  118 +++-
 src/sim/serialize.hh                               |   26 +-
 util/cpt_upgrader.py                               |  763 +++-----------------
 util/cpt_upgraders/arm-ccregs.py                   |   28 +
 util/cpt_upgraders/arm-contextidr-el2.py           |   13 +
 util/cpt_upgraders/arm-miscreg-teehbr.py           |   15 +
 util/cpt_upgraders/armv8.py                        |  314 ++++++++
 util/cpt_upgraders/cpu-pid.py                      |   12 +
 util/cpt_upgraders/dvfs-perflevel.py               |   15 +
 util/cpt_upgraders/ide-dma-abort.py                |    8 +
 util/cpt_upgraders/isa-is-simobject.py             |   65 +
 util/cpt_upgraders/memory-per-range.py             |   32 +
 util/cpt_upgraders/multiple-event-queues.py        |    5 +
 util/cpt_upgraders/process-fdmap-rename.py         |   32 +
 util/cpt_upgraders/remove-arm-cpsr-mode-miscreg.py |   13 +
 util/cpt_upgraders/ruby-block-size-bytes.py        |    9 +
 util/cpt_upgraders/x86-add-tlb.py                  |   17 +
 20 files changed, 845 insertions(+), 670 deletions(-)

diffs (truncated from 1777 to 300 lines):

diff -r bfc99bc87a79 -r 95eb22928d0f src/SConscript
--- a/src/SConscript    Thu Sep 03 15:38:46 2015 -0500
+++ b/src/SConscript    Thu Sep 03 15:40:20 2015 -0500
@@ -916,6 +916,11 @@
 env.Depends(SWIG, 'debug/flags.cc')
 Source('debug/flags.cc')
 
+# version tags
+env.Command('sim/tags.cc', None,
+            MakeAction('util/cpt_upgrader.py --get-cc-file > $TARGET',
+                       Transform("VER TAGS")))
+
 # Embed python files.  All .py files that have been indicated by a
 # PySource() call in a SConscript need to be embedded into the M5
 # library.  To do that, we compile the file to byte code, marshal the
diff -r bfc99bc87a79 -r 95eb22928d0f src/sim/SConscript
--- a/src/sim/SConscript        Thu Sep 03 15:38:46 2015 -0500
+++ b/src/sim/SConscript        Thu Sep 03 15:40:20 2015 -0500
@@ -42,6 +42,7 @@
 Source('arguments.cc')
 Source('async.cc')
 Source('core.cc')
+Source('tags.cc')
 Source('cxx_config.cc')
 Source('cxx_manager.cc')
 Source('cxx_config_ini.cc')
diff -r bfc99bc87a79 -r 95eb22928d0f src/sim/root.cc
--- a/src/sim/root.cc   Thu Sep 03 15:38:46 2015 -0500
+++ b/src/sim/root.cc   Thu Sep 03 15:40:20 2015 -0500
@@ -132,8 +132,6 @@
 void
 Root::serialize(CheckpointOut &cp) const
 {
-    uint64_t cpt_ver = gem5CheckpointVersion;
-    SERIALIZE_SCALAR(cpt_ver);
     SERIALIZE_SCALAR(FullSystem);
     std::string isa = THE_ISA_STR;
     SERIALIZE_SCALAR(isa);
@@ -141,27 +139,7 @@
 
 void
 Root::unserialize(CheckpointIn &cp)
-{
-    uint64_t cpt_ver = 0;
-    UNSERIALIZE_OPT_SCALAR(cpt_ver);
-    if (cpt_ver < gem5CheckpointVersion) {
-        warn("**********************************************************\n");
-        warn("!!!! Checkpoint ver %#x is older than current ver %#x !!!!\n",
-                cpt_ver, gem5CheckpointVersion);
-        warn("You might experience some issues when restoring and should run "
-             "the checkpoint upgrader (util/cpt_upgrader.py) on your "
-             "checkpoint\n");
-        warn("**********************************************************\n");
-    } else if (cpt_ver > gem5CheckpointVersion) {
-        warn("**********************************************************\n");
-        warn("!!!! Checkpoint ver %#x is newer than current ver %#x !!!!\n",
-                cpt_ver, gem5CheckpointVersion);
-        warn("Running a new checkpoint with an older version of gem5 is not "
-             "supported. While it might work, you may experience incorrect "
-             "behavior or crashes.\n");
-        warn("**********************************************************\n");
-     }
-}
+{}
 
 
 bool FullSystem;
diff -r bfc99bc87a79 -r 95eb22928d0f src/sim/serialize.cc
--- a/src/sim/serialize.cc      Thu Sep 03 15:38:46 2015 -0500
+++ b/src/sim/serialize.cc      Thu Sep 03 15:40:20 2015 -0500
@@ -212,6 +212,24 @@
 
 template <class T>
 void
+arrayParamOut(CheckpointOut &os, const string &name, const set<T> &param)
+{
+    typename set<T>::const_iterator it = param.begin();
+
+    os << name << "=";
+    if (param.size() > 0)
+        showParam(os, *it);
+    it++;
+    while (it != param.end()) {
+        os << " ";
+        showParam(os, *it);
+        it++;
+    }
+    os << "\n";
+}
+
+template <class T>
+void
 paramIn(CheckpointIn &cp, const string &name, T &param)
 {
     const string &section(Serializable::currentSection());
@@ -223,12 +241,13 @@
 
 template <class T>
 bool
-optParamIn(CheckpointIn &cp, const string &name, T &param)
+optParamIn(CheckpointIn &cp, const string &name, T &param, bool warn)
 {
     const string &section(Serializable::currentSection());
     string str;
     if (!cp.find(section, name, str) || !parseParam(str, param)) {
-        warn("optional parameter %s:%s not present\n", section, name);
+        if (warn)
+            warn("optional parameter %s:%s not present\n", section, name);
         return false;
     } else {
         return true;
@@ -367,6 +386,36 @@
     }
 }
 
+template <class T>
+void
+arrayParamIn(CheckpointIn &cp, const string &name, set<T> &param)
+{
+    const string &section(Serializable::currentSection());
+    string str;
+    if (!cp.find(section, name, str)) {
+        fatal("Can't unserialize '%s:%s'\n", section, name);
+    }
+    param.clear();
+
+    vector<string> tokens;
+    tokenize(tokens, str, ' ');
+
+    for (vector<string>::size_type i = 0; i < tokens.size(); i++) {
+        T scalar_value;
+        if (!parseParam(tokens[i], scalar_value)) {
+            string err("could not parse \"");
+
+            err += str;
+            err += "\"";
+
+            fatal(err);
+        }
+
+        // assign parsed value to vector
+        param.insert(scalar_value);
+    }
+}
+
 
 void
 objParamIn(CheckpointIn &cp, const string &name, SimObject * &param)
@@ -384,7 +433,8 @@
     template void                                                       \
     paramIn(CheckpointIn &cp, const string &name, type & param);        \
     template bool                                                       \
-    optParamIn(CheckpointIn &cp, const string &name, type & param);     \
+    optParamIn(CheckpointIn &cp, const string &name, type & param,      \
+               bool warn);                                              \
     template void                                                       \
     arrayParamOut(CheckpointOut &os, const string &name,                \
                   type const *param, unsigned size);                    \
@@ -421,6 +471,11 @@
 INSTANTIATE_PARAM_TEMPLATES(string)
 INSTANTIATE_PARAM_TEMPLATES(Pixel)
 
+// set is only used with strings and furthermore doesn't agree with Pixel
+template void
+arrayParamOut(CheckpointOut &, const string &, const set<string> &);
+template void
+arrayParamIn(CheckpointIn &, const string &, set<string> &);
 
 /////////////////////////////
 
@@ -441,16 +496,73 @@
 /// The one and only instance of the Globals class.
 Globals globals;
 
+/// The version tags for this build of the simulator, to be stored in the
+/// Globals section during serialization and compared upon unserialization.
+extern std::set<std::string> version_tags;
+
 void
 Globals::serialize(CheckpointOut &cp) const
 {
     paramOut(cp, "curTick", curTick());
+    SERIALIZE_CONTAINER(version_tags);
 }
 
 void
 Globals::unserialize(CheckpointIn &cp)
 {
     paramIn(cp, "curTick", unserializedCurTick);
+
+    const std::string &section(Serializable::currentSection());
+    std::string str;
+    if (!cp.find(section, "version_tags", str)) {
+        warn("**********************************************************\n");
+        warn("!!!! Checkpoint uses an old versioning scheme.        !!!!\n");
+        warn("Run the checkpoint upgrader (util/cpt_upgrader.py) on your "
+             "checkpoint\n");
+        warn("**********************************************************\n");
+        return;
+    }
+
+    std::set<std::string> cpt_tags;
+    arrayParamIn(cp, "version_tags", cpt_tags); // UNSERIALIZE_CONTAINER
+
+    bool err = false;
+    for (const auto& t : version_tags) {
+        if (cpt_tags.find(t) == cpt_tags.end()) {
+            // checkpoint is missing tag that this binary has
+            if (!err) {
+                
warn("*****************************************************\n");
+                warn("!!!! Checkpoint is missing the following version 
tags:\n");
+                err = true;
+            }
+            warn("  %s\n", t);
+        }
+    }
+    if (err) {
+        warn("You might experience some issues when restoring and should run "
+             "the checkpoint upgrader (util/cpt_upgrader.py) on your "
+             "checkpoint\n");
+        warn("**********************************************************\n");
+    }
+
+    err = false;
+    for (const auto& t : cpt_tags) {
+        if (version_tags.find(t) == version_tags.end()) {
+            // gem5 binary is missing tag that this checkpoint has
+            if (!err) {
+                
warn("*****************************************************\n");
+                warn("!!!! gem5 is missing the following version tags:\n");
+                err = true;
+            }
+            warn("  %s\n", t);
+        }
+    }
+    if (err) {
+        warn("Running a checkpoint with incompatible version tags is not "
+             "supported. While it might work, you may experience incorrect "
+             "behavior or crashes.\n");
+        warn("**********************************************************\n");
+     }
 }
 
 Serializable::Serializable()
diff -r bfc99bc87a79 -r 95eb22928d0f src/sim/serialize.hh
--- a/src/sim/serialize.hh      Thu Sep 03 15:38:46 2015 -0500
+++ b/src/sim/serialize.hh      Thu Sep 03 15:40:20 2015 -0500
@@ -55,6 +55,7 @@
 #include <list>
 #include <map>
 #include <stack>
+#include <set>
 #include <vector>
 
 #include "base/bitunion.hh"
@@ -70,15 +71,6 @@
 typedef std::ostream CheckpointOut;
 
 
-/** The current version of the checkpoint format.
- * This should be incremented by 1 and only 1 for every new version, where a 
new
- * version is defined as a checkpoint created before this version won't work on
- * the current version until the checkpoint format is updated. Adding a new
- * SimObject shouldn't cause the version number to increase, only changes to
- * existing objects such as serializing/unserializing more state, changing 
sizes
- * of serialized arrays, etc. */
-static const uint64_t gem5CheckpointVersion = 0x000000000000000f;
-
 template <class T>
 void paramOut(CheckpointOut &cp, const std::string &name, const T &param);
 
@@ -100,13 +92,15 @@
 }
 
 template <class T>
-bool optParamIn(CheckpointIn &cp, const std::string &name, T &param);
+bool optParamIn(CheckpointIn &cp, const std::string &name, T &param,
+                bool warn = true);
 
 template <typename DataType, typename BitUnion>
 bool optParamIn(CheckpointIn &cp, const std::string &name,
-                BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p)
+                BitfieldBackend::BitUnionOperators<DataType, BitUnion> &p,
+                bool warn = true)
 {
-    return optParamIn(cp, name, p.__data);
+    return optParamIn(cp, name, p.__data, warn);
 }
 
 template <class T>
@@ -122,6 +116,10 @@
                    const std::list<T> &param);
 
 template <class T>
+void arrayParamOut(CheckpointOut &cp, const std::string &name,
+                   const std::set<T> &param);
+
+template <class T>
 void arrayParamIn(CheckpointIn &cp, const std::string &name,
                   T *param, unsigned size);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to