3.3 CPU相关的参数
1.1. 1. -cpu 参数
指定虚拟机的 cpu 类型,龙芯平台可使用 “-cpu ‘Loongson-3A5000’” 创建虚拟机。“-cpu help” 可以查询当前 qemu 支持哪些 cpu 类型。
1.2. 2. -smp 参数
-smp [cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets]
指定虚拟机逻辑 cpu 的数量为n。还可以具体指定 Socket 的数量、每个 Socket 上核心(core)的数量、每个核心上的线程(thread)数量。其中,n=sockets × cores × threads。例如:
-smp 2,maxcpus=4,cores=1,threads=1,sockets=2
虚拟机中查看 cpu 信息
# cat /proc/cpuinfo
system type : generic-loongson-machine
processor : 0
package : 0
core : 0
cpu family : Loongson-64bit
model name : Loongson-3A5000
CPU Revision : 0x10
FPU Revision : 0x00
CPU MHz : 2000.00
BogoMIPS : 4000.00
TLB entries : 2112
Address sizes : 48 bits physical, 48 bits virtual
isa : loongarch32 loongarch64
features : cpucfg lam ual fpu lsx lasx complex crypto lbt_x86 lbt_arm lbt_mips
hardware watchpoint : yes, iwatch count: 8, dwatch count: 8
processor : 1
package : 0
core : 1
cpu family : Loongson-64bit
model name : Loongson-3A5000
CPU Revision : 0x10
FPU Revision : 0x00
CPU MHz : 2000.00
BogoMIPS : 4000.00
TLB entries : 2112
Address sizes : 48 bits physical, 48 bits virtual
isa : loongarch32 loongarch64
features : cpucfg lam ual fpu lsx lasx complex crypto lbt_x86 lbt_arm lbt_mips
hardware watchpoint : yes, iwatch count: 8, dwatch count: 8
#