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 16:37:49 +0300 Message-ID: <46A8A3AD.9010203@qumranet.com> References: <46A866860200005A00028332@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: <46A866860200005A00028332-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: > On Thu, 2007-07-26 at 15:33 +0300, Avi Kivity wrote: > > >> 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! >> > > Hmm..well, you still have pointers. The advantage is that they are > implicitly maintained, but now you have to do pointer arithmetic to > compute it. :( I personally would probably rather have the explicit > management code than the run-time overhead.... > Well, the pointer arithmetic consists of adding or subtracting zero, which gcc luckily knows how to deal with. It's the equivalent of C++ inheritance; no overhead at all. > But alas, the rest of Linux is moving in this direction as well, so I > think this recommendation makes a lot of sense. Note that it > complicates the initialization code a little bit, but its not a big > deal. I will incorporate this into the next spin. > > > >> Too many people are touching this area without coordinating (and one >> patch will invalidate all the rest). >> > > Ah, I wasn't aware of this. Who else is working on it? > > Paul Turner did something much like yours, and Rusty is working on unraveling the vcpu array, which is complementary to this work. -- 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/