Thursday, July 14, 2016

Loading problem when I load rtems to cell with a loader file


when I started to load rtems to cell, I asked about loading rtems to Jan and I got a email.

you need to load the .bin of your RTEMS build into the inmate memory 
apparently, there is the need for a loader in addition 
if running over KVM, find the binary attached (still looking for the sources)

The email had a loader file for loading rtems to jailhouse.

I should select a address for rtems when I load a rtems file to cell.

First time, I used 0xf0000 for the loader file and 0x100000 for rtems.
I got a error when I load rtems.

 JAILHOUSE_CELL_LOAD: Invalid argument 
I found that I get a error when I load wrong address.

I have tried various address 0x0 to 0x3b000000.

>> Initializing Jailhouse hypervisor v0.5 (262-g425f61a-dirty) on CPU 0
>> Code location: 0xfffffffff0000030
>> Using x2APIC
>> Page pool usage after early setup: mem 40/1498, remap 64/131072
>> Initializing processors:
>> CPU 0... (APIC ID 0) OK
>> CPU 2... (APIC ID 2) OK
>> CPU 1... (APIC ID 1) OK
>> CPU 3... (APIC ID 3) OK
>> WARNING: No VT-d support found!
>> Adding PCI device 00:01.0 to cell "QEMU-VM"
>> Adding PCI device 00:02.0 to cell "QEMU-VM"
>> Adding PCI device 00:1b.0 to cell "QEMU-VM"
>> Adding PCI device 00:1f.0 to cell "QEMU-VM"
>> Adding PCI device 00:1f.2 to cell "QEMU-VM"
>> Adding PCI device 00:1f.3 to cell "QEMU-VM"
>> Adding PCI device 00:1f.7 to cell "QEMU-VM"
>> Adding virtual PCI device 00:0f.0 to cell "QEMU-VM"
>> Page pool usage after late setup: mem 179/1498, remap 65606/131072
>> Activating hypervisor
>> Virtual PCI connection established "linux-x86-demo" <--> "QEMU-VM"
>> Adding virtual PCI device 00:0f.0 to cell "linux-x86-demo"
>> Created cell "linux-x86-demo"
>> Page pool usage after cell creation: mem 226/1498, remap 65606/131072
>> Cell "linux-x86-demo" can be loaded
>> CPU 1 received SIPI, vector 100
>> CPU 2 received SIPI, vector 100
>> CPU 3 received SIPI, vector 100
>> Started cell "linux-x86-demo"
>> FATAL: Unsupported paging mode
>> FATAL: Invalid MMIO/RAM read, addr: 0x000000000010000c
>> RIP: 0x000000000010000c RSP: 0x00000000000e0000 FLAGS: 10006
>> RAX: 0x000000000010000c RBX: 0x0000000000000000 RCX: 0x0000000000000000
>> RDX: 0x0000000000000000 RSI: 0x0000000000000000 RDI: 0x0000000000000000
>> CS: 8 BASE: 0x0000000000000000 AR-BYTES: c09f EFER.LMA 0
>> CR0: 0x0000000000000031 CR3: 0x0000000000000000 CR4: 0x0000000000002000
>> EFER: 0x0000000000000000
>> Parking CPU 1 (Cell: "linux-x86-demo")

>> #jailhouse cell load 1 hello.bin -a 0xe0000
>>
>> JAILHOUSE_CELL_LOAD: Invalid argument

So I also asked Maxim who wrote a jailhouse paper.
He said 

Hello!
Usually, this error appeared when binary which you load into cell is bigger than the memory region in your cell's configuration. So, firstly, try to check if memory regions in your cell configuration are big enough. Binary must fit into one of your memory regions (considering the offset which you specied with -a option; so, offset+size of the binary must be smaller than the memregion). Jailhouse does not do more sothisticated checks than this size check.
When I ported the Fiasco, it was needed to tune memory regions in the fiasco's cell (and also check if nonroot cell's memory does not interfere with root cell's memregs).

I hope this simple idea will help. If you have some other questions I would be happy to help you.

As his advice, I will try to change a config file memory setting.

No comments:

Post a Comment