Skip to content

Commit

Permalink
kvm: vmx: Add last_cpu to struct vcpu_vmx
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Mattson authored and Paolo Bonzini committed Jul 8, 2020
1 parent 2426363 commit 80a1684
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kvm/vmx/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6734,6 +6734,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
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);

Expand Down
3 changes: 3 additions & 0 deletions arch/x86/kvm/vmx/vmx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 80a1684

Please sign in to comment.