From: Paolo Bonzini <pbonzini@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Liran Alon" <liran.alon@oracle.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] KVM: x86: vmx: throttle immediate exit through preemtion timer to assist buggy guests
Date: Fri, 29 Mar 2019 15:18:56 +0100 [thread overview]
Message-ID: <f64742ef-c67d-db0f-d812-2b6f5048d7ee@redhat.com> (raw)
In-Reply-To: <20190328203110.20655-1-vkuznets@redhat.com>
On 28/03/19 21:31, Vitaly Kuznetsov wrote:
>
> The 'hang' scenario develops like this:
> 1) Hyper-V boots and QEMU is trying to inject two irq simultaneously. One
> of them is level-triggered. KVM injects the edge-triggered one and
> requests immediate exit to inject the level-triggered:
>
> kvm_set_irq: gsi 23 level 1 source 0
> kvm_msi_set_irq: dst 0 vec 80 (Fixed|physical|level)
> kvm_apic_accept_irq: apicid 0 vec 80 (Fixed|edge)
> kvm_msi_set_irq: dst 0 vec 96 (Fixed|physical|edge)
> kvm_apic_accept_irq: apicid 0 vec 96 (Fixed|edge)
> kvm_nested_vmexit_inject: reason EXTERNAL_INTERRUPT info1 0 info2 0 int_info 80000060 int_info_err 0
>
> 2) Hyper-V requires one of its VMs to run to handle the situation but
> immediate exit happens:
>
> kvm_entry: vcpu 0
> kvm_exit: reason VMRESUME rip 0xfffff80006a40115 info 0 0
> kvm_entry: vcpu 0
> kvm_exit: reason PREEMPTION_TIMER rip 0xfffff8022f3d8350 info 0 0
> kvm_nested_vmexit: rip fffff8022f3d8350 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 80000050 int_info_err 0
I supposed before this there was an eoi for vector 96?
The main issue with your patch is that the preemption timer is buggy on
some processors (it runs too fast) and on those processors we shouldn't
use it with nonzero deadline. In particular because it runs too fast it
may not hide the bug.
I think level-triggered interrupts are required for the bug to show.
Edge-triggered interrupts usually have to be acknowledged with a device
register before the host device will trigger another interrupt; or at
least the interrupt event, for example an incoming network packet, must
happen again. This way, when the guest hangs it puts some back pressure
on the host.
I think we should do in QEMU the same fix that was done in the in-kernel
IOAPIC.
Paolo
next prev parent reply other threads:[~2019-03-29 14:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 20:31 Vitaly Kuznetsov
2019-03-29 2:00 ` Liran Alon
2019-03-29 9:14 ` Vitaly Kuznetsov
2019-03-29 12:09 ` Liran Alon
2019-03-29 14:18 ` Paolo Bonzini [this message]
2019-03-29 14:40 ` Vitaly Kuznetsov
2019-03-29 15:01 ` Paolo Bonzini
2019-03-29 15:14 ` Vitaly Kuznetsov
2019-03-29 15:32 ` Liran Alon
2019-03-29 17:14 ` Paolo Bonzini
2019-04-01 8:39 ` Vitaly Kuznetsov
2019-04-01 10:08 ` Liran Alon
2019-04-01 10:41 ` Vitaly Kuznetsov
2019-04-01 8:50 ` 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=f64742ef-c67d-db0f-d812-2b6f5048d7ee@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liran.alon@oracle.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome