# Linux Kernel Module Cheat

#### 24.6.5. gem5 checkpoint upgrader

The in-tree `util/cpt_upgrader.py` is a tool to upgrade checkpoints taken from an older version of gem5 to be compatible with the newest version, so you can update gem5 without having to re-run the simulation that generated the checkpoints.

For example, whenever a system register is added in ARMv8, old checkpoints break unless upgraded.

Unfortunately, since the process is not very automated (automatable?), and requires manually patching the upgrader every time a new breaking change is done, the upgrader tends to break soon if you try to move many versions of gem5 ahead as of 2020. This is evidenced in bug reports such as this one: https://gem5.atlassian.net/browse/GEM5-472

The script can be used as:

    util/cpt_upgrader.py m5out/cpt.1000/m5.cpt

This updates the `m5.cpt` file in-place, and a `m5out/cpt.1000/m5.cpt.bak` is generated as a backup of the old file.

The upgrader determines which upgrades are needed by checking the `version_tags` entry of the checkpoint:

    [Globals]
    version_tags=arm-ccregs arm-contextidr-el2 arm-gem5-gic-ext ...

Each of those tags corresponds to a Python file under `util/cpt_upgraders/` e.g. `util/cpt_upgraders/arm-ccregs.py`.