From patchwork Mon Jun 27 18:08:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 9201081 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 6EB8A60757 for ; Mon, 27 Jun 2016 18:10:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 657AC285AC for ; Mon, 27 Jun 2016 18:10:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59CEA285AF; Mon, 27 Jun 2016 18:10:48 +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 ED8BB285AC for ; Mon, 27 Jun 2016 18:10:46 +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 1bHaxK-0003GP-6Y; Mon, 27 Jun 2016 18:08:22 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHaxJ-0003Fn-1f for xen-devel@lists.xenproject.org; Mon, 27 Jun 2016 18:08:21 +0000 Received: from [193.109.254.147] by server-16.bemta-14.messagelabs.com id E6/91-24830-49B61775; Mon, 27 Jun 2016 18:08:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRWlGSWpSXmKPExsVyMfT+Id3J2YX hBgtP6Vt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlvr35kKXgrVHHr5QO2BsZV3F2MXBxCAjMZ JfYd2MAG4kgI9LNKHFrbD+RwAjkxEou7O1kg7CqJiecng9lCAhoSt282skN0T2KSOHnzJTtIg k1AW6Lt9S5WEFtEQEni3qrJTCBFzAKHGSVuzWgCKxIWsJHY9Xw7mM0ioCoxu/kgkM3BwSvgJH HrdxLEMjmJy9MfsIGEOQWcJaacVoPY6yTxZsscpgmM/AsYGVYxqhenFpWlFuka6SUVZaZnlOQ mZuboGhqa6OWmFhcnpqfmJCYV6yXn525iBIYPAxDsYGyZ43yIUZKDSUmUd9uj3HAhvqT8lMqM xOKM+KLSnNTiQ4wyHBxKErwPMgvDhQSLUtNTK9Iyc4CBDJOW4OBREuF9D5LmLS5IzC3OTIdIn WI05tjy+9paJo5tU++tZRJiycvPS5US5/XNAioVACnNKM2DGwSLsEuMslLCvIxApwnxFKQW5W aWoMq/YhTnYFQS5v0GspAnM68Ebt8roFOYgE5hrc4HOaUkESEl1cC4jn3/Gb9Gm5M5jz7MtOW 6UuO8wkvxUtcN0Yd91lLfDi2feFiEJUQwSTT7sulHa+m9Qp/VD0VYBD9bIB1beieD9+Elz+AS zbmXLgm/y91qYGTB4nQgZdGUg+v8/DwKeqc1Rgr2OL7Lyt948t2nZccvi5Rd1JMtl079FPHrf sR0z/T2kLssbzYpsRRnJBpqMRcVJwIAivvvQasCAAA= X-Env-Sender: tamas.k.lengyel@gmail.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1467050898!50095867!1 X-Originating-IP: [209.85.223.194] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63878 invoked from network); 27 Jun 2016 18:08:19 -0000 Received: from mail-io0-f194.google.com (HELO mail-io0-f194.google.com) (209.85.223.194) by server-3.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Jun 2016 18:08:19 -0000 Received: by mail-io0-f194.google.com with SMTP id t74so24494369ioi.0 for ; Mon, 27 Jun 2016 11:08:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P+JYteIa5QUTXOKFirZVLInI+IkNYr1O76ATv5u6kVg=; b=eO648R5yDMBvLyVGuKg5gtbv3kDOQ0dMnVPwOevnt7hCvIBNMDH1hmvJQnLzgdJo90 jAjKVQ5HtNxXppMow/PguWuG4vq+B8mxu0kD2R7896iwvSiKDzNYtxcGKwwZvhCeJIo3 oni7h4CQb9UuXvHeXdepbivJ46fs1fyarXUEF8pV52OYQbhf30xODJzCkkvbVkAAirpU U2czi2Bu5WyON2swpTCWAb5OH4TktOuGk48Du7SAAXg198vxwuEeR9QNtssuMH6puk4K pQYQSWZAbv+66nsydVMzJtv39bz8tT2SBTGlHl2AEiQqI8hh073xZIDcawyDkR/Em+zb PvaA== X-Gm-Message-State: ALyK8tIDogC5sGJ/gJtpffjWWja+2YNxK4Us5DCUEtQpMkXSHFX/ccY2s8gSxHQIcKMF/Q== X-Received: by 10.107.188.131 with SMTP id m125mr2226441iof.1.1467050898123; Mon, 27 Jun 2016 11:08:18 -0700 (PDT) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id l187sm3737101ite.22.2016.06.27.11.08.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 11:08:17 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Mon, 27 Jun 2016 12:08:07 -0600 Message-Id: <1467050887-5806-3-git-send-email-tamas@tklengyel.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467050887-5806-1-git-send-email-tamas@tklengyel.com> References: <1467050887-5806-1-git-send-email-tamas@tklengyel.com> Cc: Andrew Cooper , Kevin Tian , Tamas K Lengyel , Jan Beulich , Jun Nakajima Subject: [Xen-devel] [PATCH v7 3/3] x86/vmx: Clean up TRAP_int3 handling 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Clean up the handling of TRAP_int3 VMEXITs to conform to the handling of TRAP_debug. Signed-off-by: Tamas K Lengyel Acked-by: Kevin Tian --- Cc: Jun Nakajima Cc: Kevin Tian Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/hvm/vmx/vmx.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 5b22d87..c981450 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3402,17 +3402,10 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) else domain_pause_for_debugger(); break; - case TRAP_int3: - { + case TRAP_int3: HVMTRACE_1D(TRAP, vector); - if ( v->domain->debugger_attached ) + if ( !v->domain->debugger_attached ) { - update_guest_eip(); /* Safe: INT3 */ - v->arch.gdbsx_vcpu_event = TRAP_int3; - domain_pause_for_debugger(); - break; - } - else { unsigned long insn_len; int rc; @@ -3423,22 +3416,17 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) insn_len); if ( !rc ) - { - struct hvm_trap trap = { - .vector = TRAP_int3, - .type = X86_EVENTTYPE_SW_EXCEPTION, - .error_code = HVM_DELIVER_NO_ERROR_CODE, - .insn_len = insn_len - }; - hvm_inject_trap(&trap); - break; - } - if ( rc > 0 ) - break; + vmx_propagate_intr(intr_info); + if ( rc < 0 ) + goto exit_and_crash; } - - goto exit_and_crash; - } + else + { + update_guest_eip(); /* Safe: INT3 */ + v->arch.gdbsx_vcpu_event = TRAP_int3; + domain_pause_for_debugger(); + } + break; case TRAP_no_device: HVMTRACE_1D(TRAP, vector); vmx_fpu_dirty_intercept();