qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] how to get the features of a cpu model


From: Jakob Bohm
Subject: Re: [Qemu-discuss] how to get the features of a cpu model
Date: Wed, 7 Dec 2016 21:45:06 +0100
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 06/12/2016 23:26, Feng, Shaohe wrote:
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.
I believe your script tests the ability to emulate a "frankensteined CPU"
with feature combinations not found in the real CPU hardware that qemu
can emulate.

A better test is to boot a Linux kernel with a simple initrd which mounts
procfs, cats /proc/cpuinfo to stdout, then shuts down the VM.This will
effectively output the decoded value of the emulated CPUID response.

I don't know if qemu actively refuses to execute instructions that have been
disabled in the CPUID via the qemu command line, or if qemu just makes the CPUID
tell programs that they shouldn't use those instructions.  This may make a
difference for programs that trial and error to test for CPU features rather
than asking the CPUID instruction.

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
Good question, depends on the tests/questions I mentioned above.
2. does qemu support a API to get it’s emulated CPUID?

I don't know, never looked seriously at the API side of qemu.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded




reply via email to

[Prev in Thread] Current Thread [Next in Thread]