24.6. gem5 checkpoint
Analogous to QEMU’s Snapshot, but better since it can be started from inside the guest, so we can easily checkpoint after a specific guest event, e.g. just before init
is done.
Documentation: http://gem5.org/Checkpoints
To see it in action try:
./run --arch aarch64 --emulator gem5
In the guest, wait for the boot to end and run:
m5 checkpoint
where gem5 m5 executable is a guest utility present inside the gem5 tree which we cross-compiled and installed into the guest.
To restore the checkpoint, kill the VM and run:
./run --arch arm --emulator gem5 --gem5-restore 1
The --gem5-restore
option restores the checkpoint that was created most recently.
Let’s create a second checkpoint to see how it works, in guest:
date >f m5 checkpoint
Kill the VM, and try it out:
./run --arch arm --emulator gem5 --gem5-restore 1
Here we use --gem5-restore 1
again, since the second snapshot we took is now the most recent one
Now in the guest:
cat f
contains the date
. The file f
wouldn’t exist had we used the first checkpoint with --gem5-restore 2
, which is the second most recent snapshot taken.
If you automate things with Kernel command line parameters as in:
./run --arch arm --eval 'm5 checkpoint;m5 resetstats;dhrystone 1000;m5 exit' --emulator gem5
Then there is no need to pass the kernel command line again to gem5 for replay:
./run --arch arm --emulator gem5 --gem5-restore 1
since boot has already happened, and the parameters are already in the RAM of the snapshot.