Skip to content

Commit 7987b8b

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm fix from Paolo Bonzini: - Fix boolean logic in intel_guest_get_msrs * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: x86/pmu: fix masking logic for MSR_CORE_PERF_GLOBAL_CTRL
2 parents 7131c2e + 9710794 commit 7987b8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/x86/events/intel/core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4051,12 +4051,17 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data)
40514051
u64 pebs_mask = cpuc->pebs_enabled & x86_pmu.pebs_capable;
40524052
int global_ctrl, pebs_enable;
40534053

4054+
/*
4055+
* In addition to obeying exclude_guest/exclude_host, remove bits being
4056+
* used for PEBS when running a guest, because PEBS writes to virtual
4057+
* addresses (not physical addresses).
4058+
*/
40544059
*nr = 0;
40554060
global_ctrl = (*nr)++;
40564061
arr[global_ctrl] = (struct perf_guest_switch_msr){
40574062
.msr = MSR_CORE_PERF_GLOBAL_CTRL,
40584063
.host = intel_ctrl & ~cpuc->intel_ctrl_guest_mask,
4059-
.guest = intel_ctrl & (~cpuc->intel_ctrl_host_mask | ~pebs_mask),
4064+
.guest = intel_ctrl & ~cpuc->intel_ctrl_host_mask & ~pebs_mask,
40604065
};
40614066

40624067
if (!x86_pmu.pebs)

0 commit comments

Comments
 (0)