Re: [PATCH] tools: config-create: update iomem parser to work on recent kernels

2018-03-22 Thread Henning Schild
In case it does matter, i think it is coming from
... arch/x86/kernel/e820.c
and 4.12 changed it to first letter capital.

Henning

Am Thu, 22 Mar 2018 17:28:51 +0100
schrieb Henning Schild :

> More recent kernels (did not try to identify which version) spell the
> string "reserved" with a capital letter in front. Match both and
> support old and new kernels.
> 
> Reported-by: Anil Kumar 
> Signed-off-by: Henning Schild 
> ---
>  tools/jailhouse-config-create | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/jailhouse-config-create
> b/tools/jailhouse-config-create index ce2affce..177a8232 100755
> --- a/tools/jailhouse-config-create
> +++ b/tools/jailhouse-config-create
> @@ -562,7 +562,7 @@ class IOMemRegionTree:
>  continue
>  
>  # generally blacklisted, unless we find an HPET behind it
> -if (s == 'reserved'):
> +if (s == 'reserved' or s == 'Reserved'):
>  regions.extend(IOMemRegionTree.find_hpet_regions(tree))
>  continue
>  

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: jailhouse config size issue while accessing memory region

2018-03-22 Thread Henning Schild
Am Wed, 21 Mar 2018 09:45:09 -0700
schrieb :

> On Wednesday, March 21, 2018 at 8:54:00 PM UTC+5:30, Henning Schild
> wrote:
> > Am Wed, 21 Mar 2018 07:31:43 -0700
> > schrieb :
> >   
> > > Hi Jan,
> > > we are working on jailhouse on x86 and facing some issues with
> > > system(root cell) config. This is one of the issue while
> > > accessing /proc/iomem for our system x86 (xeon)
> > > 
> > >   7933d018-7933d018 : APEI ERST
> > >   7933d01c-7933d021 : APEI ERST
> > >   7933d028-7933d039 : APEI ERST
> > >   7933d040-7933d04c : APEI ERST
> > >   7933d050-7933f04f : APEI ERST  
> > 
> > This is just a part of /proc/iomem, so far i do not understand where
> > the issue/problem is.
> >   
> > > we are doing memory size check  while accessing memory regions
> > > from rootcell config.  
> > 
> > What does that mean? Did you modify jailhouse or are you processing
> > the configs somehow? Or are you talking about a check inside an
> > unmodified jailhouse?
> >   
> > > From the above information in /proc/iomem, jailhouse
> > > generating config file with "zero" size.  
> > 
> > The first line will result in size 0, in the others the size should
> > get rounded up to at least one page.
> >   
> > > we want to know is there any
> > > issue with creating size for some of the memory regions.  
> > 
> > The example you sent is incomplete and the generator might not be
> > able to handle those lines correctly. The start should be
> > page-alligned. On the Xeons i have, i see similar lines but they
> > are behind a "reserverd" and should be ignored.
> > 
> > Please send the output of "jailhouse config collect /tmp/target.tar"
> > and explain you problem in more detail.
> > 
> > Henning
> >   
> > > Regards,
> > > Anil
> > >  
> 
> Hi Henning,
> Thanks for your reply. please find my rootcell config generated by
> jailhouse and system /proc/iomem files. Regards,

The iomem-parser matched "reserved" and not "Reserved" when ignoring
regions. So in your case the regions where added. On my 4.14.28 box
the string is also "Reserved", i just sent a patch.
Please apply it to your jailhouse and let me know if it works.

Henning 

> Anil
> 

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[PATCH] tools: config-create: update iomem parser to work on recent kernels

2018-03-22 Thread Henning Schild
More recent kernels (did not try to identify which version) spell the
string "reserved" with a capital letter in front. Match both and support
old and new kernels.

Reported-by: Anil Kumar 
Signed-off-by: Henning Schild 
---
 tools/jailhouse-config-create | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create
index ce2affce..177a8232 100755
--- a/tools/jailhouse-config-create
+++ b/tools/jailhouse-config-create
@@ -562,7 +562,7 @@ class IOMemRegionTree:
 continue
 
 # generally blacklisted, unless we find an HPET behind it
-if (s == 'reserved'):
+if (s == 'reserved' or s == 'Reserved'):
 regions.extend(IOMemRegionTree.find_hpet_regions(tree))
 continue
 
-- 
2.16.1

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jailhouse zynqMP

2018-03-22 Thread Ralf Ramsauer


On 03/22/2018 04:23 PM, iallende wrote:
> El miércoles, 21 de marzo de 2018, 15:25:02 (UTC+1), Ralf Ramsauer  escribió:
>> Hi,
>>
>> On 03/21/2018 02:54 PM, iallende wrote:
>>> Hi everyone,
>>>
>>> I am trying to run Jailhouse in the ZynqMP, with Linux PREEMPT RT in 
>>> another cell. However, I have some problems when I add the second Linux.
>>>
>>> root@xilinx-zcu102-2017_4:/# modprobe jailhouse
>>> [   52.445169] jailhouse: loading out-of-tree module taints kernel.
>>> root@xilinx-zcu102-2017_4:/# ls /dev/jailhouse ^C
>>> root@xilinx-zcu102-2017_4:/# jailhouse enable zynqmp-zcu102.cell 
>>>
>>> Initializing Jailhouse hypervisor v0.7 (0-g5c13b64) on CPU 2
>> Please checkout next and try again. This might already fix your issue.
> With v0.8 i get this WARNING and I can load the module:
> WARNING: "__hyp_stub_vectors" [/jailhouse/driver/jailhouse.ko] undefined!
Please switch to next, and not to v0.8. Compile your kernel with
CONFIG_KALLSYMS_ALL=y, or use this [1] patch.

  Ralf

[1]
http://git.kiszka.org/?p=linux.git;a=commit;h=2a681cb2213e3ea0f142fae7345fb80208a88a53
>>> Code location: 0xc0200050
>>> Page pool usage after early setup: mem 33/996, remap 64/131072
>>> Initializing processors:
>>>  CPU 2... OK
>>>  CPU 0... OK
>>>  CPU 3... OK
>>>  CPU 1... OK
>>> Adding virtual PCI device 00:00.0 to cell "ZynqMP-ZCU102"
>>> Adding virtual PCI device 00:01.0 to cell "ZynqMP-ZCU102"
>>> Page pool usage after late setup: mem 42/996, remap 69/131072
>>> Activating hypervisor
>>> [   63.697232] jailhouse: CONFIG_OF_OVERLAY disabled
>>> [   63.704029] jailhouse: failed to add virtual host controller
>>> [   63.711610] The Jailhouse is opening.
>>>
>>> root@xilinx-zcu102-2017_4:/# jailhouse cell linux 
>>> zynqmp-zcu102-linux-demo.cell Image -d system.dtb -i rootfs.cpio 
>>>
>>> FATAL: unhandled trap (exception class 0x17)
>> Exception class 0x17 is a SMC64 call.
>>
>>> Cell state before exception:
>>>  pc: ff800808e390   lr: ff8008467504 spsr: 2145 EL1
>>>  sp: ffc87b927ab0  esr: 17 1 000
>>>  x0: c214   x1: fd1a0060   x2: 
>> Furthermore, it's a SIP_64.
>>
>> Commit 2482c47bc2d05f ("arm64: ignore SIPs used for low-power modes") on
>> next will probably fix your issue.
>>
>>   Ralf
>>>  x3:    x4:    x5: 
>>>  x6:    x7:    x8: ff8008d27ee0
>>>  x9: ffc87aaa4b5c  x10: ffc87b927b4c  x11: ff8008c8ccb2
>>> x12:   x13: 0f93  x14: 0001
>>> x15:   x16: ff8008193240  x17: 004128f0
>>> x18: 00040900  x19: ffc87b927b28  x20: 0001
>>> x21: 4784b740  x22: 4784b740  x23: fffa
>>> x24: 000f4240  x25: 000f4240  x26: 000f4240
>>> x27:   x28:   x29: ffc87b927ac0
>>>
>>> Parking CPU 2 (Cell: "ZynqMP-ZCU102")
>>>
>>>
>>> Does anyone know why I have this problem? Am I missing any step?
>>>
> 

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jailhouse zynqMP

2018-03-22 Thread iallende
El miércoles, 21 de marzo de 2018, 15:25:02 (UTC+1), Ralf Ramsauer  escribió:
> Hi,
> 
> On 03/21/2018 02:54 PM, iallende wrote:
> > Hi everyone,
> > 
> > I am trying to run Jailhouse in the ZynqMP, with Linux PREEMPT RT in 
> > another cell. However, I have some problems when I add the second Linux.
> > 
> > root@xilinx-zcu102-2017_4:/# modprobe jailhouse
> > [   52.445169] jailhouse: loading out-of-tree module taints kernel.
> > root@xilinx-zcu102-2017_4:/# ls /dev/jailhouse ^C
> > root@xilinx-zcu102-2017_4:/# jailhouse enable zynqmp-zcu102.cell 
> > 
> > Initializing Jailhouse hypervisor v0.7 (0-g5c13b64) on CPU 2
> Please checkout next and try again. This might already fix your issue.
With v0.8 i get this WARNING and I can load the module:
WARNING: "__hyp_stub_vectors" [/jailhouse/driver/jailhouse.ko] undefined!
> > Code location: 0xc0200050
> > Page pool usage after early setup: mem 33/996, remap 64/131072
> > Initializing processors:
> >  CPU 2... OK
> >  CPU 0... OK
> >  CPU 3... OK
> >  CPU 1... OK
> > Adding virtual PCI device 00:00.0 to cell "ZynqMP-ZCU102"
> > Adding virtual PCI device 00:01.0 to cell "ZynqMP-ZCU102"
> > Page pool usage after late setup: mem 42/996, remap 69/131072
> > Activating hypervisor
> > [   63.697232] jailhouse: CONFIG_OF_OVERLAY disabled
> > [   63.704029] jailhouse: failed to add virtual host controller
> > [   63.711610] The Jailhouse is opening.
> > 
> > root@xilinx-zcu102-2017_4:/# jailhouse cell linux 
> > zynqmp-zcu102-linux-demo.cell Image -d system.dtb -i rootfs.cpio 
> > 
> > FATAL: unhandled trap (exception class 0x17)
> Exception class 0x17 is a SMC64 call.
> 
> > Cell state before exception:
> >  pc: ff800808e390   lr: ff8008467504 spsr: 2145 EL1
> >  sp: ffc87b927ab0  esr: 17 1 000
> >  x0: c214   x1: fd1a0060   x2: 
> Furthermore, it's a SIP_64.
> 
> Commit 2482c47bc2d05f ("arm64: ignore SIPs used for low-power modes") on
> next will probably fix your issue.
> 
>   Ralf
> >  x3:    x4:    x5: 
> >  x6:    x7:    x8: ff8008d27ee0
> >  x9: ffc87aaa4b5c  x10: ffc87b927b4c  x11: ff8008c8ccb2
> > x12:   x13: 0f93  x14: 0001
> > x15:   x16: ff8008193240  x17: 004128f0
> > x18: 00040900  x19: ffc87b927b28  x20: 0001
> > x21: 4784b740  x22: 4784b740  x23: fffa
> > x24: 000f4240  x25: 000f4240  x26: 000f4240
> > x27:   x28:   x29: ffc87b927ac0
> > 
> > Parking CPU 2 (Cell: "ZynqMP-ZCU102")
> > 
> > 
> > Does anyone know why I have this problem? Am I missing any step?
> >

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unhandled VM-Exit, reason 3qualification 0vectoring info:

2018-03-22 Thread m . rajendran
On Wednesday, March 21, 2018 at 9:12:45 PM UTC-4, J. Kiszka wrote:
> On 2018-03-22 01:02, anilapp...@gmail.com wrote:
> > Hi Jan/Henning,
> > we are using jailhouse on x86 xeon pc. please find below file for 
> > /proc/iomem and find attached rootcell and non rootcell config files.  This 
> > is the console out.  
> > 
> > Adding PCI device ff:1f.2 to cell "RootCell"Page pool usage after late 
> > setup: mem 464/16328, remap 66078/131072Activating hypervisorWARNING: 
> > Overflow during MMIO region registration!CAT: Shrunk root cell bitmask to 
> > 000cCAT: Using COS 1 with bitmask 0003 for cell RedHawk 4.9.47 non 
> > rootWARNING: Overflow during MMIO region registration!Created cell "RedHawk 
> > 4.9.47 non root"Page pool usage after cell creation: mem 2537/16328, remap 
> > 66078/131072Cell "RedHawk 4.9.47 non root" can be loadedCPU 2 received 
> > SIPI, vector 100Started cell "RedHawk 4.9.47 non root"CPU 3 received SIPI, 
> > vector 100FATAL: Unhandled VM-Exit, reason 3qualification 0vectoring info: 
> > 0 interrupt info: 0RIP: 0xaa8eca00 RSP: 0x8dc95f208fd8 FLAGS: 
> > 46RAX: 0x0020 RBX: 0x0008 RCX: 
> > 0x0001RDX: 0x RSI: 0xaaec74c0 RDI: 
> > 0x8dc95f226b00CS: 10 BASE: 0x AR-BYTES: a09b EFER.LMA 
> > 1CR0: 0x80050033 CR3: 0x00084bc13002 CR4: 
> > 0x003626e0EFER: 0x0d01Parking CPU 8 (Cell: 
> > "RootCell")FATAL: Unhandled VM-Exit, reason 3qualification 0vectoring info: 
> > 0 interrupt info: 0RIP: 0x RSP: 0x8dc95f208fd8 FLAGS: 
> > 46RAX: 0x0020 RBX: 0x0008 RCX: 
> > 0x0001RDX: 0x RSI: 0xaaec74c0 RDI: 
> > 0x8dc95f226b00CS: 10 BASE: 0x AR-BYTES: a09b EFER.LMA 
> > 1CR0: 0x80050033 CR3: 0x00084bc13002 CR4: 
> > 0x003626e0EFER: 0x0d01Parking CPU 8 (Cell: "RootCell")
> > 
> > can you please help what could be the reason for this error.
> 
> Looking at your config, that crash, which is an unexpected (and
> unsupported) INIT signal sent from a physical APIC to another, would
> show up when you directly map the APIC page at 0xfee0 into a guest.
> Was the related memory region active in the case above? Don't do that.
> 
> Jan
> -- 
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE
> Corporate Competence Center Embedded Linux

Hi Jan,

As per your suggestion, we have disabled the APIC region in both root and non 
root cell.
But still we get crash as below:

WARNING: Overflow during MMIO region registration!
CAT: Shrunk root cell bitmask to 000c
CAT: Using COS 1 with bitmask 0003 for cell Linux 4.9.47 non root
WARNING: Overflow during MMIO region registration!
Created cell "Linux 4.9.47 non root"
Page pool usage after cell creation: mem 2538/16328, remap 66078/131072
FATAL: Invalid MMIO/RAM read, addr: 0xc72a4000 size: 4
RIP: 0xc0348121 RSP: 0xc10406b77dd8 FLAGS: 10246
RAX: 0xc1040756 RBX: 0x9ff1168d48c0 RCX: 0x
RDX: 0x RSI: 0x0246 RDI: 0x9ff1168d48c0
CS: 10 BASE: 0x AR-BYTES: a09b EFER.LMA 1
CR0: 0x80050033 CR3: 0x000856fab002 CR4: 0x003626f0
EFER: 0x0d01
Parking CPU 0 (Cell: "RootCell")
Cell "Linux 4.9.47 non root" can be loaded
FATAL: Unhandled VM-Exit, reason 26
qualification 0
vectoring info: 0 interrupt info: 0
RIP: 0x9904f4a2 RSP: 0x9ff122a43fc8 FLAGS: 2
RAX: 0x003626e0 RBX: 0x9ff122a66b00 RCX: 0x7ffefbff
RDX: 0xbfebfbff RSI: 0x9ff122a43fd0 RDI: 0x9ff122a43fcc
CS: 10 BASE: 0x AR-BYTES: a09b EFER.LMA 1
CR0: 0x80050033 CR3: 0x000856fab006 CR4: 0x003626e0
EFER: 0x0d01
Parking CPU 1 (Cell: "RootCell")  

The complete log attached in the mail. can you please help to address this issue

Below is the cmdline used for host-system.
BOOT_IMAGE=/vmlinuz-4.14.0-rc4 root=/dev/mapper/centos-root ro crashkernel=auto 
rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet intel_iommu=off 
memmap=3136M$0x4

Host system details are below:
Centos 7.4 Version
gcc 5.4.0 version
make 3.82 version

Root-cell details:
linux-4.14.0-rc4

Non-root-cell details:
centos7 userland
linux4.9.47 kernel(having jailhouse patches)

Details of /proc/iomem and /proc/ioports are attached in this email-thread.
Kindly refer them.

Thanks in advance

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[root@localhost jailhouse-ubuntu]# cat /proc/iomem
-0fff : Reserved
1000-000997ff : System RAM
00099800-0009 : Reserved
000a-000b : 

Re: Cant start Inmates with YOCTO-Linux RootCell

2018-03-22 Thread alex . ciobotaru
Hi Jan,

I think I'm in Daniel's situation, where we change the memory layout, so we 
also need to change the inmate comm region stuff.

Flow:
- Reserve one big contiguous chunk of memory (i.e. memmap=256M@512M)
- Get the whole chunk in the root cell
- Steal in the tiny-demo cell two regions:
   /* MemRegion: Inmate location (8 MB) */
   .phys_start = 0x2400,
   .virt_start = 0x0 /* tiny-demo.bin entrypoint */
   .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
   ---
   /* MemRegion: Comm region for Hypervisor */
   .virt_start = 0x2480,
   .size = 0x1000,
   .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_COMM_REGION

I don't have a crash like him, but my tine-demo refuses to print the "Hello 
from this tiny cell!" on tty1, though it executes code.

Anyway I think that's the reason we should change  
COMM_REGION define?

Or is the 0x1 in the virtual space of the inmate?

Thanks,
Alex

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: jailhouse config size issue while accessing memory region

2018-03-22 Thread Anil Kumar
Hi Alex,
Thanks for your reply. Yes since my system has this configuration,
jailhouse is generating this memory size "0". But I don't want to create
memory region with "0" size. Because no one can either read/write into this
region. so I want to give some size or don't want to create such a memory
region while configuring and I don't want to change after creating system
config. I want to take care of this while generating system config.Can you
please suggest some thoughts.
Regards,
Anil

On Thu, Mar 22, 2018 at 1:28 PM,  wrote:

> Hi,
>
> Well, the config script reads, parses and generates the memory regions
> based on your system /proc/iomem layout.
>
> In your attachment, you have:
>
> 79162000-79a5efff : Reserved
>   7933d018-7933d018 : APEI ERST
>   7933d01c-7933d021 : APEI ERST
>
> This will restult in zero-sized memory regions in the generated root cell.
> Please check your host setup.
>
> -Alex
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jailhouse" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jailhouse-dev/H0NxGoDOV9I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jailhouse-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: jailhouse config size issue while accessing memory region

2018-03-22 Thread alex . ciobotaru
Hi,

Well, the config script reads, parses and generates the memory regions based on 
your system /proc/iomem layout.

In your attachment, you have:

79162000-79a5efff : Reserved
  7933d018-7933d018 : APEI ERST
  7933d01c-7933d021 : APEI ERST

This will restult in zero-sized memory regions in the generated root cell. 
Please check your host setup.

-Alex

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.