From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org, afaerber@suse.de, ehabkost@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] kvm: migrate vPMU state
Date: Sun, 28 Jul 2013 16:07:37 +0200 [thread overview]
Message-ID: <51F525A9.7030503@redhat.com> (raw)
In-Reply-To: <20130728135456.GJ11772@redhat.com>
Il 28/07/2013 15:54, Gleb Natapov ha scritto:
> 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.
Does the perf event distinguish KVM_RUN from any other activity in the
vCPU thread (in which this code runs)? It seemed unsafe to me to change
the overflow status and the performance counter value while the counter
could be running, since the counter value could affect the overflow
status. Maybe I was being paranoid?
Paolo
next prev parent reply other threads:[~2013-07-28 14:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 15:05 [Qemu-devel] [PATCH v2 0/2] kvm: migrate vPMU state Paolo Bonzini
2013-07-25 15:05 ` [Qemu-devel] [PATCH v2 1/2] target-i386: remove tabs from target-i386/cpu.h Paolo Bonzini
2013-07-25 15:05 ` [Qemu-devel] [PATCH v2 2/2] kvm: migrate vPMU state Paolo Bonzini
2013-07-28 12:57 ` Gleb Natapov
2013-07-28 13:51 ` Paolo Bonzini
2013-07-28 13:54 ` Gleb Natapov
2013-07-28 14:07 ` Paolo Bonzini [this message]
2013-07-28 14:24 ` Gleb Natapov
2013-08-01 13:03 ` Paolo Bonzini
2013-08-01 13:12 ` Gleb Natapov
2013-08-01 13:48 ` Paolo Bonzini
2013-08-01 13:50 ` Gleb Natapov
2013-07-28 13:03 ` [Qemu-devel] [PATCH v2 0/2] " Andreas Färber
2013-07-28 13:05 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F525A9.7030503@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=gleb@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).