summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm/avic.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-12-02 20:44:56 +0100
committerJakub Kicinski <kuba@kernel.org>2021-12-02 20:44:56 +0100
commitfc993be36f9ea7fc286d84d8471a1a20e871aad4 (patch)
treecef440a299ed7d1c2418992f7d724b4d86e6d83b /arch/x86/kvm/svm/avic.c
parentselftests: net: remove meaningless help option (diff)
parentMerge tag 'net-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
downloadlinux-fc993be36f9ea7fc286d84d8471a1a20e871aad4.tar.xz
linux-fc993be36f9ea7fc286d84d8471a1a20e871aad4.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'arch/x86/kvm/svm/avic.c')
-rw-r--r--arch/x86/kvm/svm/avic.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index affc0ea98d30..9d6066eb7c10 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -989,16 +989,18 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu)
static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
{
struct vcpu_svm *svm = to_svm(vcpu);
+ int cpu = get_cpu();
+ WARN_ON(cpu != vcpu->cpu);
svm->avic_is_running = is_run;
- if (!kvm_vcpu_apicv_active(vcpu))
- return;
-
- if (is_run)
- avic_vcpu_load(vcpu, vcpu->cpu);
- else
- avic_vcpu_put(vcpu);
+ if (kvm_vcpu_apicv_active(vcpu)) {
+ if (is_run)
+ avic_vcpu_load(vcpu, cpu);
+ else
+ avic_vcpu_put(vcpu);
+ }
+ put_cpu();
}
void svm_vcpu_blocking(struct kvm_vcpu *vcpu)