From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/5] kvm/svm: enhance mov DR intercept handler Date: Tue, 07 Dec 2010 15:14:42 +0200 Message-ID: <4CFE3342.8050102@redhat.com> References: <1291719586-22533-1-git-send-email-andre.przywara@amd.com> <1291719586-22533-4-git-send-email-andre.przywara@amd.com> <979C9704-9300-486F-B0C7-A7721842CFBE@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Andre Przywara , kvm@vger.kernel.org, mtosatti@redhat.com To: Alexander Graf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:8075 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752041Ab0LGNOv (ORCPT ); Tue, 7 Dec 2010 08:14:51 -0500 In-Reply-To: <979C9704-9300-486F-B0C7-A7721842CFBE@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On 12/07/2010 01:02 PM, Alexander Graf wrote: > On 07.12.2010, at 11:59, Andre Przywara wrote: > > > Newer SVM implementations provide the GPR number in the VMCB, so > > that the emulation path is no longer necesarry to handle debug > > register access intercepts. Implement the handling in svm.c and > > use it when the info is provided. > > > > Signed-off-by: Andre Przywara > > --- > > arch/x86/kvm/svm.c | 55 ++++++++++++++++++++++++++++++++++++--------------- > > 1 files changed, 39 insertions(+), 16 deletions(-) > > > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > > index b7233fd..369bd85 100644 > > --- a/arch/x86/kvm/svm.c > > +++ b/arch/x86/kvm/svm.c > > @@ -2669,6 +2669,29 @@ static int cr0_write_interception(struct vcpu_svm *svm) > > return r == EMULATE_DONE; > > } > > > > +static int dr_interception(struct vcpu_svm *svm) > > +{ > > + int reg, dr; > > + unsigned long val; > > + > > + if (!boot_cpu_has(SVM_FEATURE_DECODE_ASSIST)) > > + return emulate_on_interception(svm); > > Wouldn't it be better to just change the entry in svm_exit_handlers if we detect that feature on init? No unnecessary branching then. > I'd rather make them const instead. For something performance critical (unlike this) we can use static_cpu_has(). -- error compiling committee.c: too many arguments to function