Re: [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init

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

 



On 03/24/2011 12:21 PM, Joerg Roedel wrote:
On Thu, Mar 24, 2011 at 12:04:13PM +0200, Avi Kivity wrote:
>  On 03/24/2011 09:40 AM, Joerg Roedel wrote:
>>  This patch implements the propagation of the VM
>>  virtual_tsc_khz into each vcpu data-structure to enable the
>>  tsc-scaling feature.
>>    static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
>>    {
>>    	struct vcpu_svm *svm = to_svm(vcpu);
>>  @@ -1093,6 +1123,9 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
>>    	if (err)
>>    		goto free_svm;
>>
>>  +	if (!svm_vcpu_init_tsc(kvm, svm))
>>  +		goto uninit;
>>  +
>
>  Need to set err.
>
>  I'm not really happy about failing on vcpu creation.  Prefer to fail
>  when setting the frequency.

Yes, in theory this shouldn't happen anyway because wrong frequencies
are catched when setting them via the ioctl. This is just another check,
but it should probably be turned into a BUG_ON in svm_vcpu_init_tsc()
because it is a bug that userspace could set an invalid khz value.

Yes, I saw later. But BUG_ON() is too dangerous - if the checks don't exactly match a malicious user could cause a DOS.

We can just avoid setting the scale and run with the host tsc frequency.

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