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 15:33:13 +0300 Message-ID: <46A89489.7010504@qumranet.com> References: <46A8594E0200005A0002831D@mcclure.wal.novell.com> 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: <46A8594E0200005A0002831D-Igcdv/6uVdMHoYOw/+koYqIwWpluYiW7@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: > >> >>> 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. >> > > I don't understand what you mean. Can you elaborate more? > > The suggestion I liked best (Anthony's) was struct vmx_vcpu { struct kvm_vcpu vcpu; void *vmcs; // other vmx-specific data }; to move from a kvm_vcpu to a vmx_vcpu, you use container_of() (inside your vmx() inline). Look ma, no pointers! >>> @@ -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 >> > > Note that the structure really is called "kvm_msr_entry" and there was a > lingering typedef to name it "vmx_msr_entry" for places that still used > the vmx variant. I just cleaned that up and got rid of the typedef. > > Ah, okay then. Too many people are touching this area without coordinating (and one patch will invalidate all the rest). I'm not going to try to coordinate; instead I'll apply the first one I like. -- 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/