On Wed, Apr 17, 2013 at 12:42:30PM +0200, Paolo Bonzini wrote: > Il 16/04/2013 19:28, Gleb Natapov ha scritto: > > > This does highlight a weakness in CPU_GET_SUPPORTED_CPUID, but I think > > > this is not a problem in practice. > > > > > > With a management layer such as oVirt it's not a problem. For example, > > > oVirt has its own library of processors. It doesn't care if KVM enables > > > movbe. If you tell it your datacenter is a mix of Haswells and Sandy > > > Bridges it will pick the CPUID bits that are common to all. > > > > > > However, even without a suitable management layer it is also not really > > > a problem. > > > > > > The only processors that support MOVBE are Atom and Haswell. Haswell > > > adds a whole lot of extra CPUID features, hence "-cpu Haswell,enforce" > > > will fail with or without movbe emulation. "-cpu Haswell" will disable > > > all Haswell new features except movbe will remain slow; that's fine, I > > > think, anyway it's not what you'ld do except to play with CPU models. > > > > No that's not fine. KVM should not trick userspace (QEMU is just one of > > them) into nonoptimal configuration. And you forgot about -cpu host in your > > analysis. > > "-cpu host" enables bits that are not in the host, but that's a QEMU > bug. If the host lacks x2apic, for example, "-cpu host" should not > enable it even if it is there in KVM_GET_SUPPORTED_CPUID. > Why? We always said that if performance is the only thing user cares about he should use "-cpu host". Not exposing emulated x2apic to a guest will not provide best configuration possible. If user uses -cpu guest_cpu_model and the guest_cpu_model is the same as host cpu model and host cpu model does not have x2apic then guest should not see x2apic either, but this works correctly today already. > Now, KVM_GET_SUPPORTED_CPUID is a pretty bad interface for implementing > a sane "CPU as similar to the host's as possible" policy. That's > another story and I agree. It's a very sane policy for simple > userspaces like lkvm. > Thats because -cpu host is a misnomer. It really should be -cpu best since its task is too create most efficient configuration given host cpu. So you can wave -cpu host problem by saying that it should filter non host cpuid bits from KVM_GET_SUPPORTED_CPUID, but then you will want to implement -cpu best and you will encounter the same problem, but without any excuse now :) -- Gleb. -- 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