Skip to contentSkip to conversation

Bash often segfaults in Dom0 with the latest Xen

ARM Julien Grall 4 participants 18 messages Jun 4, 2013 – Jun 11, 2013

lore
Share & tools
lore
#0 lore raw

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Cheers,

--
Julien Grall

#1 lore raw
Quoted 54 lines · Julien Grall

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

Quoted 6 lines

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Some thoughts:

- Does dom0 run with Stage-2 translation? If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

- Are you doing any swapping and/or page reclaiming? I wouldn't
assume so for dom0, but if you are, you need to maintain the icache properly, since it can be aliasing, see
http://lxr.linux.no/linux+v3.9.4/arch/arm/kvm/mmu.c#L495 (I doubt this is the case though)

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

- Are you managing the VMID properly across physical CPU migration? (ensure that dom0 always uses the same vmid regardless of the physical cpu)

- Do you always see the crash in user space or kernel space in dom0 or is it all over the map?

-Christoffer

#16 lore raw
In reply to Julien Grall
Quoted 2 lines · Julien Grall

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.

FWIW the dom0_vcpus_pin command line parameter should have achieved the same thing without removing the WFI code paths. I very much doubt that code path is to blame but it might be worth ruling it out.

Ian.

#2 lore raw
In reply to Christoffer Dall
Quoted 1 line · Christoffer Dall

- Does dom0 run with Stage-2 translation?

Yes.

Quoted 5 lines

If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

For some reason I had it in my head that the monitor used by the load/store exclusive instructions was somehow tied to the cache controller (i.e. you can't use them with caching disabled) which makes it impossible to disable caching if you are using them in your spinlock routines.

I can't actually find anything to that affect in the ARM ARM now though -- Am/was I imagining things?

Quoted 1 line

- Are you doing any swapping and/or page reclaiming?

At the hypervisor level you mean? No.

dom0 might be swapping itself but I don't think that is what you meant and I expect Julien doesn't have a swap device configured in any case.

Quoted 3 lines

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

Agreed.

Quoted 3 lines

- Are you managing the VMID properly across physical CPU migration? (ensure that dom0 always uses the same vmid regardless of the physical cpu)

Currently VMID = DOMID + 1 so yes.

Ian.

#17 lore raw
In reply to Ian Campbell
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Julien Grall

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.

FWIW the dom0_vcpus_pin command line parameter should have achieved the same thing without removing the WFI code paths. I very much doubt that code path is to blame but it might be worth ruling it out.

Thanks for this option.

Signature · 1 line
Julien
#3 lore raw
In reply to Christoffer Dall
Quoted 76 lines · Christoffer Dall
Quoted 54 lines · Julien Grall

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

Quoted 6 lines

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Some thoughts:

- Does dom0 run with Stage-2 translation? If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

- Are you doing any swapping and/or page reclaiming? I wouldn't
assume so for dom0, but if you are, you need to maintain the icache properly, since it can be aliasing, see
http://lxr.linux.no/linux+v3.9.4/arch/arm/kvm/mmu.c#L495 (I doubt this is the case though)

Quoted 3 lines

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

It was only an idea because I have noticed the memory was often corrupted.

Quoted 2 lines

- Do you always see the crash in user space or kernel space in dom0 or is it all over the map?

Only in user space in dom0.

Signature · 1 line
Julien
#4 lore raw
Quoted 82 lines · Julien Grall
Quoted 76 lines · Christoffer Dall
Quoted 54 lines · Julien Grall

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

Quoted 6 lines

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Some thoughts:

- Does dom0 run with Stage-2 translation? If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

- Are you doing any swapping and/or page reclaiming? I wouldn't
assume so for dom0, but if you are, you need to maintain the icache properly, since it can be aliasing, see
http://lxr.linux.no/linux+v3.9.4/arch/arm/kvm/mmu.c#L495 (I doubt this is the case though)

Quoted 3 lines

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

Quoted 8 lines

It was only an idea because I have noticed the memory was often corrupted.

Quoted 2 lines

- Do you always see the crash in user space or kernel space in dom0 or is it all over the map?

Only in user space in dom0.

Hmm, which kernel version is dom0 based on? Can you bisect the dom0 source to make sure it's not something introduced during development.

You have this in your tree right: "9d1f5c ARM: 7641/1: memory: fix broken mmap..." ?

-Christoffer

#5 lore raw
Quoted 7 lines · Christoffer Dall
Quoted 2 lines

Only in user space in dom0.

Hmm, which kernel version is dom0 based on? Can you bisect the dom0 source to make sure it's not something introduced during development.

You have this in your tree right: "9d1f5c ARM: 7641/1: memory: fix broken mmap..." ?

FYI 9d1f5c is ambiguous in my tree, 79d1f5c AKA 79d1f5c9acf9fc8d06e5537083b19114ce87159f is the unambiguous commit at least for me.

Ian.

Quoted 7 lines

-Christoffer

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
In reply to Christoffer Dall
Quoted 85 lines · Christoffer Dall
Quoted 84 lines · Julien Grall
Quoted 76 lines · Christoffer Dall
Quoted 54 lines · Julien Grall

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

Quoted 6 lines

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Some thoughts:

- Does dom0 run with Stage-2 translation? If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

- Are you doing any swapping and/or page reclaiming? I wouldn't
assume so for dom0, but if you are, you need to maintain the icache properly, since it can be aliasing, see
http://lxr.linux.no/linux+v3.9.4/arch/arm/kvm/mmu.c#L495 (I doubt this is the case though)

Quoted 3 lines

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

It was only an idea because I have noticed the memory was often corrupted.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

- Do you always see the crash in user space or kernel space in dom0 or is it all over the map?

Only in user space in dom0.

Hmm, which kernel version is dom0 based on? Can you bisect the dom0 source to make sure it's not something introduced during development.

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 2 lines

You have this in your tree right: "9d1f5c ARM: 7641/1: memory: fix broken mmap..." ?

Yes.

Signature · 1 line
Julien
#7 lore raw
Quoted 102 lines · Julien Grall
Quoted 85 lines · Christoffer Dall
Quoted 84 lines · Julien Grall
Quoted 76 lines · Christoffer Dall
Quoted 54 lines · Julien Grall

Hi all,

Since a couple of week, I'm tracking an issue with Xen on ARM with no luck.

I'm run out of idea, so I send this email to have advice from the community.

Most of the time bash will abort with random error in dom0:
- page fault (data and prefetch abort)
- memory corruption (malloc corruption and invalid pointer)

It's easily to reproduce by doing ./configure on the xen tree.

My environment is an arndale board:
- linux linaro 13.05 (using arndale_xen_dom0_defconfig and exynos5250_arndale.dts)
- opensuse 12.03 (http://en.opensuse.org/HCL:Arndale)
- xen upstream

The linux tree can be retrieved from git://xenbits.xen.org/people/julieng/linux-arm.git
using the branch linaro-3.10.
The previous branch is based on the linaro tree with some patches for the dts and xen.

The issue also occurs on the versatile express. But it's harder to reproduce. Here the environment is:
- linux linaro 13.05 (using vexpress_xen_dom0_defconfig and vexpress_v2p_ca15_a7.dtb)
- ubuntu linaro 13.05
- xen upstream

I have tried different distributions and linux version, the issue was the same. I made some testing to narrow down the bug and I came to the following test case:

Only dom0 is running and each VCPUs are pinned to a specific cpu (vcpu0 -> cpu0 and vcpu1 -> cpu1).

The patch below removes WFI trap and by consequence avoid a VCPU to move to another physical CPU.
=========================================

xen/arch/arm/traps.c +1 -1
index 6cfba1a..e89ca15 100644
@@ -62,7 +62,7 @@ void __cpuinit init_traps(void)
     WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2);
 
     /* Setup hypervisor traps */
-    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TWI|HCR_TSC, HCR_EL2);
+    WRITE_SYSREG(HCR_PTW|HCR_BSU_OUTER|HCR_AMO|HCR_IMO|HCR_VM|HCR_TSC, HCR_EL2);
     isb();
 }
 

=========================================

If a bash process is assigned to a specific cpu with taskset, the process seems to always run without any issue.

Quoted 6 lines

taskset -c 0 ./configure

I guess it's a caching issue, but each time I've tried to play with the caching policy Linux was not booting.

Thanks in advance for any advice.

Some thoughts:

- Does dom0 run with Stage-2 translation? If so, you should be able
to disable caches in both Hyp mode and for dom0 by manipulating the hyp registers to try and exclude caches. If Linux doesn't boot under such configuration, something else is completely broken, as it must be transparent to your dom0.

- Are you doing any swapping and/or page reclaiming? I wouldn't
assume so for dom0, but if you are, you need to maintain the icache properly, since it can be aliasing, see
http://lxr.linux.no/linux+v3.9.4/arch/arm/kvm/mmu.c#L495 (I doubt this is the case though)

Quoted 3 lines

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

It was only an idea because I have noticed the memory was often corrupted.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

- Do you always see the crash in user space or kernel space in dom0 or is it all over the map?

Only in user space in dom0.

Hmm, which kernel version is dom0 based on? Can you bisect the dom0 source to make sure it's not something introduced during development.

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

Quoted 6 lines

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

If you put it like that, it would seem to me that the most likely candidate would be a bug in SMP support in Xen.
What happen if you have 2 pCPU, 1vCPU but you keep moving the vCPU between the two pCPU?

#8 lore raw
In reply to Julien Grall
Quoted 7 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

Quoted 7 lines

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

-Christoffer

#9 lore raw
Quoted 14 lines · Christoffer Dall
Quoted 7 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

Quoted 7 lines

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 2 lines

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

Yes. It's same kernel with the same command line (ie without nosmp). I have limited the number of dom0 vcpus with dom0_max_vcpus=1 on xen command line.

--
Julien

#10 lore raw
Quoted 16 lines · Julien Grall
Quoted 14 lines · Christoffer Dall
Quoted 14 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 8 lines
Quoted 2 lines

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

Yes. It's same kernel with the same command line (ie without nosmp). I have limited the number of dom0 vcpus with dom0_max_vcpus=1 on xen command line.

It indicates a bug in Xen then. Curious that it only happens for user space in dom0, but perhaps you just haven't seen it in the kernel yet. Bash scripts are pretty intensive on page faults so perhaps there's a synchronization issue with some of your page fault handlers.

You could try to touch all the memory inside dom0 (dd to a ramfs for example) and then run your bash script and see if the problem still occurs, that should point you to whether it's a stage-2 fault handling issue, but this is not a fool-proof approach. Maybe Xen can pre-allocate all the stage-2 entries?

-Christoffer

#11 lore raw
Quoted 30 lines · Christoffer Dall
Quoted 16 lines · Julien Grall
Quoted 14 lines · Christoffer Dall
Quoted 14 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 8 lines
Quoted 2 lines

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

Yes. It's same kernel with the same command line (ie without nosmp). I have limited the number of dom0 vcpus with dom0_max_vcpus=1 on xen command line.

It indicates a bug in Xen then. Curious that it only happens for user space in dom0, but perhaps you just haven't seen it in the kernel yet. Bash scripts are pretty intensive on page faults so perhaps there's a synchronization issue with some of your page fault handlers.

Quoted 5 lines

You could try to touch all the memory inside dom0 (dd to a ramfs for example) and then run your bash script and see if the problem still occurs, that should point you to whether it's a stage-2 fault handling issue, but this is not a fool-proof approach. Maybe Xen can pre-allocate all the stage-2 entries?

Xen pre-allocates all the memory for stage-2 entries (no overcommit or populate on demand by default)

#12 lore raw
Quoted 31 lines · Stefano Stabellini
Quoted 30 lines · Christoffer Dall
Quoted 16 lines · Julien Grall
Quoted 14 lines · Christoffer Dall
Quoted 14 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 8 lines
Quoted 2 lines

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

Yes. It's same kernel with the same command line (ie without nosmp). I have limited the number of dom0 vcpus with dom0_max_vcpus=1 on xen command line.

It indicates a bug in Xen then. Curious that it only happens for user space in dom0, but perhaps you just haven't seen it in the kernel yet. Bash scripts are pretty intensive on page faults so perhaps there's a synchronization issue with some of your page fault handlers.

Quoted 8 lines
Quoted 5 lines

You could try to touch all the memory inside dom0 (dd to a ramfs for example) and then run your bash script and see if the problem still occurs, that should point you to whether it's a stage-2 fault handling issue, but this is not a fool-proof approach. Maybe Xen can pre-allocate all the stage-2 entries?

Xen pre-allocates all the memory for stage-2 entries (no overcommit or populate on demand by default)

what was the conclusion when pinning the vcpu to dedicated pcpus - did the error still show up?

#13 lore raw
Quoted 39 lines · Christoffer Dall
Quoted 37 lines · Stefano Stabellini
Quoted 35 lines · Christoffer Dall
Quoted 16 lines · Julien Grall
Quoted 14 lines · Christoffer Dall
Quoted 14 lines

I'm using the linaro's branch ll_20130528.0, I have only few patches for the dts and not yet in linaro tree patches.

I have the same issue with linux 3.9-rc4 with multiple CPUs and I can't really go before without carrying many xen patches to try it.

I have tried different configuration with the number of CPUs in Xen (pCPU) and linux (vCPU):
- 2 pCPU 2 vCPU : segfaulting
- 2 pCPU 1 vCPU : working
- 1 pCPU 1 vCPU : working
- 1 pCPU 2 vCPU : very slow but working

Quoted 8 lines
Quoted 2 lines

2 pCPU 1 vCPU are you still compiling your dom0 as an SMP kernel, but only creating 1 vCPU or are you actually compiling the dom0 as UP?

Yes. It's same kernel with the same command line (ie without nosmp). I have limited the number of dom0 vcpus with dom0_max_vcpus=1 on xen command line.

It indicates a bug in Xen then. Curious that it only happens for user space in dom0, but perhaps you just haven't seen it in the kernel yet. Bash scripts are pretty intensive on page faults so perhaps there's a synchronization issue with some of your page fault handlers.

You could try to touch all the memory inside dom0 (dd to a ramfs for example) and then run your bash script and see if the problem still occurs, that should point you to whether it's a stage-2 fault handling issue, but this is not a fool-proof approach. Maybe Xen can pre-allocate all the stage-2 entries?

Quoted 5 lines
Quoted 2 lines

Xen pre-allocates all the memory for stage-2 entries (no overcommit or populate on demand by default)

what was the conclusion when pinning the vcpu to dedicated pcpus - did the error still show up?

If I have 2 pCPU (CPU 0 and CPU 2) and 1 vCPU which is moving every 2 second between the pCPUs, Linux will freeze each time the vcpu is running on CPU 1. I'm not sure why, perhaps another issue.

As Stefano advised me, I will setup the debugger on the arndale tomorrow and see if I can find something.

Signature · 1 line
Julien
#14 lore raw
In reply to Christoffer Dall
Quoted 3 lines · Christoffer Dall

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

I was looking on KVM code and I noticed that it traps all data cache instruction. Is there any reason to trap it?

I wonder if it could be the issue on Xen because we don't trap cache instruction and the manual is not clear on that.

Thanks,

Signature · 1 line
Julien
#15 lore raw
Quoted 7 lines · Julien Grall
Quoted 3 lines · Christoffer Dall

- All other cache accesses should be coherent across cores and are physically indexed/physically tagged so I don't see how this could be your issue.

Quoted 6 lines

I was looking on KVM code and I noticed that it traps all data cache instruction. Is there any reason to trap it?

I wonder if it could be the issue on Xen because we don't trap cache instruction and the manual is not clear on that.

We don't trap all cache maintenance instructions, only those that work by set/way, since if the vcpu gets migrated in the middle, it will potentially clean one pcpu partially and another pcpu partially. So we simply stop everything, clean everything, and carry on. Luckily, this is not very common with linux guests.

This may be your issue if it really happens...