From 085737bbfa6fa4ec8581ffaaed579de7a1e82e15 Mon Sep 17 00:00:00 2001 From: Sascha Bischoff Date: Thu, 7 Jun 2018 13:39:39 +0100 Subject: [PATCH] gem5: Add checkpoint support We add the ability to explicitly take checkpoints when running with a gem5 system. As we cannot have any state which is shared between the host and simulated system, we first unmount the VirtIO device, take the checkpoint, and then remount the VirtIO device into the simulated system. --- devlib/utils/ssh.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index c6db81f..3243708 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -806,6 +806,21 @@ class Gem5Connection(TelnetConnection): unmount_command = "umount {}".format(self.gem5_input_dir) self._gem5_shell(unmount_command, as_root=True) + def take_checkpoint(self): + """ + Take a checkpoint of the simulated system. + + In order to take a checkpoint we first unmount the virtio + device, take then checkpoint, and then remount the device to + allow us to continue the current run. This needs to be done to + ensure that future gem5 simulations are able to utilise the + virtio device (i.e., we need to drop the current state + information that the device has). + """ + self._unmount_virtio() + self._gem5_util("checkpoint") + self._mount_virtio() + def _move_to_temp_dir(self, source): """ Move a file to the temporary directory on the host for copying to the