Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275649
b: refs/heads/master
c: d7cd979
h: refs/heads/master
i:
  275647: 0983e03
v: v3
  • Loading branch information
Gleb Natapov authored and Avi Kivity committed Nov 17, 2011
1 parent edcf329 commit 0bce81e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bf00a529967dafbbb210b377c38a15834d1e979
refs/heads/master: d7cd97964ba6d70c558348bd2c87290dce885583
21 changes: 21 additions & 0 deletions trunk/arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <asm/mce.h>
#include <asm/i387.h>
#include <asm/xcr.h>
#include <asm/perf_event.h>

#include "trace.h"

Expand Down Expand Up @@ -6050,6 +6051,24 @@ static void vmx_cancel_injection(struct kvm_vcpu *vcpu)
vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0);
}

static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx)
{
int i, nr_msrs;
struct perf_guest_switch_msr *msrs;

msrs = perf_guest_get_msrs(&nr_msrs);

if (!msrs)
return;

for (i = 0; i < nr_msrs; i++)
if (msrs[i].host == msrs[i].guest)
clear_atomic_switch_msr(vmx, msrs[i].msr);
else
add_atomic_switch_msr(vmx, msrs[i].msr, msrs[i].guest,
msrs[i].host);
}

#ifdef CONFIG_X86_64
#define R "r"
#define Q "q"
Expand Down Expand Up @@ -6099,6 +6118,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
vmx_set_interrupt_shadow(vcpu, 0);

atomic_switch_perf_msrs(vmx);

vmx->__launched = vmx->loaded_vmcs->launched;
asm(
/* Store host registers */
Expand Down

0 comments on commit 0bce81e

Please sign in to comment.