From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
"Nadav Har'El" <nyh@math.technion.ac.il>,
"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [PATCH] KVM: nVMX: Rework event injection and recovery
Date: Wed, 20 Feb 2013 17:48:40 +0100 [thread overview]
Message-ID: <5124FE68.5030101@siemens.com> (raw)
In-Reply-To: <20130220164634.GR3600@redhat.com>
On 2013-02-20 17:46, Gleb Natapov wrote:
> On Wed, Feb 20, 2013 at 02:01:47PM +0100, Jan Kiszka wrote:
>> This aligns VMX more with SVM regarding event injection and recovery for
>> nested guests. The changes allow to inject interrupts directly from L0
>> to L2.
>>
>> One difference to SVM is that we always transfer the pending event
>> injection into the architectural state of the VCPU and then drop it from
>> there if it turns out that we left L2 to enter L1.
>>
>> VMX and SVM are now identical in how they recover event injections from
>> unperformed vmlaunch/vmresume: We detect that VM_ENTRY_INTR_INFO_FIELD
>> still contains a valid event and, if yes, transfer the content into L1's
>> idt_vectoring_info_field.
>>
>> To avoid that we incorrectly leak an event into the architectural VCPU
>> state that L1 wants to inject, we skip cancellation on nested run.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Survived moderate testing here and (currently) makes sense to me, but
>> please review very carefully. I wouldn't be surprised if I'm still
>> missing some subtle corner case.
>>
>> arch/x86/kvm/vmx.c | 57 +++++++++++++++++++++++----------------------------
>> 1 files changed, 26 insertions(+), 31 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index dd3a8a0..7d2fbd2 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -6489,8 +6489,6 @@ static void __vmx_complete_interrupts(struct vcpu_vmx *vmx,
>>
>> static void vmx_complete_interrupts(struct vcpu_vmx *vmx)
>> {
>> - if (is_guest_mode(&vmx->vcpu))
>> - return;
>> __vmx_complete_interrupts(vmx, vmx->idt_vectoring_info,
>> VM_EXIT_INSTRUCTION_LEN,
>> IDT_VECTORING_ERROR_CODE);
>> @@ -6498,7 +6496,7 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx)
>>
>> static void vmx_cancel_injection(struct kvm_vcpu *vcpu)
>> {
>> - if (is_guest_mode(vcpu))
>> + if (to_vmx(vcpu)->nested.nested_run_pending)
>> return;
> Why is this needed here?
Please check if my reply to Nadav explains this sufficiently.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2013-02-20 16:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 13:01 [PATCH] KVM: nVMX: Rework event injection and recovery Jan Kiszka
2013-02-20 14:14 ` Nadav Har'El
2013-02-20 14:37 ` Jan Kiszka
2013-02-20 17:01 ` Gleb Natapov
2013-02-20 17:24 ` Jan Kiszka
2013-02-20 17:50 ` Jan Kiszka
2013-02-21 9:22 ` Gleb Natapov
2013-02-21 9:43 ` Jan Kiszka
2013-02-21 10:06 ` Gleb Natapov
2013-02-21 10:18 ` Jan Kiszka
2013-02-21 10:28 ` Jan Kiszka
2013-02-21 10:33 ` Jan Kiszka
2013-02-21 13:13 ` Gleb Natapov
2013-02-21 13:22 ` Jan Kiszka
2013-02-21 13:37 ` Nadav Har'El
2013-02-21 13:45 ` Gleb Natapov
2013-02-21 13:28 ` Nadav Har'El
2013-02-20 14:53 ` Jan Kiszka
2013-02-20 15:30 ` Gleb Natapov
2013-02-20 15:51 ` Jan Kiszka
2013-02-20 15:57 ` Gleb Natapov
2013-02-20 16:00 ` Jan Kiszka
2013-02-20 16:46 ` Gleb Natapov
2013-02-20 16:48 ` Jan Kiszka [this message]
2013-02-20 16:51 ` Gleb Natapov
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=5124FE68.5030101@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=gleb@redhat.com \
--cc=jun.nakajima@intel.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=nyh@math.technion.ac.il \
/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