xen/arm: Trap and yield on WFE instructions
authorAnup Patel <anup.patel@linaro.org>
Wed, 16 Jul 2014 10:32:15 +0000 (16:02 +0530)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 16 Jul 2014 14:30:08 +0000 (15:30 +0100)
commitaf82c49116c7bf6857be6bf6b56094b9eb2ef012
tree50dec0a58343177b05d5cc549b2c03952ecc16a6
parentc047211d2d61251a4735fd864009f6568cc041ec
xen/arm: Trap and yield on WFE instructions

If we have a Guest/DomU with two or more of its VCPUs running
on same host CPU then it can quite likely happen that these
VCPUs fight for same spinlock and one of them will waste CPU
cycles in WFE instruction. This patch makes WFE instruction
trap for VCPU and forces VCPU to yield its timeslice.

The KVM ARM/ARM64 also does similar thing for handling WFE
instructions. (Please refer,
https://lists.cs.columbia.edu/pipermail/kvmarm/2013-November/006259.html)

In general, this patch is more of an optimization for an
oversubscribed system having number of VCPUs more than
underlying host CPUs.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Tested-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- resolved conflict with "Adding helper function for WFI",
         nuked stray hard tab ]
xen/arch/arm/traps.c
xen/include/asm-arm/processor.h