Skip to content

Migrate a Simple Program

Abhishek Bapat edited this page Nov 1, 2022 · 3 revisions

This page demonstrates how to migrate a very simple loop process on the environment that is setup. This page does not contain an explanation of the workflow, instead it just lists the steps. A very detailed explanation of each step can be found here and it applies to this example as well.

Is is highly recommended to do this on the VMs provided by us to get an understanding of our workflow.

Directory Structure

Before we start migrating the example we need to make sure that the directory containing binaries for this process exist in the exact same path on both source and destination. It should look like this:

.
├── bin
│   ├── loop_aarch64
│   └── loop_x86-64
└── loop

If you are using the VMs provided by us, this example will already be deployed under /root/loop/. If using a custom environment, this benchmark code and its associated Makefile is present under ./test/loop/ within this repository. You would need to install our compiler toolchain to build this.

Copy loop_aarch64 and loop_x86-64 within the bin directory and loop should be a copy of loop_x86-64 on the x86-64 machine and loop_aarch64 on the aarch64 machine.

Spawn and Trap

On x86-64 side, run the process with:

./loop

Then check the pid of the spawned process:

pidof loop

Finally, to trap the process at a migration point run:

~/TransProc/tools/tracer <pid_from_above_command>

Dump

Once the process is suspended at the migration point, run:

~/TransProc/criu-3.15/criu/criu dump -vv -o dump.log -t <pid> --shell-job

This command will dump the process at its state.

Recode

To transform the criu artifacts, such that they can be restored on aarch64, run:

~/TransProc/criu-3.15/crit/crit recode . ./aarch64/ aarch64 loop ./bin/ y

This will create a directory called aarch64, containing the transformed images.

Simply copy all the files from the aarch64 directory to the /root/loop/ directory on the destination. After copying, destination folder should look like:

.
├── bin
│   ├── loop_aarch64
│   └── loop_x86-64
|── loop
├── core-1095.img
├── fdinfo-2.img
├── files.img
├── fs-1095.img
├── ids-1095.img
├── inventory.img
├── mm-1095.img
├── pagemap-1095.img
├── pages-1.img
├── pstree.img
├── seccomp.img
├── timens-0.img
└── tty-info.img

Restore

Once all the files are compied, stay on the destination within the directory and run criu restore:

~/TransProc/criu-3.15/criu/criu restore -vv -o restore.log --shell-job

This will spawn the migrated process in a suspended state. Note its pid with the pidof command.