On Wed, Aug 28, 2019 at 4:41 PM Oliver Upton <oupton@xxxxxxxxxx> wrote: > > The existing implementation for loading the IA32_PERF_GLOBAL_CTRL MSR > on VM-exit was incorrect, as the next call to atomic_switch_perf_msrs() > could cause this value to be overwritten. Instead, call kvm_set_msr() > which will allow atomic_switch_perf_msrs() to correctly set the values. Also, as Sean pointed out, kvm needs to negotiate its usage of the performance counters with the Linux perf subsystem. Going through kvm_set_msr is the correct way to do that. Setting the hardware MSR directly (going behind the back of the perf subsystem) is not allowed. [My apologies for the double mail some of you will receive.]