From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Use thread debug register storage instead of kvm specific data Date: Tue, 01 Sep 2009 14:21:25 +0300 Message-ID: <4A9D03B5.4000403@redhat.com> References: <1251798248-13164-1-git-send-email-avi@redhat.com> <4A9CFA90.50202@siemens.com> <4A9D0289.7080201@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "kvm@vger.kernel.org" To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61222 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753911AbZIALV0 (ORCPT ); Tue, 1 Sep 2009 07:21:26 -0400 In-Reply-To: <4A9D0289.7080201@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/01/2009 02:16 PM, Avi Kivity wrote: > >>> set_debugreg(0, 7); >>> set_debugreg(vcpu->arch.eff_db[0], 0); >>> set_debugreg(vcpu->arch.eff_db[1], 1); >>> @@ -3645,15 +3638,14 @@ static int vcpu_enter_guest(struct kvm_vcpu >>> *vcpu) >>> trace_kvm_entry(vcpu->vcpu_id); >>> kvm_x86_ops->run(vcpu); >>> >>> - if (unlikely(vcpu->arch.switch_db_regs)) { >>> - set_debugreg(0, 7); >>> - set_debugreg(vcpu->arch.host_db[0], 0); >>> - set_debugreg(vcpu->arch.host_db[1], 1); >>> - set_debugreg(vcpu->arch.host_db[2], 2); >>> - set_debugreg(vcpu->arch.host_db[3], 3); >>> + if (unlikely(vcpu->arch.switch_db_regs || >>> test_thread_flag(TIF_DEBUG))) { >> IIRC, you must clear dr7 before loading dr0..3 to avoid spurious >> effects. > > Yeah, I thought of it but forgot to implement it. Actually on the entry path it is done correctly, and on the exit path dr7 is cleared, so this patch is correct. -- error compiling committee.c: too many arguments to function