I have a HW target with Intel core i5 (11th generation) and 32 GB RAM.
In the hypervisor configuration for the root cell, 1 GiB (1024 MiB) is
reserved for guest cells:
/* MemRegion: 110600000-1505fffff : guest cells (1024 MiB) */
{
.phys_start = 0x110600000,
.virt_start = 0x110600000,
.size = 0x40000000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
In the configurations for the guest cells, this area is divided so that
each guest cell can use a maximum of 512 MiB:
Guest 1:
/* MemRegion: 110600000-1305fffff : Guest Cell (1) (max. 512
MiB) */
/* Low RAM (1 MiB) */
{
.phys_start = 0x110600000,
.virt_start = 0,
.size = 0x100000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE,
},
/* Communication region (4 KiB) */
{
.virt_start = 0x00100000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_COMM_REGION,
},
/* High RAM (max. 511 MiB) */
{
.phys_start = 0x110700000,
.virt_start = 0x00200000,
.size = 0x1ff00000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE,
},
Guest 2:
/* MemRegion: 130600000-1505fffff : Guest Cell (2) (max. 512
MiB) */
/* Low RAM (1 MiB) */
{
.phys_start = 0x130600000,
.virt_start = 0,
.size = 0x100000 ,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE,
},
/* Communication region (4 KiB) */
{
.virt_start = 0x00100000,
.size = 0x100000 ,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_COMM_REGION,
},
/* High RAM (max. 511 MiB) */
{
.phys_start = 0x130700000,
.virt_start = 0x00200000,
.size = 0x1ff00000 ,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE,
},
If only 320 MiB is used in both guest cells, then the guest cells can be
successfully started one after the other with the command "jailhouse
cell linux".
However, if more than 320 MiB is used in guest cells (e.g. 336 MiB),
then only one of the two guest cells can be successfully started.
When the 2nd guest cell is started, an error message is issued:
Traceback (most recent call last):
File "/usr/libexec/jailhouse/jailhouse-cell-linux", line 737, in <module>
cell = JailhouseCell(config)
File "/usr/lib/python3.8/site-packages/pyjailhouse/cell.py", line 36,
in __init__
raise e
File "/usr/lib/python3.8/site-packages/pyjailhouse/cell.py", line 33,
in __init__
fcntl.ioctl(self.dev, JailhouseCell.JAILHOUSE_CELL_CREATE, create)
OSError: [Errno 12] Cannot allocate memory
ERROR: Linux guest cell not started!
I have now run numerous tests with different sizes for the guest cells
and have come to the limit of 320 MiB, at which both guest cells can
still be started.
However, I cannot see why both guest cells cannot be started.
Actually, in the configuration for the root cell, enough memory has been
reserved for both guest cells.
Is there an explanation for this unexpected behavior?