From patchwork Sat Feb 16 11:51:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 2151621 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1A3113FE80 for ; Sat, 16 Feb 2013 11:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753172Ab3BPLvb (ORCPT ); Sat, 16 Feb 2013 06:51:31 -0500 Received: from mout.web.de ([212.227.17.12]:58633 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753164Ab3BPLva (ORCPT ); Sat, 16 Feb 2013 06:51:30 -0500 Received: from mchn199C.mchp.siemens.de ([95.157.56.37]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0M8hsl-1UsIrx1pKt-00vvxe; Sat, 16 Feb 2013 12:51:23 +0100 Message-ID: <511F72B8.6060305@web.de> Date: Sat, 16 Feb 2013 12:51:20 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Gleb Natapov , Marcelo Tosatti CC: kvm , Nadav Har'El , "Nakajima, Jun" Subject: [PATCH] KVM: nVMX: Fix injection of PENDING_INTERRUPT and NMI_WINDOW exits to L1 X-Enigmail-Version: 1.5 X-Provags-ID: V02:K0:3oSI6IF9rtxJQNJS7zgROFJ+zNkkbV7NWENXxJ5tuhM qbHas/mdR6obgdhr83QPfKOBJm1nxru3wZY3ZHVspBdjD3b9DK /3V8LVLYBdGU6ZgV9yT5zgUWXp/WPdK/oCKI9qcz2yYg0t2dqj 0lFfV1/SnZfKoQmJ8LGoEXuyXsvQaLmgj/vBBYzl4XvKIiZ/9C 9xwUKN9khax8fECb/A4GA== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Jan Kiszka 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 --- 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: