From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 4/7] KVM: vmx: Allow the guest to run with dirty debug registers Date: Sun, 09 Mar 2014 21:12:05 +0100 Message-ID: <531CCB15.6070402@redhat.com> References: <1394192571-11056-1-git-send-email-pbonzini@redhat.com> <1394192571-11056-5-git-send-email-pbonzini@redhat.com> <20140309182639.GA10479@potion.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, alex.williamson@redhat.com, mtosatti@redhat.com, gleb@kernel.org, jan.kiszka@siemens.com To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: In-Reply-To: <20140309182639.GA10479@potion.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Il 09/03/2014 19:26, Radim Kr=C4=8Dm=C3=A1=C5=99 ha scritto: > > + > > + cpu_based_vm_exec_control =3D vmcs_read32(CPU_BASED_VM_EXEC_CONT= ROL); > > + cpu_based_vm_exec_control &=3D ~CPU_BASED_MOV_DR_EXITING; > > + vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_contro= l); > > vmcs_clear_bits() covers exactly this use-case. > (Barring the explicit bit-width.) Good idea. > > + > > + /* > > + * No more DR vmexits; force a reload of the debug registers > > + * and reenter on this instruction. The next vmexit will > > + * retrieve the full state of the debug registers. > > + */ > > + vcpu->arch.switch_db_regs |=3D KVM_DEBUGREG_WONT_EXIT; > > + return 1; > > + } > > + > > We could make the code slighly uglier and move the functional part of > this block before the previous one, so it would do both things in one > exit. I considered this, but decided that it's unlikely for emulation to be=20 faster than hardware---especially on those AMD CPUs that lack decode=20 assists (and it's good for VMX and SVM code to look as similar as possi= ble). > (Exception handler will likely access DR too.) Which exception handler? Paolo