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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html