kvm: vmx: Add last_cpu to struct vcpu_vmx
authorJim Mattson <jmattson@google.com>
Wed, 3 Jun 2020 23:56:20 +0000 (16:56 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 20:21:43 +0000 (16:21 -0400)
As we already do in svm, record the last logical processor on which a
vCPU has run, so that it can be communicated to userspace for
potential hardware errors.

Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Message-Id: <20200603235623.245638-4-jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h

index 608e992..4d8f12c 100644 (file)
@@ -6734,6 +6734,7 @@ reenter_guest:
        if (vcpu->arch.cr2 != read_cr2())
                write_cr2(vcpu->arch.cr2);
 
+       vmx->last_cpu = vcpu->cpu;
        vmx->fail = __vmx_vcpu_run(vmx, (unsigned long *)&vcpu->arch.regs,
                                   vmx->loaded_vmcs->launched);
 
index 639798e..f8f9e21 100644 (file)
@@ -300,6 +300,9 @@ struct vcpu_vmx {
        u64 ept_pointer;
 
        struct pt_desc pt_desc;
+
+       /* which host CPU was used for running this vcpu */
+       unsigned int last_cpu;
 };
 
 enum ept_pointers_status {