Is there any possibility to create a custom CPU model for KVM Linux guests, or at least to modify parameters such as cache size and model name?

I know I can set CPU features, topology and pinning and choose from one of available models. The problem is that there are Intel Xeon X7560 CPUs with 24 MiB of cache each, and I couldn't find anything even quite similar.

I'm not sure whether it can have a huge impact on computation speed with LAPACK, ATLAS, etc. but users will probably expect to see CPUs identical to these on the host machine.

  • Is that even possible ? I mean, with KVM we're basically passing through the physical CPU to the VM, so even if you manage to specify a 24MB cache while your real CPU has only 4MB, that shouldn't have any effect. – André Borie Aug 25 '15 at 13:20
  • @AndréBorie Some programs make decisions about their internal data structures and memory layout based on the detected hardware (see for instance nginx, where the CPU cache line size needs to be represented accurately in a VM so that it can optimize internal hash tables; get this wrong and nginx will fail to start). – Michael Hampton Nov 28 '15 at 3:45

you can use the "host" option to pass the host CPU features to the VM instead of a set of flags and a name.

EDIT: this used to be a command line option, probably removed by now. Have a look at http://libvirt.org/formatdomain.html#elementsCPU for the current possibilities

  • I don't see any place to set the "host" option. I cannot set it as model and I see no such thing in libvirt documentation. What do you exactly mean by "host" option? – konradstrack Aug 11 '11 at 20:07
  • see the EDIT I just added – dyasny Aug 12 '11 at 10:37
  • This host flag does not always work. When I use it on a system with Intel Xeon E5-2650 processors, the cpuinfo tells me it has 4096KB on the guest whereas the host reports 20 MB. – user158877 Feb 13 '13 at 22:15
  • 1
    I'd take this specific issue to the libvirt mailing lists – dyasny Feb 14 '13 at 4:54

For what I know, you cannot set vCPU cache parameters from the command line. Anyway, it should not change anything from a performance standpoint: the CPU is virtualized, so the guest OS has no direct control over its caches.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.