From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Remove arch specific components from the general code Date: Thu, 26 Jul 2007 13:03:11 +0300 Message-ID: <46A8715F.9010701@qumranet.com> References: <20070726042948.5893.58975.stgit@novell1.haskins.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Gregory Haskins Return-path: In-Reply-To: <20070726042948.5893.58975.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Gregory Haskins wrote: > This is a cleanup patch to "de-VMX" the general code. It was developed in the > preempt-hooks branch, but it should apply elsewhere as well. > > Many cooks on this patch... > @@ -310,16 +301,13 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus, > struct kvm_io_device *dev); > > struct kvm_vcpu { > + int valid; > This is okay as a temporary measure, until the vcpu array is replaced by a vcpu pointer array (when vcpu->valid can be replaced by vcpu != NULL). > struct kvm *kvm; > struct preempt_hook preempt_hook; > int vcpu_id; > - union { > - struct vmcs *vmcs; > - struct vcpu_svm *svm; > - }; > + void *_priv; > The other cooks did this by embedding the one of the structures within the other, which reduces indirections. > @@ -1664,7 +1664,7 @@ void load_msrs(struct vmx_msr_entry *e, int n) > } > EXPORT_SYMBOL_GPL(load_msrs); > > -void save_msrs(struct vmx_msr_entry *e, int n) > +void save_msrs(struct kvm_msr_entry *e, int n) > { > int i; > This isn't actually used in svm, so we can keep the name vmx_msr_entry and just move the function. It need not be done in this patch. > --- a/drivers/kvm/svm.c > +++ b/drivers/kvm/svm.c > @@ -49,6 +49,8 @@ MODULE_LICENSE("GPL"); > #define SVM_FEATURE_LBRV (1 << 1) > #define SVM_DEATURE_SVML (1 << 2) > > +#define svm(vcpu) ((struct vcpu_svm*)vcpu->_priv) > + > Inline function. > }; > + > +#define vmx(vcpu) ((struct vcpu_vmx*)vcpu->_priv) > + > Inline function. Patch looks good except for the extra indirection. But maybe a later patch can do that. Paul? Rusty? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/