[PATCH v2 1/2] KVM: arm/arm64: add WARN_ON if size is not PAGE_SIZE aligned in unmap_stage2_range

2018-05-18 Thread Jia He
There is a panic in armv8a server(QDF2400) under memory pressure tests (start 20 guests and run memhog in the host). -begin [35380.800950] BUG: Bad page state in process qemu-kvm pfn:dd0b6 [35380.805825] page:7fe003742d80

[PATCH v2 2/2] KVM: arm/arm64: harden unmap_stage2_ptes in case end is not PAGE_SIZE aligned

2018-05-18 Thread Jia He
If it passes addr=0x20292,size=0xfe00 to unmap_stage2_range-> ...->unmap_stage2_ptes, unmap_stage2_ptes will get addr=0x20292, end=0x20292fe00. After first while loop addr=0x20293, end=0x20292fe00, then addr!=end. Thus it will touch another pages by put_pages() in the 2nd loop. This

Re: [PATCH v2 2/2] KVM: arm/arm64: harden unmap_stage2_ptes in case end is not PAGE_SIZE aligned

2018-05-18 Thread Marc Zyngier
On 18/05/18 10:27, Jia He wrote: > If it passes addr=0x20292,size=0xfe00 to unmap_stage2_range-> > ...->unmap_stage2_ptes, unmap_stage2_ptes will get addr=0x20292, > end=0x20292fe00. After first while loop addr=0x20293, end=0x20292fe00, > then addr!=end. Thus it will touch another

Re: [PATCH v2 2/2] KVM: arm/arm64: harden unmap_stage2_ptes in case end is not PAGE_SIZE aligned

2018-05-18 Thread Jia He
On 5/18/2018 5:48 PM, Marc Zyngier Wrote: > On 18/05/18 10:27, Jia He wrote: >> If it passes addr=0x20292,size=0xfe00 to unmap_stage2_range-> >> ...->unmap_stage2_ptes, unmap_stage2_ptes will get addr=0x20292, >> end=0x20292fe00. After first while loop addr=0x20293, end=0x20292fe00,

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Nick Desaulniers
+ Andrey On Fri, May 18, 2018 at 10:45 AM Marc Zyngier wrote: > On 18/05/18 18:40, Nick Desaulniers wrote: > > On Fri, May 18, 2018 at 10:30 AM Marc Zyngier wrote: > >> I'm going to ask the question I've asked before when this patch cropped > >> up

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Marc Zyngier
On 18/05/18 18:56, Nick Desaulniers wrote: > + Andrey > > On Fri, May 18, 2018 at 10:45 AM Marc Zyngier wrote: >> On 18/05/18 18:40, Nick Desaulniers wrote: >>> On Fri, May 18, 2018 at 10:30 AM Marc Zyngier > wrote: I'm going to ask the question

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Nick Desaulniers
On Fri, May 18, 2018 at 10:30 AM Marc Zyngier wrote: > I'm going to ask the question I've asked before when this patch cropped > up (must be the 4th time now): > Is it guaranteed that this is the only case where LLVM/clang is going to > generate absolute addresses instead

[PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Sami Tolvanen
Starting with LLVM r308050, clang generates a jump table with EL1 virtual addresses in __init_stage2_translation, which results in a kernel panic when booting at EL2: Kernel panic - not syncing: HYP panic: PS:83c9 PC:089e6fd8 ESR:8604 FAR:089e6fd8

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Nick Desaulniers
+ Andrey (who reported testing this patch in https://github.com/ClangBuiltLinux/linux/issues/11) On Fri, May 18, 2018 at 10:40 AM Nick Desaulniers wrote: > On Fri, May 18, 2018 at 10:30 AM Marc Zyngier wrote: > > I'm going to ask the question I've

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Marc Zyngier
On 18/05/18 18:40, Nick Desaulniers wrote: > On Fri, May 18, 2018 at 10:30 AM Marc Zyngier wrote: >> I'm going to ask the question I've asked before when this patch cropped >> up (must be the 4th time now): > >> Is it guaranteed that this is the only case where LLVM/clang

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Nick Desaulniers
On Fri, May 18, 2018 at 11:13 AM Marc Zyngier wrote: > What I'd really like is to apply that patch knowing that: > - you have checked that with a released version of the compiler, you > don't observe any absolute address in any of the objects that are going > to be executed

Re: [PATCH] arm64: kvm: use -fno-jump-tables with clang

2018-05-18 Thread Marc Zyngier
On 18/05/18 18:02, Sami Tolvanen wrote: > Starting with LLVM r308050, clang generates a jump table with EL1 > virtual addresses in __init_stage2_translation, which results in a > kernel panic when booting at EL2: > > Kernel panic - not syncing: HYP panic: > PS:83c9 PC:089e6fd8

Re: [PATCH] arm64: KVM: reduce guest fpsimd trap

2018-05-18 Thread Tangnianyao (ICT)
On Wed, May 16, 2018 at 20:46 PM GST+8, Christoffer Dall wrote: > On Wed, May 16, 2018 at 11:32:17AM +0100, Dave Martin wrote: > > On Wed, May 16, 2018 at 10:25:40AM +0100, Marc Zyngier wrote: > > > [+Dave] > > > > > > Hi Nianyao, > > > > > > On 16/05/18 10:08, Tangnianyao (ICT) wrote: > > > >