Re: linux-4.4: qemu starting VM emits vmwrite error

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

 



On 01/12/2016 11:42 AM, Paolo Bonzini wrote:
> 
> 
> On 12/01/2016 09:25, Han, Huaitong wrote:
>> I don't have a old machine to test it, please patch it and give me
>> feedback. Thanks a lot.
>>
>> From f06a85c76db210ce7145be6c704c44a9cef70ee3 Mon Sep 17 00:00:00 2001
>> From: Huaitong Han <huaitong.han@xxxxxxxxx>
>> Date: Tue, 12 Jan 2016 16:04:20 +0800
>> Subject: [PATCH] kvm: x86: Fix vmwrite to SECONDARY_VM_EXEC_CONTROL
>>
>> SECONDARY_VM_EXEC_CONTROL vmcs will be updated with vmx_cpuid_update,
>> but it
>> will vmwrite error on the older CPU because the code is written without
>> CPU_BASED_ACTIVATE_SECONDARY_CONTROLS check.
>>
>> This will get rid of the following trace:
>>
>> vmwrite error: reg 401e value 10 (err 12)
>> Call Trace:
>> [<ffffffff8116e2b9>] ? dump_stack+0x40/0x57
>> [<ffffffffa020b88d>] ?vmx_cpuid_update+0x5d/0x150 [kvm_intel]
>> [<ffffffffa01d8fdc>] ?kvm_vcpu_ioctl_set_cpuid2+0x4c/0x70 [kvm]
>> [<ffffffffa01b8363>] ?kvm_arch_vcpu_ioctl+0x903/0xfa0 [kvm]
>>
>> Signen-off-by: Huaitong Han <huaitong.han@xxxxxxxxx>
>> ---
>>  arch/x86/kvm/vmx.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 44976a5..80f21d3 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -8904,7 +8904,7 @@ static void vmx_cpuid_update(struct kvm_vcpu
>> *vcpu)
>>  {
>>  	struct kvm_cpuid_entry2 *best;
>>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>> -	u32 secondary_exec_ctl = vmx_secondary_exec_control(vmx);
>> +	u32 secondary_exec_ctl = -1;
>>  
>>  	if (vmx_rdtscp_supported()) {
>>  		bool rdtscp_enabled = guest_cpuid_has_rdtscp(vcpu);
>> @@ -8932,7 +8932,10 @@ static void vmx_cpuid_update(struct kvm_vcpu
>> *vcpu)
>>  			best->ebx &= ~bit(X86_FEATURE_INVPCID);
>>  	}
>>  
>> -	vmcs_set_secondary_exec_control(secondary_exec_ctl);
>> +	if (cpu_has_secondary_exec_ctrls()) {
>> +		secondary_exec_ctl &= vmx_secondary_exec_control(vmx);
>> +		vmcs_set_secondary_exec_control(secondary_exec_ctl);
>> +	}
>>  
>>  	if (static_cpu_has(X86_FEATURE_PCOMMIT) && nested) {
>>  		if (guest_cpuid_has_pcommit(vcpu))
>>
> 
> 
> Looks good, thanks!
> 
> Paolo
> 

Patch tested and works as expected. I see it's queued for v4.5 and with
stable tag, so thank you both.

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