From: Zdenek Kaspar <zkaspar82@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
"Han, Huaitong" <huaitong.han@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: linux-4.4: qemu starting VM emits vmwrite error
Date: Tue, 12 Jan 2016 18:58:16 +0100 [thread overview]
Message-ID: <56953EB8.5080403@gmail.com> (raw)
In-Reply-To: <5694D881.1090709@redhat.com>
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@intel.com>
>> 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@intel.com>
>> ---
>> 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.
prev parent reply other threads:[~2016-01-12 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 18:19 linux-4.4: qemu starting VM emits vmwrite error Zdenek Kaspar
2016-01-12 8:25 ` Han, Huaitong
2016-01-12 10:42 ` Paolo Bonzini
2016-01-12 17:58 ` Zdenek Kaspar [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=56953EB8.5080403@gmail.com \
--to=zkaspar82@gmail.com \
--cc=huaitong.han@intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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.