From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: VMX: Conditionally reload debug register 6 Date: Tue, 01 Sep 2009 14:32:11 +0200 Message-ID: <4A9D144B.1020807@siemens.com> References: <1251805232-16885-1-git-send-email-avi@redhat.com> <4A9D08D2.1020407@siemens.com> <4A9D0B47.20805@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from thoth.sbs.de ([192.35.17.2]:23107 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754314AbZIAMcW (ORCPT ); Tue, 1 Sep 2009 08:32:22 -0400 In-Reply-To: <4A9D0B47.20805@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > On 09/01/2009 02:43 PM, Jan Kiszka wrote: >> @@ -3731,7 +3732,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) >>> | (1<< VCPU_EXREG_PDPTR)); >>> vcpu->arch.regs_dirty = 0; >>> >>> - get_debugreg(vcpu->arch.dr6, 6); >>> + if (vcpu->arch.switch_db_regs) >>> + get_debugreg(vcpu->arch.dr6, 6); >>> >>> vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); >>> if (vmx->rmode.irq.pending) >>> >> That reduces the emulation quality as vcpu->arch.switch_db_regs is only >> set if some breakpoint is active while dr6 has its use also when that is >> not the case). >> > > True - there's the TF reason reporting bits. > > How about this then: > > - if !switch_db_regs, trap #DB > - on #DB trap, copy DR6.BS and DR6.BT to vcpu->arch.dr6, and reinject > the #DB > > ? I'm worried about vm-exits that may take precedence over the #db trap. If we skip to save/restore dr6 for them, the value that the interception handler sees later on will be bogus. Or is this architecturally impossible? Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux