2020-08-28 04:53:35 +00:00
|
|
|
From 951d0da6fc249f03da0113a4b571d04be867ea80 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <951d0da6fc249f03da0113a4b571d04be867ea80.1596234183.git.zanussi@kernel.org>
|
|
|
|
In-Reply-To: <378ee68279f6a7631221f2670a9298620148690d.1596234183.git.zanussi@kernel.org>
|
|
|
|
References: <378ee68279f6a7631221f2670a9298620148690d.1596234183.git.zanussi@kernel.org>
|
2018-08-27 14:32:32 +00:00
|
|
|
From: Josh Cartwright <joshc@ni.com>
|
|
|
|
Date: Thu, 11 Feb 2016 11:54:01 -0600
|
2020-07-15 20:05:29 +00:00
|
|
|
Subject: [PATCH 211/329] KVM: arm/arm64: downgrade preempt_disable()d region
|
2019-04-08 23:49:20 +00:00
|
|
|
to migrate_disable()
|
2020-08-28 04:53:35 +00:00
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.135-rt60.tar.xz
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
kvm_arch_vcpu_ioctl_run() disables the use of preemption when updating
|
|
|
|
the vgic and timer states to prevent the calling task from migrating to
|
|
|
|
another CPU. It does so to prevent the task from writing to the
|
|
|
|
incorrect per-CPU GIC distributor registers.
|
|
|
|
|
|
|
|
On -rt kernels, it's possible to maintain the same guarantee with the
|
|
|
|
use of migrate_{disable,enable}(), with the added benefit that the
|
|
|
|
migrate-disabled region is preemptible. Update
|
|
|
|
kvm_arch_vcpu_ioctl_run() to do so.
|
|
|
|
|
|
|
|
Cc: Christoffer Dall <christoffer.dall@linaro.org>
|
|
|
|
Reported-by: Manish Jaggi <Manish.Jaggi@caviumnetworks.com>
|
|
|
|
Signed-off-by: Josh Cartwright <joshc@ni.com>
|
|
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
virt/kvm/arm/arm.c | 6 +++---
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
|
2019-11-25 00:04:39 +00:00
|
|
|
index d982650deb33..efe2d6c0201c 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/virt/kvm/arm/arm.c
|
|
|
|
+++ b/virt/kvm/arm/arm.c
|
2019-11-25 00:04:39 +00:00
|
|
|
@@ -723,7 +723,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
2018-08-27 14:32:32 +00:00
|
|
|
* involves poking the GIC, which must be done in a
|
|
|
|
* non-preemptible context.
|
|
|
|
*/
|
|
|
|
- preempt_disable();
|
|
|
|
+ migrate_disable();
|
|
|
|
|
|
|
|
kvm_pmu_flush_hwstate(vcpu);
|
|
|
|
|
2019-11-25 00:04:39 +00:00
|
|
|
@@ -772,7 +772,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
2018-08-27 14:32:32 +00:00
|
|
|
kvm_timer_sync_hwstate(vcpu);
|
|
|
|
kvm_vgic_sync_hwstate(vcpu);
|
|
|
|
local_irq_enable();
|
|
|
|
- preempt_enable();
|
|
|
|
+ migrate_enable();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-11-25 00:04:39 +00:00
|
|
|
@@ -850,7 +850,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
2018-08-27 14:32:32 +00:00
|
|
|
/* Exit types that need handling before we can be preempted */
|
|
|
|
handle_exit_early(vcpu, run, ret);
|
|
|
|
|
|
|
|
- preempt_enable();
|
|
|
|
+ migrate_enable();
|
|
|
|
|
|
|
|
ret = handle_exit(vcpu, run, ret);
|
|
|
|
}
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-06-22 13:14:16 +00:00
|
|
|
2.17.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|