From: Liran Alon <LIRAN.ALON@ORACLE.COM>
To: Quan Xu <quan.xu0@gmail.com>, kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, jmattson@google.com,
wanpeng.li@hotmail.com, idan.brown@ORACLE.COM,
Liam Merwick <liam.merwick@ORACLE.COM>,
Konrad Rzeszutek Wilk <konrad.wilk@ORACLE.COM>
Subject: Re: [PATCH v3 03/11] KVM: nVMX: Re-evaluate L1 pending events when running L2 and L1 got posted-interrupt
Date: Tue, 02 Jan 2018 14:20:37 +0200 [thread overview]
Message-ID: <5A4B7915.1030907@ORACLE.COM> (raw)
In-Reply-To: <32a6109a-5288-0db6-bf20-92417abe66ad@gmail.com>
On 02/01/18 13:52, Quan Xu wrote:
>
>
> On 2018年01月02日 19:21, Quan Xu wrote:
>>
>> yes,
>>
>> the key point is what does 'a new L1 injectable interrupt' mean..
>>
>> in your patch, __IIUC__ one of condition to exit guest mode:
>> 1) max_irr_updated - 'vector of PIR' > 'vectors of previous IRR'
>>
>>
>> as the SDM algorithm said, even if:
>> 'vector of PIR' < 'vectors of previos IRR'
>>
>> If we has synced PIR to L1's APIC IRR, the 'vector of PIR' _may_ be
>> delivered to VM..
> If we has synced PIR to L1's APIC IRR, the 'vector of PIR' _may_ be
> delivered to VM before next VMExit..
>
>> it is a new injectable interrupt as well..
>>
>>
>>
>> Quan
>> Alibaba Cloud
>
In case APICv is active (relevant to our case), __apic_accept_irq()
handles APIC_DM_FIXED by calling deliver_posted_interrupt() which will
set a bit in PIR instead of setting a bit in LAPIC IRR.
Therefore, in case APICv is active, the bits that are set in LAPIC IRR
are bits which were synced from PIR to IRR by some previous call of
vmx_sync_pir_to_irr(). (Not considering the case of some user-mode API
setting them manually).
Therefore, the only new injectable interrupts we can encounter in
vmx_sync_pir_to_irr() are vectors coming from the PIR.
It is also not possible for the guest to block interrupt vector X while
still being able to accept vector Y if Y<X. Therefore, it is enough to
just check if max vector from PIR > max vector from IRR before the sync.
It is true that VID will inject the vector in RVI to the guest if
possible on VMEntry. RVI is set by vmx_sync_pir_to_irr() to either the
max value from PIR or the max value from IRR. If the max value from IRR
> max value from PIR, then the vector to be injected to guest was
already evaluated if it should exit to L1 by check_nested_events() and
therefore we don't need to call kvm_vcpu_exiting_guest_mode() again.
Regards,
-Liran
next prev parent reply other threads:[~2018-01-02 12:20 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-24 16:12 [PATCH v3 00/11] KVM: nVMX: Fix multiple issues in nested posted-interrupts Liran Alon
2017-12-24 16:12 ` [PATCH v3 01/11] KVM: x86: Optimization: Create SVM stubs for sync_pir_to_irr() Liran Alon
2017-12-27 9:56 ` Paolo Bonzini
2017-12-27 10:01 ` Liran Alon
2017-12-24 16:12 ` [PATCH v3 02/11] KVM: x86: Change __kvm_apic_update_irr() to also return if max IRR updated Liran Alon
2018-01-02 1:51 ` Quan Xu
2017-12-24 16:12 ` [PATCH v3 03/11] KVM: nVMX: Re-evaluate L1 pending events when running L2 and L1 got posted-interrupt Liran Alon
2018-01-02 2:45 ` Quan Xu
2018-01-02 9:57 ` Liran Alon
2018-01-02 11:21 ` Quan Xu
2018-01-02 11:52 ` Quan Xu
2018-01-02 12:20 ` Liran Alon [this message]
2018-01-03 5:32 ` Quan Xu
2018-01-03 5:35 ` Quan Xu
2017-12-24 16:12 ` [PATCH v3 04/11] KVM: nVMX: Fix injection to L2 when L1 don't intercept external-interrupts Liran Alon
2017-12-24 16:12 ` [PATCH v3 05/11] KVM: x86: Rename functions which saves vCPU in per-cpu var Liran Alon
2017-12-24 16:12 ` [PATCH v3 06/11] KVM: x86: Set current_vcpu per-cpu var before enabling interrupts at host Liran Alon
2017-12-27 10:06 ` Paolo Bonzini
2017-12-27 10:44 ` Liran Alon
2017-12-24 16:12 ` [PATCH v3 07/11] KVM: x86: Add util for getting current vCPU running on CPU Liran Alon
2017-12-24 16:13 ` [PATCH v3 08/11] KVM: x86: Register empty handler for POSTED_INTR_NESTED_VECTOR IPI Liran Alon
2017-12-24 16:13 ` [PATCH v3 09/11] KVM: nVMX: Deliver missed nested-PI notification-vector via self-IPI while interrupts disabled Liran Alon
2017-12-24 16:13 ` [PATCH v3 10/11] KVM: nVMX: Wake halted L2 on nested posted-interrupt Liran Alon
2017-12-27 11:31 ` Paolo Bonzini
2017-12-27 12:01 ` Liran Alon
2017-12-27 12:27 ` Paolo Bonzini
2017-12-27 12:52 ` Liran Alon
2017-12-27 13:05 ` Paolo Bonzini
2017-12-27 15:33 ` Liran Alon
2017-12-27 15:54 ` Paolo Bonzini
2018-01-01 21:32 ` Paolo Bonzini
2018-01-01 22:37 ` Liran Alon
2018-01-02 7:25 ` Paolo Bonzini
2017-12-24 16:13 ` [PATCH v3 11/11] KVM: nVMX: Wake L2 from HLT when nested posted-interrupt pending Liran Alon
2017-12-27 10:15 ` Paolo Bonzini
2017-12-27 10:51 ` Liran Alon
2017-12-27 12:55 ` Paolo Bonzini
2017-12-27 15:15 ` Liran Alon
2017-12-27 15:55 ` Paolo Bonzini
2020-11-23 19:22 ` Oliver Upton
2020-11-23 22:42 ` Paolo Bonzini
2020-11-24 0:10 ` Oliver Upton
2020-11-24 0:13 ` Oliver Upton
2020-11-24 1:55 ` Sean Christopherson
2020-11-24 3:19 ` Sean Christopherson
2020-11-24 11:39 ` Paolo Bonzini
2020-11-24 21:22 ` Sean Christopherson
2020-11-25 0:10 ` Paolo Bonzini
2020-11-25 1:14 ` Sean Christopherson
2020-11-25 17:00 ` Paolo Bonzini
2020-11-25 18:32 ` Sean Christopherson
2020-11-26 13:13 ` Paolo Bonzini
2020-11-30 19:14 ` Sean Christopherson
2020-11-30 19:36 ` Paolo Bonzini
2020-12-03 22:07 ` Jim Mattson
2020-11-24 11:09 ` Paolo Bonzini
2020-12-03 21:45 ` Jim Mattson
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=5A4B7915.1030907@ORACLE.COM \
--to=liran.alon@oracle.com \
--cc=idan.brown@ORACLE.COM \
--cc=jmattson@google.com \
--cc=konrad.wilk@ORACLE.COM \
--cc=kvm@vger.kernel.org \
--cc=liam.merwick@ORACLE.COM \
--cc=pbonzini@redhat.com \
--cc=quan.xu0@gmail.com \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.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;
as well as URLs for NNTP newsgroup(s).