]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
KVM: X86: Add KVM_VCPU_PREEMPTED
authorWanpeng Li <wanpeng.li@hotmail.com>
Wed, 13 Dec 2017 01:33:01 +0000 (17:33 -0800)
committerRadim Krčmář <rkrcmar@redhat.com>
Tue, 16 Jan 2018 15:34:13 +0000 (16:34 +0100)
The next patch will add another bit to the preempted field in
kvm_steal_time.  Define a constant for bit 0 (the only one that is
currently used).

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/include/uapi/asm/kvm_para.h
arch/x86/kernel/kvm.c
arch/x86/kvm/x86.c

index 09cc06483bed426ba4e487067258d1016059aba4..15685bd22faa4827ebd1ae1b52885133592569a3 100644 (file)
@@ -51,6 +51,8 @@ struct kvm_steal_time {
        __u32 pad[11];
 };
 
+#define KVM_VCPU_PREEMPTED          (1 << 0)
+
 #define KVM_CLOCK_PAIRING_WALLCLOCK 0
 struct kvm_clock_pairing {
        __s64 sec;
index b40ffbf156c181f69601ed82a09a2292783c524d..6610b92fc6a59d7ab485c837fad25240a0d684e6 100644 (file)
@@ -643,7 +643,7 @@ __visible bool __kvm_vcpu_is_preempted(long cpu)
 {
        struct kvm_steal_time *src = &per_cpu(steal_time, cpu);
 
-       return !!src->preempted;
+       return !!(src->preempted & KVM_VCPU_PREEMPTED);
 }
 PV_CALLEE_SAVE_REGS_THUNK(__kvm_vcpu_is_preempted);
 
index fafaef072f1b5d9c228b448f636604d6e5e0b6c3..897f4795513fb89fe512e600f1368f777ee5ff7b 100644 (file)
@@ -2916,7 +2916,7 @@ static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)
        if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
                return;
 
-       vcpu->arch.st.steal.preempted = 1;
+       vcpu->arch.st.steal.preempted = KVM_VCPU_PREEMPTED;
 
        kvm_write_guest_offset_cached(vcpu->kvm, &vcpu->arch.st.stime,
                        &vcpu->arch.st.steal.preempted,