linux/arch/arm/kvm
Christoffer Dall 478a8237f6 arm: KVM: Don't return PSCI_INVAL if waitqueue is inactive
The current KVM implementation of PSCI returns INVALID_PARAMETERS if the
waitqueue for the corresponding CPU is not active.  This does not seem
correct, since KVM should not care what the specific thread is doing,
for example, user space may not have called KVM_RUN on this VCPU yet or
the thread may be busy looping to user space because it received a
signal; this is really up to the user space implementation.  Instead we
should check specifically that the CPU is marked as being turned off,
regardless of the VCPU thread state, and if it is, we shall
simply clear the pause flag on the CPU and wake up the thread if it
happens to be blocked for us.

Further, the implementation seems to be racy when executing multiple
VCPU threads.  There really isn't a reasonable user space programming
scheme to ensure all secondary CPUs have reached kvm_vcpu_first_run_init
before turning on the boot CPU.

Therefore, set the pause flag on the vcpu at VCPU init time (which can
reasonably be expected to be completed for all CPUs by user space before
running any VCPUs) and clear both this flag and the feature (in case the
feature can somehow get set again in the future) and ping the waitqueue
on turning on a VCPU using PSCI.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2013-12-21 09:55:17 -08:00
..
arm.c arm: KVM: Don't return PSCI_INVAL if waitqueue is inactive 2013-12-21 09:55:17 -08:00
coproc_a7.c KVM: ARM: Add support for Cortex-A7 2013-10-12 17:45:30 -07:00
coproc_a15.c KVM: ARM: Add support for Cortex-A7 2013-10-12 17:45:30 -07:00
coproc.c ARM: KVM: fix L2CTLR to be per-cluster 2013-10-22 08:00:06 -07:00
coproc.h ARM: KVM: Fix 64-bit coprocessor handling 2013-08-06 11:32:30 -07:00
emulate.c KVM: ARM: Fix typo in comments of inject_abt() 2013-10-02 17:29:19 +01:00
guest.c KVM: ARM: Add support for Cortex-A7 2013-10-12 17:45:30 -07:00
handle_exit.c KVM: ARM: Update comments for kvm_handle_wfi 2013-10-17 15:26:50 -07:00
init.S ARM: kvm: use inner-shareable barriers after TLB flushing 2013-08-12 12:25:45 +01:00
interrupts_head.S KVM fixes for 3.11 2013-07-03 13:21:40 -07:00
interrupts.S Merge branch 'for-linus' of git://git.linaro.org/people/rmk/linux-arm 2013-09-05 18:07:32 -07:00
Kconfig ARM: KVM: Yield CPU when vcpu executes a WFE 2013-10-17 15:26:50 -07:00
Makefile KVM: ARM: Add support for Cortex-A7 2013-10-12 17:45:30 -07:00
mmio.c arm/arm64: KVM: MMIO support for BE guest 2013-11-07 19:09:04 +00:00
mmu.c arm/arm64: kvm: Use virt_to_idmap instead of virt_to_phys for idmap mappings 2013-12-11 09:49:31 -08:00
perf.c ARM: KVM: add support for minimal host vs guest profiling 2013-04-28 21:44:01 -07:00
psci.c arm: KVM: Don't return PSCI_INVAL if waitqueue is inactive 2013-12-21 09:55:17 -08:00
reset.c Updates for KVM/ARM, take 3 supporting more than 4 CPUs. 2013-11-11 12:02:27 +01:00
trace.h ARM: KVM: Simplify tracepoint text 2013-08-30 15:47:53 -07:00