From patchwork Tue Nov 29 20:40:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Huey X-Patchwork-Id: 9453097 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 A95146071E for ; Tue, 29 Nov 2016 20:41:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DAE528334 for ; Tue, 29 Nov 2016 20:41:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9275D283E8; Tue, 29 Nov 2016 20:41:12 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3372528389 for ; Tue, 29 Nov 2016 20:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757279AbcK2UlH (ORCPT ); Tue, 29 Nov 2016 15:41:07 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34913 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757187AbcK2Ukz (ORCPT ); Tue, 29 Nov 2016 15:40:55 -0500 Received: by mail-pg0-f67.google.com with SMTP id p66so17387646pga.2 for ; Tue, 29 Nov 2016 12:40:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B+dCGilU30NTLPiVL6S2Uy6Mtxjljb+iyRUn1djCIno=; b=SVsECyQc0XOGEExxWzes1jPQioJovy+S0+o9D2dwldSj4rizpXFsH8fAB034q22fzG SL2Zf5fEdwQF4noD41o0VdgwztLYpGoLBP6wR0ArM2AE5wEwcFfEXlyvnIS7mb2Esd// tlkGRcqeGmeIN/uBCSm3X4OjG/COuLeClwDOFBypRZ3xhZBAsOFZA5okLauy5KJTAvt2 F4tDEyRkZHMLiJXdoEcKVj5nxo+TgVQaJqSv1iVnSVls0r5qMmDXOxJoNMzeXLoxLltZ yBmchrLaMlu7/0EtdIH8N0FY1FluaTA6Grr1BIMLrwlmWsJC0/5cEnFoNIecLeGxcgOW 3P6A== 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=B+dCGilU30NTLPiVL6S2Uy6Mtxjljb+iyRUn1djCIno=; b=ixUXOh2ko2WldpmiEe9eus92rBCPSIO+Qdb20pLuFqC3HJYCzVWc0MKiWMaSn952tm pwZ7nHa8C95Qxd0E56jJJq5Fr5h8UB1MVWjxY0iBQGb0cO63rkDgPedbXeRbAvDHMkrT HP9DVhZ2+z9ZW+tD9PkDWlIP2UYvXrTjVpViN91evvdyqCmeipvj/5QghcQENhPyPCqd MLHl9qAg5LGVTpz0EapkqXm+1L8SRFe3PN3OTw2Q9qULKuIk/TEgIDgWFgCgKW34QEwf CZT5mMnmH0TkedERxJ6DBk3HyoGcntKRbyxskQacGokSqhU5JzctwpwuBEUl8HWpscpX FFYA== X-Gm-Message-State: AKaTC03hYVRQiESwSxwdbOEd6ctJXrUI92eAbVCo9dd4GEc4PY3F1eFs567blBBk9D66oA== X-Received: by 10.99.141.193 with SMTP id z184mr53475632pgd.23.1480452054815; Tue, 29 Nov 2016 12:40:54 -0800 (PST) Received: from minbar.hsd1.ca.comcast.net (c-73-162-102-141.hsd1.ca.comcast.net. [73.162.102.141]) by smtp.gmail.com with ESMTPSA id p1sm42269642pgc.29.2016.11.29.12.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Nov 2016 12:40:54 -0800 (PST) From: Kyle Huey X-Google-Original-From: Kyle Huey To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Joerg Roedel Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] KVM: x86: Do not clear RFLAGS.TF when a singlestep trap occurs. Date: Tue, 29 Nov 2016 12:40:41 -0800 Message-Id: <20161129204041.8839-6-khuey@kylehuey.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161129204041.8839-1-khuey@kylehuey.com> References: <20161129204041.8839-1-khuey@kylehuey.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The trap flag stays set until software clears it. Signed-off-by: Kyle Huey --- arch/x86/kvm/x86.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7b38c5e..dd6b41e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5414,17 +5414,16 @@ static void kvm_vcpu_check_singlestep(struct kvm_vcpu *vcpu, unsigned long rflag if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) { kvm_run->debug.arch.dr6 = DR6_BS | DR6_FIXED_1 | DR6_RTM; kvm_run->debug.arch.pc = vcpu->arch.singlestep_rip; kvm_run->debug.arch.exception = DB_VECTOR; kvm_run->exit_reason = KVM_EXIT_DEBUG; *r = EMULATE_USER_EXIT; } else { - vcpu->arch.emulate_ctxt.eflags &= ~X86_EFLAGS_TF; /* * "Certain debug exceptions may clear bit 0-3. The * remaining contents of the DR6 register are never * cleared by the processor". */ vcpu->arch.dr6 &= ~15; vcpu->arch.dr6 |= DR6_BS | DR6_RTM; kvm_queue_exception(vcpu, DB_VECTOR);