From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Liran Alon <liran.alon@oracle.com>
Cc: kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Jon Doron" <arilou@gmail.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: nVMX: allow RSM to restore VMXE CR4 flag
Date: Tue, 26 Mar 2019 14:48:52 +0100 [thread overview]
Message-ID: <87k1glagqj.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <DFD60850-CD9B-4FF3-9C46-EF4AF53C76CA@oracle.com>
Liran Alon <liran.alon@oracle.com> writes:
>> On 26 Mar 2019, at 15:07, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>>
>> Commit 5bea5123cbf0 ("KVM: VMX: check nested state and CR4.VMXE against
>> SMM") introduced a check to vmx_set_cr4() forbidding to set VMXE from SMM.
>> The check is correct, however, there is a special case when RSM is called
>> to leave SMM: rsm_enter_protected_mode() is called with HF_SMM_MASK still
>> set and in case VMXE was set before entering SMM we're failing to return.
>>
>> Resolve the issue by temporary dropping HF_SMM_MASK around set_cr4() calls
>> when ops->set_cr() is called from RSM.
>>
>> Reported-by: Jon Doron <arilou@gmail.com>
>> Suggested-by: Liran Alon <liran.alon@oracle.com>
>> Fixes: 5bea5123cbf0 ("KVM: VMX: check nested state and CR4.VMXE against SMM")
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> Patch looks good to me.
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
Thanks!
>
>> ---
>> - Instread of putting the temporary HF_SMM_MASK drop to
>> rsm_enter_protected_mode() (as was suggested by Liran), move it to
>> emulator_set_cr() modifying its interface. emulate.c seems to be
>> vcpu-specifics-free at this moment, we may want to keep it this way.
>> - It seems that Hyper-V+UEFI on KVM is still broken, I'm observing sporadic
>> hangs even with this patch. These hangs, however, seem to be unrelated to
>> rsm.
>
> Feel free to share details on these hangs ;)
>
You've asked for it)
The immediate issue I'm observing is some sort of a lockup which is easy
to trigger with e.g. "-usb -device usb-tablet" on Qemu command line; it
seems we get too many interrupts and combined with preemtion timer for
L2 we're not making any progress:
kvm_userspace_exit: reason KVM_EXIT_IOAPIC_EOI (26)
kvm_set_irq: gsi 18 level 1 source 0
kvm_msi_set_irq: dst 0 vec 177 (Fixed|physical|level)
kvm_apic_accept_irq: apicid 0 vec 177 (Fixed|edge)
kvm_fpu: load
kvm_entry: vcpu 0
kvm_exit: reason VMRESUME rip 0xfffff80000848115 info 0 0
kvm_entry: vcpu 0
kvm_exit: reason PREEMPTION_TIMER rip 0xfffff800f4448e01 info 0 0
kvm_nested_vmexit: rip fffff800f4448e01 reason PREEMPTION_TIMER info1 0 info2 0 int_info 0 int_info_err 0
kvm_nested_vmexit_inject: reason EXTERNAL_INTERRUPT info1 0 info2 0 int_info 800000b1 int_info_err 0
kvm_entry: vcpu 0
kvm_exit: reason APIC_ACCESS rip 0xfffff8000081fe11 info 10b0 0
kvm_apic: apic_write APIC_EOI = 0x0
kvm_eoi: apicid 0 vector 177
kvm_fpu: unload
kvm_userspace_exit: reason KVM_EXIT_IOAPIC_EOI (26)
...
(and the pattern repeats)
Maybe it is a usb-only/Qemu-only problem, maybe not.
--
Vitaly
next prev parent reply other threads:[~2019-03-26 13:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-26 13:07 [PATCH] KVM: x86: nVMX: allow RSM to restore VMXE CR4 flag Vitaly Kuznetsov
2019-03-26 13:11 ` Liran Alon
2019-03-26 13:48 ` Vitaly Kuznetsov [this message]
2019-03-26 15:02 ` Liran Alon
2019-03-27 10:08 ` Vitaly Kuznetsov
[not found] ` <20190327192946.19128-1-sean.j.christopherson@intel.com>
[not found] ` <87va03ml7n.fsf@vitty.brq.redhat.com>
[not found] ` <CALMp9eQPwFy5GvjDbE9wQQYEDdYfHzEwm6n1XZgQ_hCuk9vp+Q@mail.gmail.com>
2019-04-09 8:21 ` Vitaly Kuznetsov
2019-04-09 16:31 ` Paolo Bonzini
2019-04-10 9:38 ` [RFC] selftests: kvm: add a selftest for SMM Vitaly Kuznetsov
2019-04-10 10:10 ` Paolo Bonzini
2019-04-10 10:32 ` Vitaly Kuznetsov
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=87k1glagqj.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=arilou@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liran.alon@oracle.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.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.