From: "Nadav Har'El" <nyh@math.technion.ac.il>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com
Subject: Re: [PATCH 07/29] nVMX: Hold a vmcs02 for each vmcs12
Date: Sun, 13 Feb 2011 15:04:33 +0200 [thread overview]
Message-ID: <20110213130433.GA15985@fermat.math.technion.ac.il> (raw)
In-Reply-To: <4D4E66E0.3060209@redhat.com>
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?
P.S. The quote in my signature below is completely random, I promise. It has
nothing to do with my current question about the two code structure options ;-)
--
Nadav Har'El | Sunday, Feb 13 2011, 9 Adar I 5771
nyh@math.technion.ac.il |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |When choosing between two evils, I always
http://nadav.harel.org.il |pick the one I never tried before.
next prev parent reply other threads:[~2011-02-13 13:39 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 8:29 [PATCH 0/29] nVMX: Nested VMX, v8 Nadav Har'El
2011-01-27 8:30 ` [PATCH 01/29] nVMX: Add "nested" module option to vmx.c Nadav Har'El
2011-01-27 8:30 ` [PATCH 02/29] nVMX: Implement VMXON and VMXOFF Nadav Har'El
2011-01-27 8:31 ` [PATCH 03/29] nVMX: Allow setting the VMXE bit in CR4 Nadav Har'El
2011-01-27 8:31 ` [PATCH 04/29] nVMX: Introduce vmcs12: a VMCS structure for L1 Nadav Har'El
2011-01-27 8:32 ` [PATCH 05/29] nVMX: Implement reading and writing of VMX MSRs Nadav Har'El
2011-01-30 9:52 ` Avi Kivity
2011-01-31 8:57 ` Nadav Har'El
2011-01-31 9:01 ` Avi Kivity
2011-01-27 8:32 ` [PATCH 06/29] nVMX: Decoding memory operands of VMX instructions Nadav Har'El
2011-01-27 8:33 ` [PATCH 07/29] nVMX: Hold a vmcs02 for each vmcs12 Nadav Har'El
2011-01-30 10:02 ` Avi Kivity
2011-01-31 9:26 ` Nadav Har'El
2011-01-31 9:41 ` Avi Kivity
2011-02-03 12:57 ` Nadav Har'El
2011-02-06 9:16 ` Avi Kivity
2011-02-13 13:04 ` Nadav Har'El [this message]
2011-02-13 14:58 ` Avi Kivity
2011-02-13 20:07 ` Nadav Har'El
2011-01-27 8:33 ` [PATCH 08/29] nVMX: Fix local_vcpus_link handling Nadav Har'El
2011-01-30 10:08 ` Avi Kivity
2011-01-27 8:34 ` [PATCH 09/29] nVMX: Add VMCS fields to the vmcs12 Nadav Har'El
2011-01-30 10:10 ` Avi Kivity
2011-01-27 8:34 ` [PATCH 10/29] nVMX: Success/failure of VMX instructions Nadav Har'El
2011-01-27 8:35 ` [PATCH 11/29] nVMX: Implement VMCLEAR Nadav Har'El
2011-01-30 12:07 ` Avi Kivity
2011-01-27 8:35 ` [PATCH 12/29] nVMX: Implement VMPTRLD Nadav Har'El
2011-01-27 8:36 ` [PATCH 13/29] nVMX: Implement VMPTRST Nadav Har'El
2011-01-27 8:37 ` [PATCH 14/29] nVMX: Implement VMREAD and VMWRITE Nadav Har'El
2011-01-27 8:37 ` [PATCH 15/29] nVMX: Prepare vmcs02 from vmcs01 and vmcs12 Nadav Har'El
2011-01-27 8:38 ` [PATCH 16/29] nVMX: Move register-syncing to a function Nadav Har'El
2011-01-27 8:38 ` [PATCH 17/29] nVMX: Implement VMLAUNCH and VMRESUME Nadav Har'El
2011-01-27 8:39 ` [PATCH 18/29] nVMX: No need for handle_vmx_insn function any more Nadav Har'El
2011-01-27 8:39 ` [PATCH 19/29] nVMX: Exiting from L2 to L1 Nadav Har'El
2011-01-27 8:40 ` [PATCH 20/29] nVMX: Deciding if L0 or L1 should handle an L2 exit Nadav Har'El
2011-01-27 8:40 ` [PATCH 21/29] nVMX: Correct handling of interrupt injection Nadav Har'El
2011-01-27 8:41 ` [PATCH 22/29] nVMX: Correct handling of exception injection Nadav Har'El
2011-01-27 8:41 ` [PATCH 23/29] nVMX: Correct handling of idt vectoring info Nadav Har'El
2011-01-27 8:42 ` [PATCH 24/29] nVMX: Handling of CR0 and CR4 modifying instructions Nadav Har'El
2011-01-27 8:42 ` [PATCH 25/29] nVMX: Further fixes for lazy FPU loading Nadav Har'El
2011-01-27 8:43 ` [PATCH 26/29] nVMX: Additional TSC-offset handling Nadav Har'El
2011-01-27 8:43 ` [PATCH 27/29] nVMX: Add VMX to list of supported cpuid features Nadav Har'El
2011-01-27 8:44 ` [PATCH 28/29] nVMX: Miscellenous small corrections Nadav Har'El
2011-01-27 8:44 ` [PATCH 29/29] nVMX: Documentation Nadav Har'El
2011-01-28 8:41 ` [PATCH 0/29] nVMX: Nested VMX, v8 Juerg Haefliger
2011-01-28 17:16 ` Nadav Har'El
2011-01-31 10:07 ` Nadav Har'El
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110213130433.GA15985@fermat.math.technion.ac.il \
--to=nyh@math.technion.ac.il \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.