Re: [PATCH] KVM: PMU emulation: GLOBAL_CTRL MSR should be enabled on reset.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux