On 06/05/2015 18:24, Radim Krčmář wrote: > The feature you wanted exposed a flaw in the code, so an extension was > needed. Copying code is the last resort after all options of > abstracting were exhausted ... I might be forcing common paths when > writing it twice requires less brain power, but 200 lines of > structurally identical code seem far from it. Note that it didn't really expose a flaw in the code, just a limitation. There are cases even on x86 where you have no vcpu, for example filling in the EPT identity page tables or VMX TSS. > Reworking stable code is simpler, as we can just cover all features > needed now and omit the hard thinking about future extensions. > (For me, stable code is the first candidate for generalization ... > and I wouldn't copy it, even though it's mostly fine in practice.) Stable simple code is also important to keep simple though. Sometimes code duplication is preferrable to obfuscation. I agree that copying 200 lines of code because of one function three levels down the call chain isn't nice. However, it doesn't seem particularly easy to avoid the duplication even with C++ templates. C is worse. OCaml or Haskell would be nicer. :) Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html