On Sun, Jul 28, 2013 at 03:51:25PM +0200, Paolo Bonzini wrote: > Il 28/07/2013 14:57, Gleb Natapov ha scritto: > >> @@ -1114,6 +1135,33 @@ static int kvm_put_msrs(X86CPU *cpu, int level) > >> kvm_msr_entry_set(&msrs[n++], MSR_KVM_STEAL_TIME, > >> env->steal_time_msr); > >> } > >> + if (has_msr_architectural_pmu) { > >> + /* Stop the counter. */ > >> + kvm_msr_entry_set(&msrs[n++], MSR_CORE_PERF_FIXED_CTR_CTRL, > >> 0); > >> + kvm_msr_entry_set(&msrs[n++], MSR_CORE_PERF_GLOBAL_CTRL, 0); > >> + > > Why is this needed? > > In v1 it was in the commit message. I'll fix it up before applying: > > > Second, to avoid any possible side effects during the setting of MSRs > > I stop the PMU while setting the counters and event selector MSRs. > > Stopping the PMU snapshots the counters and ensures that no strange > > races can happen if the counters were saved close to their overflow > > value. > Since vcpu is not running counters should not count anyway.
-- Gleb.