Re: [PATCH 2/2] deal with interrupt shadow state for emulated instruction

Avi Kivity
2009-05-10T13:11:01Z

Glauber Costa wrote:
> we currently unblock shadow interrupt state when we skip an instruction,
> but failing to do so when we actually emulate one. This blocks interrupts
> in key instruction blocks, in particular sti; hlt; sequences
>
> If the instruction emulated is an sti, we have to block shadow interrupts.
> The same goes for mov ss. pop ss also needs it, but we don't currently
> emulate it.
>
> Without this patch, I cannot boot gpxe option roms at vmx machines.
> This is described at https://bugzilla.redhat.com/show_bug.cgi?id=494469
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 3d8fcc5..c456aa5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2362,7 +2362,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
> u16 error_code,
> int emulation_type)
> {
> - int r;
> + int r, shadow_mask;
> struct decode_cache *c;
>
> kvm_clear_exception_queue(vcpu);
> @@ -2415,7 +2415,12 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
> return EMULATE_DONE;
> }
>
> + vcpu->arch.emulate_ctxt.interruptibility = 0;
>

If the instruction is sti or mov ss, this is ouput only. Otherwise, it
is an input/output parameter.

To reduce confusion suggest moving this statement to x86_emulate_insn,
so it can be an output-only parameter.

--
error compiling committee.c: too many arguments to function