From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org, mtosatti@redhat.com
Subject: Re: [PATCH] KVM: PMU emulation: GLOBAL_CTRL MSR should be enabled on reset.
Date: Tue, 10 Apr 2012 15:25:01 +0300 [thread overview]
Message-ID: <4F84269D.1010601@redhat.com> (raw)
In-Reply-To: <20120409143835.GY11918@redhat.com>
On 04/09/2012 05:38 PM, Gleb Natapov wrote:
> On reset all MPU counters should be enabled in GLOBAL_CTRL MSR.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
> index 173df38..2e88438 100644
> --- a/arch/x86/kvm/pmu.c
> +++ b/arch/x86/kvm/pmu.c
> @@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
> pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1);
>
> if (pmu->version == 1) {
> - pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1;
> - return;
> + pmu->nr_arch_fixed_counters = 0;
> + } else {
> + pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f),
> + X86_PMC_MAX_FIXED);
> + pmu->counter_bitmask[KVM_PMC_FIXED] =
> + ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
> }
>
> - pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f),
> - X86_PMC_MAX_FIXED);
> - pmu->counter_bitmask[KVM_PMC_FIXED] =
> - ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
> - pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1)
> - | (((1ull << pmu->nr_arch_fixed_counters) - 1)
> - << X86_PMC_IDX_FIXED));
> + pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
> + (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED);
> + pmu->global_ctrl_mask = ~pmu->global_ctrl;
> }
>
>
This is not called on INIT (not sure it should be). On the other hand
update_cpuid() is not the best place to initialize stuff.
Oh well, this can be fixed later (not sure its possible), I'll apply
this to master.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2012-04-10 12:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-09 14:38 [PATCH] KVM: PMU emulation: GLOBAL_CTRL MSR should be enabled on reset Gleb Natapov
2012-04-10 12:25 ` Avi Kivity [this message]
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=4F84269D.1010601@redhat.com \
--to=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.