From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 07/29] nVMX: Hold a vmcs02 for each vmcs12 Date: Sun, 13 Feb 2011 16:58:33 +0200 Message-ID: <4D57F199.8000506@redhat.com> References: <1296116987-nyh@il.ibm.com> <201101270833.p0R8XQ4w002480@rice.haifa.ibm.com> <4D45372E.2050605@redhat.com> <20110203125732.GA19503@fermat.math.technion.ac.il> <4D4E66E0.3060209@redhat.com> <20110213130433.GA15985@fermat.math.technion.ac.il> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, gleb@redhat.com To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46962 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754180Ab1BMO6m (ORCPT ); Sun, 13 Feb 2011 09:58:42 -0500 In-Reply-To: <20110213130433.GA15985@fermat.math.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: On 02/13/2011 03:04 PM, Nadav Har'El wrote: > Hi, > > On Sun, Feb 06, 2011, Avi Kivity wrote about "Re: [PATCH 07/29] nVMX: Hold a vmcs02 for each vmcs12": > > Thanks, that looks much nicer. > > Apropos of looking nicer, there's something I'd like to ask your opinion about. > > So far, the nested-VMX patches put all the new code in vmx.c. > On one hand, this was the right place (because it's VMX-specific code), > but on the other hand, it adds 2,500 lines to vmx.c, increasing its length > by around 50% and possibly making it harder for future developers to > understand the core non-nested code, and generally makes the KVM look more > complicated. > > There's another possibility: I could put all the new nested-specific functions > in a new source file, nested-vmx.c, put some declarations in new files vmx.h > and nested-vmx.h, and leave only small number of unavoidable modifications in > vmx.c itself. > When I went ahead and did this, unfortunately there were several complications, > e.g., I had to put the "struct nested_vmx" in vmx.h (because it's a field > in struct vmx_vcpu), and I had to un-static some functions from vmx.h and > move other inline functions completely to vmx.h, when I needed them both for > vmx.c and nested-vmx.c. But it didn't take more than a few hours to get over > these hurdles. > > After my first version of this code restructuring (which works, but can > definitely use more cleanups), the good news is that the bulk of the new > nested code is in nested-vmx.c and nested-vmx.h (2,000 lines). The not-as-good > news is that around 200 lines had to move from vmx.c to vmx.h (mostly > structure definitions and inline functions), and about 200 lines in vmx.c > had to be modified anyway (some nested-specific, but many are just about > removing "static"). If you're interested, I can send you a patch so you could > see for yourself. > > My question is, if you have an opinion on which approach is better. > On the one hand, splitting nested-specific code to a second file can leave > the non-nested code easier to follow. > On the other hand, it also means that some of the things people were used > to see in vmx.c (struct vmcs, struct vmx_vcpu, functions like vmcs_read*, > etc.) will move to vmx.h. Also, the patch I send will be larger because it > has to deal with technicalities like removing "static" or moving pieces of > code from one source file to another. > So which option do you consider less ugly? I like having everything in one file. One reason is that it's always been this way, so it's a long standing tradition. Another is that if we put nvmx in its own file, no one will look at it when they update things in core vmx. If it gets too unwieldy we can always break it up later. -- error compiling committee.c: too many arguments to function