Re: KVM Processor cache size

Andre Przywara
2010-08-02T12:56:43Z

Ricardo Martins wrote:
> Hi guys,
>
> I'm having a problem with kvm, my physical machine have 2 processor
> Xeon E5520, with 8 mb cache size, when i run "cat /proc/cpuinfo" the
> linux shows 16 processors equal.
>
> processor : 15
> vendor_id : GenuineIntel
> cpu family : 6
> model : 26
> model name : Intel(R) Xeon(R) CPU E5520 @ 2.27GHz
> stepping : 5
> cpu MHz : 1596.000
> cache size : 8192 KB
> ....
> The problem is that when I run the same command on the virtual
> machine, Linux shows the processors with only 32 kb, I believe that
> anything is wrong.
>
> processor : 0
> vendor_id : GenuineIntel
> cpu family : 6
> model : 6
> model name : QEMU Virtual CPU version 0.9.1
> stepping : 3
> cpu MHz : 2266.575
> cache size : 32 KB
> ....
> On virtual Machine:
> linea:/# x86info
> x86info v1.21. Dave Jones 2001-2007
>
>
> Found 1 CPU, but found 16d CPUs in MPTable.
> --------------------------------------------------------------------------
> Family: 6 Model: 6 Stepping: 3 Type: 0 Brand: 0
> CPU Model: Celeron / Mobile Pentium II Original OEM
> Feature flags:
> fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
> clflsh mmx fxsr sse sse2
> Extended feature flags:
> sse3 [31]
> [0] [2] [3] [4] [5] [6] [7] [8] [9] SYSCALL [13] [15] [16] xd [23] [24] em64t
> Cache info
> L1 Instruction cache: 32KB, 8-way associative. 64 byte line size.
> L1 Data cache: 32KB, 8-way associative. 64 byte line size.
> L2 unified cache: 2MB, sectored, 8-way associative. 64 byte line size.
> TLB info

KVM (or better: the QEMU part) injects a bogus CPU model (compare
family/model/name), which is the same on all host CPUs. This helps with
migration, because the CPU does not change.
The cache size is also the same, as it is part of the "cpuid" command
output.
You can use other CPU models (like kvm64) for better base models, but
the cache size will likely not match your host processor's one.
For that purpose exists the "host" CPU model, which will (to some
degree) simply push your host CPU model to the guest. For now this only
affects the family/model/stepping/name values and the feature flags.
I sent a patch to include the cache size when using -cpu host, but this
has been n'acked because the benefit is not clear.
http://www.mail-archive.com/qemu-devel@nongnu.org/msg32718.html

Do you have a use case for the cache size or is this just out of curiosity?

--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12