1 From 0af37f87ac7df6ccdae98ea45514f626d3e72589 Mon Sep 17 00:00:00 2001
2 From: Josh Cartwright <joshc@ni.com>
3 Date: Thu, 11 Feb 2016 11:54:01 -0600
4 Subject: [PATCH 295/366] KVM: arm/arm64: downgrade preempt_disable()d region
7 kvm_arch_vcpu_ioctl_run() disables the use of preemption when updating
8 the vgic and timer states to prevent the calling task from migrating to
9 another CPU. It does so to prevent the task from writing to the
10 incorrect per-CPU GIC distributor registers.
12 On -rt kernels, it's possible to maintain the same guarantee with the
13 use of migrate_{disable,enable}(), with the added benefit that the
14 migrate-disabled region is preemptible. Update
15 kvm_arch_vcpu_ioctl_run() to do so.
17 Cc: Christoffer Dall <christoffer.dall@linaro.org>
18 Reported-by: Manish Jaggi <Manish.Jaggi@caviumnetworks.com>
19 Signed-off-by: Josh Cartwright <joshc@ni.com>
20 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
22 arch/arm/kvm/arm.c | 6 +++---
23 1 file changed, 3 insertions(+), 3 deletions(-)
25 diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
26 index 0310e51..64037a6 100644
27 --- a/arch/arm/kvm/arm.c
28 +++ b/arch/arm/kvm/arm.c
29 @@ -566,7 +566,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
30 * involves poking the GIC, which must be done in a
31 * non-preemptible context.
35 kvm_timer_flush_hwstate(vcpu);
36 kvm_vgic_flush_hwstate(vcpu);
38 @@ -585,7 +585,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
40 kvm_timer_sync_hwstate(vcpu);
41 kvm_vgic_sync_hwstate(vcpu);
47 @@ -639,7 +639,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
49 kvm_vgic_sync_hwstate(vcpu);
54 ret = handle_exit(vcpu, run, ret);