On 26/07/2023 10:14, Jan-Marc Stranz wrote:
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?

Did you run jailhouse-config-check over the combination of different configurations?

The ENOMEM must happen somewhere in the driver or hypervisor. You could add printks to boil that down.

What you could try: You could give the hypervisor more memory (hypervisor_memory.size). Of course, you have align everything to the new layout then. Maybe the HV runs out of memory, as it must keep track of more page tables, as the cell gets more memory.

  Ralf


Jan-Marc.

--
You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/81fa9191-18dd-4003-9cfb-bed496d5723fn%40googlegroups.com <https://groups.google.com/d/msgid/jailhouse-dev/81fa9191-18dd-4003-9cfb-bed496d5723fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/faf9ae5c-7f62-5814-7453-793bffb881c3%40oth-regensburg.de.

Reply via email to