Search code examples
gem5

Not able to run the runscript after restoring from a checkpoint in gem5 fs mode


I have been able to create a checkpoint on an ARM disk image running in the full system mode and restore from that checkpoint. But when I try to run runscript while restoring from that checkpoint using the "--script" flag (while running the script in configs/examples/fs.py), the script doesn't get executed. I have not been able to figure out why and any help in this regard would be much appreciated.

Initially load the system(This works)-->build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/bibin/projects/full-system-images/arm_18/disks/aarch64-ubuntu-trusty-headless.img --kernel=/home/bibin/projects/full-system-images/arm_18/binaries/vmlinux.vexpress_emm64 --bootloader=/home/bibin/projects/full-system-images/arm_18/binaries/boot_emm.arm64 --cpu-clock=250MHz --caches

Restoring from the checkpoint after creating the checkpoint through telnetting and /sbin/m5 checkpoint(this works as well) --> build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/bibin/projects/full-system-images/arm_18/disks/aarch64-ubuntu-trusty-headless.img --kernel=/home/bibin/projects/full-system-images/arm_18/binaries/vmlinux.vexpress_emm64 --bootloader=/home/bibin/projects/full-system-images/arm_18/binaries/boot_emm.arm64 --cpu-clock=250MHz --caches -r 1

Trying the runscript while restoring from checkpoint(This doesn't work) --> build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/bibin/projects/full-system-images/arm_18/disks/aarch64-ubuntu-trusty-headless.img --kernel=/home/bibin/projects/full-system-images/arm_18/binaries/vmlinux.vexpress_emm64 --bootloader=/home/bibin/projects/full-system-images/arm_18/binaries/boot_emm.arm64 --cpu-clock=250MHz --caches --script=/home/bibin/projects/csr_parallelism/runscript_exit.rcS -r 1

The contents of the runscript file is just this --> /sbin/m5 exit


Solution

  • As explained here, --script sets up the stdout produced by the m5 readefile op.

    It does not actually just run that script automatically, you have to do that yourself.

    To achieve this when taking a breakpoint manually, you can run as explained here:

    sh -c 'm5 checkpoint;m5 readfile > /tmp/gem5.sh && sh /tmp/gem5.sh'
    

    This way, when the checkpoint gets restored, we are in the middle for running a shell script that then does m5 readfile and executes its contents.