From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3RRB-0002Sy-Up for qemu-devel@nongnu.org; Sun, 28 Jul 2013 09:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3RR5-0007P8-UZ for qemu-devel@nongnu.org; Sun, 28 Jul 2013 09:55:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3RR5-0007P0-NH for qemu-devel@nongnu.org; Sun, 28 Jul 2013 09:54:59 -0400 Date: Sun, 28 Jul 2013 16:54:57 +0300 From: Gleb Natapov Message-ID: <20130728135456.GJ11772@redhat.com> References: <1374764722-10685-1-git-send-email-pbonzini@redhat.com> <1374764722-10685-3-git-send-email-pbonzini@redhat.com> <20130728125745.GA27246@redhat.com> <51F521DD.5010308@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51F521DD.5010308@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 2/2] kvm: migrate vPMU state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, afaerber@suse.de 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.