From patchwork Wed Sep 13 13:00:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9951353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F1EB6024A for ; Wed, 13 Sep 2017 13:04:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 715E5286D1 for ; Wed, 13 Sep 2017 13:04:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6607E28D00; Wed, 13 Sep 2017 13:04:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A0B829106 for ; Wed, 13 Sep 2017 13:03:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds7HX-0005Pq-C1; Wed, 13 Sep 2017 13:00:43 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ds7HV-0005Pg-SX for xen-devel@lists.xen.org; Wed, 13 Sep 2017 13:00:41 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 50/44-03642-9FB29B95; Wed, 13 Sep 2017 13:00:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXitHSDve4P7Z2 RBr39mhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bF47NYCr7yVbSsP8PSwLiau4uRk0NCwF/i xtFnbCA2m4CexMbZr5hAbBEBWYnVXXPYuxi5OJgFjjBKTF11hB0kISwQInH1wnkWEJtFQFViz /tHYDavgK1E/7ZOVoih8hK72i6C2UJANa9f7IKqEZQ4OfMJmM0sICFx8MUL5gmM3LOQpGYhSS 1gZFrFqFGcWlSWWqRrZK6XVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iREYDgxAsIN x8drAQ4ySHExKorwKGjsjhfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwNmsB5QSLUtNTK9Iyc4CB CZOW4OBREuHlAganEG9xQWJucWY6ROoUoy5Hx827f5iEWPLy81KlxHlfgMwQACnKKM2DGwGLk kuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5tUEmcKTmVcCt+kV0BFMQEecOb0D5IiSRISUVA NjN+PpnEL7sj7/K9sLLPd94D57izvkuEJIw9JEw65skWOp79tj5PqeN+1W33I2YvHvLqe++Un P9icfWfjv7bn/S27cP//uOufT2H7+aK8Nmy+1KK00OB7Ev/mPGi+b0vuizbWLXp2+vipkRW+r 8MO4+/z/QgXvTTCwW90kttnEX9/A9wF7xDkbJZbijERDLeai4kQAH+7t6I0CAAA= X-Env-Sender: prvs=422d06d85=sergey.dyasli@citrix.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1505307639!79168414!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57032 invoked from network); 13 Sep 2017 13:00:40 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 13 Sep 2017 13:00:40 -0000 X-IronPort-AV: E=Sophos;i="5.42,388,1500940800"; d="scan'208";a="447688805" From: Sergey Dyasli To: Date: Wed, 13 Sep 2017 14:00:34 +0100 Message-ID: <20170913130034.11046-1-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: Andrew Cooper , Kevin Tian , Jan Beulich , Jun Nakajima , Sergey Dyasli Subject: [Xen-devel] [PATCH v1] x86/vvmx: add hvm_intsrc_vector support to nvmx_intr_intercept() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Under the following circumstances: 1. L1 doesn't enable PAUSE exiting or PAUSE-loop exiting controls 2. L2 executes PAUSE in a loop with RFLAGS.IE == 0 L1's PV IPI through event channel will never reach the target L1's vCPU which runs L2 because nvmx_intr_intercept() doesn't know about hvm_intsrc_vector. This leads to infinite L2 loop without nested vmexits and can cause L1 to hang. The issue is easily reproduced with Qemu/KVM on CentOS-7-1611 as L1 and an L2 guest with SMP. Fix nvmx_intr_intercept() by injecting hvm_intsrc_vector irq into L1 which will cause nested vmexit. Signed-off-by: Sergey Dyasli Acked-by: Kevin Tian --- xen/arch/x86/hvm/vmx/intr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c index e1d0190ca9..4c0f1c8f71 100644 --- a/xen/arch/x86/hvm/vmx/intr.c +++ b/xen/arch/x86/hvm/vmx/intr.c @@ -188,13 +188,13 @@ static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack) if ( nestedhvm_vcpu_in_guestmode(v) ) { + ctrl = get_vvmcs(v, PIN_BASED_VM_EXEC_CONTROL); + if ( !(ctrl & PIN_BASED_EXT_INTR_MASK) ) + return 0; + if ( intack.source == hvm_intsrc_pic || intack.source == hvm_intsrc_lapic ) { - ctrl = get_vvmcs(v, PIN_BASED_VM_EXEC_CONTROL); - if ( !(ctrl & PIN_BASED_EXT_INTR_MASK) ) - return 0; - vmx_inject_extint(intack.vector, intack.source); ctrl = get_vvmcs(v, VM_EXIT_CONTROLS); @@ -213,6 +213,11 @@ static int nvmx_intr_intercept(struct vcpu *v, struct hvm_intack intack) return 1; } + else if ( intack.source == hvm_intsrc_vector ) + { + vmx_inject_extint(intack.vector, intack.source); + return 1; + } } return 0;