Skip to content

Commit 3c84530

Browse files
Like XuPeter Zijlstra
authored andcommitted
perf/x86/intel: Save/restore cpuc->active_pebs_data_cfg when using guest PEBS
After commit b752ea0 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG"), the cpuc->pebs_data_cfg may save some bits that are not supported by real hardware, such as PEBS_UPDATE_DS_SW. This would cause the VMX hardware MSR switching mechanism to save/restore invalid values for PEBS_DATA_CFG MSR, thus crashing the host when PEBS is used for guest. Fix it by using the active host value from cpuc->active_pebs_data_cfg. Fixes: b752ea0 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG") Signed-off-by: Like Xu <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Kan Liang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 44c026a commit 3c84530

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/events/intel/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4074,7 +4074,7 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data)
40744074
if (x86_pmu.intel_cap.pebs_baseline) {
40754075
arr[(*nr)++] = (struct perf_guest_switch_msr){
40764076
.msr = MSR_PEBS_DATA_CFG,
4077-
.host = cpuc->pebs_data_cfg,
4077+
.host = cpuc->active_pebs_data_cfg,
40784078
.guest = kvm_pmu->pebs_data_cfg,
40794079
};
40804080
}

0 commit comments

Comments
 (0)