3

At https://www.mail-archive.com/gem5-users@gem5.org/msg15233.html Jason mentioned the technique of attaching two disk images to restore a checkpoint and run a different benchmark.

Is it possible to specify multiple disk images when using fs.py? From the source code I don't think it is currently supported, but just double checking before I decided to patch it or not.

It seems that multiple --disk-image= options just overwrite one another.

fs_bigLITTLE.py seems to support it however.

gem5 60600f09c25255b3c8f72da7fb49100e2682093a

https://www.mail-archive.com/gem5-users@gem5.org/msg15675.html

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44

2 Answers2

3

I replied here: https://www.mail-archive.com/gem5-users@gem5.org/msg15714.html

Basically, http://www.gem5.org/AsimBench shows an example of how to do it with fs.py. You can try this with this patch:

diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index e2b6616..e01cc13 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -266,15 +266,17 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,

    self.cf0 = CowIdeDisk(driveID='master')
    self.cf0.childImage(mdesc.disk())
+   self.disk2 = CowIdeDisk(driveID='master')
+   self.disk2.childImage(disk('workloads.img'))
    # Old platforms have a built-in IDE or CF controller. Default to
    # the IDE controller if both exist. New platforms expect the
    # storage controller to be added from the config script.
    if hasattr(self.realview, "ide"):
-       self.realview.ide.disks = [self.cf0]
+       self.realview.ide.disks = [self.cf0, self.disk2]
    elif hasattr(self.realview, "cf_ctrl"):
-       self.realview.cf_ctrl.disks = [self.cf0]
+       self.realview.cf_ctrl.disks = [self.cf0, self.disk2]
    else:
-       self.pci_ide = IdeController(disks=[self.cf0])
+       self.pci_ide = IdeController(disks=[self.cf0, self.disk2])
        pci_devices.append(self.pci_ide)

    self.mem_ranges = []

Note that in this example, you have to supply an image called workloads.img in your M5_PATH (an environment variable for gem5 pointing the a directorycontaining system files). Of course you can change this to any value youwant or pass it via an option.

Also note that when booted, you have to mount the second disk first by using the normal tools to mount a disk. This can be done by e.g.

sudo mount /dev/sdb1 /mnt

All files in the second disk image will then be present under /mnt

tmnvnbl
  • 61
  • 8
  • Hello Timon, please summarize the relevant parts of the solution on the answer to comply with Stack Overflow guidelines. Hopefully in a more direct "apply this patch" / "run this command" way. – Ciro Santilli Jun 26 '18 at 12:20
  • 1
    I updated this post since I had time to test it out, making sure I did not post something really stupid. – tmnvnbl Jul 02 '18 at 13:37
  • A patch has been merged to make this possible by default: https://stackoverflow.com/a/60210181/9160762 – Ciro Santilli Feb 13 '20 at 14:32
1

It is possible out-of-box since gem5 a6d98140 (January 2020)

Added in: https://gem5-review.googlesource.com/c/public/gem5/+/23671/6

You can now just use --disk-image multiple times as in:

build/ARM/gem5.opt scripts/example/fs.py \
  --disk-image path/to/my.ext2 --disk-image path/to/another.ext2

The extra images are then available to mount with as /dev/sda, /dev/sdb, etc. under Linux.

Don't forget that you can only mount on guest after restoring the checkpoint (or you have to unmount on guest, modify the disk on host, and remount on guest). Otherwise, the guest kernel memory will still be expecting a different filesystem which was swapped under its feet.

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44