[PATCH 4/5] KVM: arm/arm64: improve kvm_arch_vcpu_runnable

2017-09-29 Thread Andrew Jones
Conceptually, kvm_arch_vcpu_runnable() should be "not waiting, or waiting for interrupts and interrupts are pending", !waiting-uninterruptable && (!waiting-for-interrupts || interrupts-pending) but the implementation was only !waiting-uninterruptable && interrupts-pending Thanks to the

[PATCH 5/5] KVM: arm/arm64: kvm_arch_vcpu_runnable: don't miss injected irqs

2017-09-29 Thread Andrew Jones
When the vPMU is in use if a VCPU's perf event overflow handler were to fire after the VCPU started waiting, then the wake up done by the kvm_vcpu_kick() call in the handler would do nothing, as no "pmu overflow" state is checked in kvm_arch_vcpu_runnable(). Fix this by checking the IRQ_PENDING

[PATCH 1/5] KVM: arm/arm64: tidy 'should sleep' conditions

2017-09-29 Thread Andrew Jones
Introduce vcpu_should_sleep() in order to tidy several places up that the compound 'power_off || pause' condition is used. Signed-off-by: Andrew Jones --- virt/kvm/arm/arm.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git

[PATCH 2/5] KVM: arm/arm64: replace power_off with mp_state=STOPPED

2017-09-29 Thread Andrew Jones
This prepares for more MP states to be used. Signed-off-by: Andrew Jones --- arch/arm/include/asm/kvm_host.h | 6 -- arch/arm64/include/asm/kvm_host.h | 6 -- virt/kvm/arm/arm.c| 26 ++ virt/kvm/arm/psci.c |

[PATCH 3/5] KVM: arm/arm64: factor out common wfe/wfi emulation code

2017-09-29 Thread Andrew Jones
Before we add more common code to the wfi emulation, let's first factor out everything common. Signed-off-by: Andrew Jones --- arch/arm/include/asm/kvm_host.h | 2 ++ arch/arm/kvm/handle_exit.c| 14 +- arch/arm64/include/asm/kvm_host.h | 2 ++

[PATCH 0/5] kvm_arch_vcpu_runnable related improvements

2017-09-29 Thread Andrew Jones
Only patch 5/5 fixes anything, and that's just a theoretical bug, but, IMHO, this series future-proofs and improves the maintainability of the code. See https://www.spinics.net/lists/kvm-arm/msg27254.html for a TL;DR analysis that led to this series. Thanks, drew Andrew Jones (5): KVM:

Re: An ode to kvm_arch_vcpu_runnable()

2017-09-29 Thread Andrew Jones
On Sun, Sep 17, 2017 at 06:32:10PM +0200, Andrew Jones wrote: > Oh, kvm_arch_vcpu_runnable(), how I love thee. Let me count the ways: I just sent patches for this, as patches speak louder than poetry, but the series makes a couple changes to the proposal: > > > Proposal > > >

Re: [PATCH v2 23/28] arm64/sve: KVM: Treat guest SVE use as undefined instruction execution

2017-09-29 Thread Dave Martin
On Thu, Sep 14, 2017 at 02:31:13PM +0100, Alex Bennée wrote: > > Dave Martin writes: > > > When trapping forbidden attempts by a guest to use SVE, we want the > > guest to see a trap consistent with SVE not being implemented. > > > > This patch injects an undefined

Re: [PATCH v2 19/28] arm64/sve: ptrace and ELF coredump support

2017-09-29 Thread Dave Martin
On Thu, Sep 14, 2017 at 01:57:08PM +0100, Alex Bennée wrote: > > Dave Martin writes: > > > This patch defines and implements a new regset NT_ARM_SVE, which > > describes a thread's SVE register state. This allows a debugger to > > manipulate the SVE state, as well as being

Re: [PATCH v2 23/28] arm64/sve: KVM: Treat guest SVE use as undefined instruction execution

2017-09-29 Thread Alex Bennée
Dave Martin writes: > On Thu, Sep 14, 2017 at 02:31:13PM +0100, Alex Bennée wrote: >> >> Dave Martin writes: >> >> > When trapping forbidden attempts by a guest to use SVE, we want the >> > guest to see a trap consistent with SVE not being implemented.