On 2013-02-16 12:51, Jan Kiszka wrote:
> From: Jan Kiszka <[email protected]>
> 
> The comment was wrong: enable_irq_window might be called after
> prepare_vmcs02 when we left L2 to prepare IRQ injecting for L1. Same for
> NMIs.
> 
> Signed-off-by: Jan Kiszka <[email protected]>
> ---
>  arch/x86/kvm/vmx.c |   10 +++-------
>  1 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 81a25de..68a045ae 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6113,14 +6113,10 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu 
> *vcpu)
>       case EXIT_REASON_TRIPLE_FAULT:
>               return 1;
>       case EXIT_REASON_PENDING_INTERRUPT:
> +             return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING);
>       case EXIT_REASON_NMI_WINDOW:
> -             /*
> -              * prepare_vmcs02() set the CPU_BASED_VIRTUAL_INTR_PENDING bit
> -              * (aka Interrupt Window Exiting) only when L1 turned it on,
> -              * so if we got a PENDING_INTERRUPT exit, this must be for L1.
> -              * Same for NMI Window Exiting.
> -              */
> -             return 1;
> +             return vmcs12->pin_based_vm_exec_control &
> +                     PIN_BASED_NMI_EXITING;
>       case EXIT_REASON_TASK_SWITCH:
>               return 1;
>       case EXIT_REASON_CPUID:
> 

No, this is wrong. I first wrote a patch that ignored enable_irq_window
when the guest is not interested in external IRQs. But then I thought
that wasn't correct. I tend to believe now my first idea was better.

Need to rethink.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to