]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0295-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch
rt_patches: required rebase due to printk change
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0295-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch
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
5  to migrate_disable()
6
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.
11
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.
16
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>
21 ---
22  arch/arm/kvm/arm.c | 6 +++---
23  1 file changed, 3 insertions(+), 3 deletions(-)
24
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.
32                  */
33 -               preempt_disable();
34 +               migrate_disable();
35                 kvm_timer_flush_hwstate(vcpu);
36                 kvm_vgic_flush_hwstate(vcpu);
37  
38 @@ -585,7 +585,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
39                         local_irq_enable();
40                         kvm_timer_sync_hwstate(vcpu);
41                         kvm_vgic_sync_hwstate(vcpu);
42 -                       preempt_enable();
43 +                       migrate_enable();
44                         continue;
45                 }
46  
47 @@ -639,7 +639,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
48  
49                 kvm_vgic_sync_hwstate(vcpu);
50  
51 -               preempt_enable();
52 +               migrate_enable();
53  
54                 ret = handle_exit(vcpu, run, ret);
55         }
56 -- 
57 1.9.1
58