Re: [PATCH 3/4] KVM: VMX: Emulated real mode interrupt injection

Marcelo Tosatti
2010-09-21T15:59:15Z

On Tue, Sep 21, 2010 at 01:56:50PM +0200, Avi Kivity wrote:
> On 09/20/2010 07:30 PM, Marcelo Tosatti wrote:
> >> static void __vmx_complete_interrupts(struct vcpu_vmx *vmx,
> >> u32 idt_vectoring_info,
> >> int instr_len_field,
> >> @@ -3864,9 +3814,6 @@ static void __vmx_complete_interrupts(struct vcpu_vmx *vmx,
> >> int type;
> >> bool idtv_info_valid;
> >>
> >> - if (vmx->rmode.irq.pending)
> >> - fixup_rmode_irq(vmx,&idt_vectoring_info);
> >> -
> >
> >Don't you have to undo kvm_inject_realmode_interrupt if injection fails?
> >
> >
>
> Injection cannot fail (at least, in the same sense as the vmx
> injections). It's actually not about failures, it's about guest
> entry being cancelled due to a signal or some KVM_REQ that needs
> attention. For vmx style injections, we need to undo the injection
> to keep things in a consistent state. To realmode emulated
> injection, everything is in a consistent state already, so no need
> to undo anything (it's also impossible, since we overwrote memory on
> the stack).

Aren't you going to push EFLAGS,CS,EIP on the stack twice if that
occurs?

Yes, can't undo it...