Skip to contentSkip to conversation

how to get the features of a cpu model

Qemu-devel Feng, Shaohe 1 participant 1 message Dec 6, 2016

lore
Share & tools
lore
#0 lore raw

Hi all,

I write a script to get the features of a cpu model

https://github.com/shaohef/cpu_model_features/blob/master/intersection_features.py

I use “qemu -cpu model,+features,check“ to try whether a cpu model can support a feature.

I find different cpu models can support same features on same host. such as a result on one of my host with ivybridge CPU.

model: n270

    support 55 featurs: ['kvmclock', 'pge', 'avx', 'clflush', 'sep', 'syscall', 'tsc-deadline', 'kvm_pv_eoi', 'fsgsbase', 'xsave', 'msr', 'vmx', 'kvm_pv_unhalt', 'erms', 'cmov', 'f16c', 'smep', 'ssse3', 'tsc', 'fxsr', 'pae', 'mce', 'vme', 'mmx', 'cx8', 'rdtscp', 'mca', 'pse', 'popcnt', 'apic', 'sse', 'pat', 'kvm_steal_time', 'kvm_asyncpf', 'lahf_lm', 'aes', 'sse2', 'ss', 'hypervisor', 'pcid', 'de', 'fpu', 'cx16', 'pse36', 'mtrr', 'rdrand', 'kvm_nopiodelay', 'x2apic', 'sse4.2|sse4_2', 'sse4.1|sse4_1', 'pclmulqdq|pclmuldq', 'pni|sse3', 'lm|i64', 'fxsr_opt|ffxsr', 'nx|xd']

================================================================================
model: Conroe

    support 55 featurs: ['kvmclock', 'pge', 'avx', 'clflush', 'sep', 'syscall', 'tsc-deadline', 'kvm_pv_eoi', 'fsgsbase', 'xsave', 'msr', 'vmx', 'kvm_pv_unhalt', 'erms', 'cmov', 'f16c', 'smep', 'ssse3', 'tsc', 'fxsr', 'pae', 'mce', 'vme', 'mmx', 'cx8', 'rdtscp', 'mca', 'pse', 'popcnt', 'apic', 'sse', 'pat', 'kvm_steal_time', 'kvm_asyncpf', 'lahf_lm', 'aes', 'sse2', 'ss', 'hypervisor', 'pcid', 'de', 'fpu', 'cx16', 'pse36', 'mtrr', 'rdrand', 'kvm_nopiodelay', 'x2apic', 'sse4.2|sse4_2', 'sse4.1|sse4_1', 'pclmulqdq|pclmuldq', 'pni|sse3', 'lm|i64', 'fxsr_opt|ffxsr', 'nx|xd']

================================================================================
model: SandyBridge

    support 55 featurs: ['kvmclock', 'pge', 'avx', 'clflush', 'sep', 'syscall', 'tsc-deadline', 'kvm_pv_eoi', 'fsgsbase', 'xsave', 'msr', 'vmx', 'kvm_pv_unhalt', 'erms', 'cmov', 'f16c', 'smep', 'ssse3', 'tsc', 'fxsr', 'pae', 'mce', 'vme', 'mmx', 'cx8', 'rdtscp', 'mca', 'pse', 'popcnt', 'apic', 'sse', 'pat', 'kvm_steal_time', 'kvm_asyncpf', 'lahf_lm', 'aes', 'sse2', 'ss', 'hypervisor', 'pcid', 'de', 'fpu', 'cx16', 'pse36', 'mtrr', 'rdrand', 'kvm_nopiodelay', 'x2apic', 'sse4.2|sse4_2', 'sse4.1|sse4_1', 'pclmulqdq|pclmuldq', 'pni|sse3', 'lm|i64', 'fxsr_opt|ffxsr', 'nx|xd’]

you can see there is no difference for the supported features between n270, SandyBridge.

Also I have get a result on another host with haswell CPU.

================================================================================
model: SandyBridge

    support 65 featurs: ['kvmclock', 'pge', 'avx', 'clflush', 'sep', 'rtm', 'tsc-deadline', 'abm', 'fsgsbase', 'xsave', 'msr', 'vmx', 'kvm_pv_unhalt', 'erms', 'hle', 'cmov', 'f16c', 'smep', 'ssse3', 'tsc', 'fxsr', 'syscall', 'pae', 'mce', 'fma', 'vme', 'mmx', 'cx8', 'rdtscp', 'mca', 'pse', 'popcnt', 'invpcid', 'pdpe1gb', 'apic', 'sse', 'pat', 'kvm_steal_time', 'kvm_pv_eoi', 'kvm_asyncpf', 'lahf_lm', 'aes', 'avx2', 'sse2', 'ss', 'hypervisor', 'bmi1', 'bmi2', 'pcid', 'de', 'fpu', 'cx16', 'pse36', 'mtrr', 'movbe', 'rdrand', 'kvm_nopiodelay', 'x2apic', 'sse4.2|sse4_2', 'sse4.1|sse4_1', 'pclmulqdq|pclmuldq', 'pni|sse3', 'lm|i64', 'fxsr_opt|ffxsr', 'nx|xd’]

You can see the same CPU model SandyBridge can support more features on the host with haswell CPU than the host with ivybridge CPU.

My questions are:
1. can I live-migration the vm with same CPU model(for example SandyBridge) between haswell host and ivybridge host
2. does qemu support a API to get it’s emulated CPUID?