How to set KVM VM use shadow page table?

1.6k Views Asked by At

I want to measure shadow page table performance vs EPT. I know in kvm code path, EPT and shadow page table share some code path. There is a switch to check if EPT is enabled.

So, I turn off EPT, I think this is a way to use shadow page table in KVM VM. I exec some commands on host:

# cat /sys/module/kvm_intel/parameters/ept
 Y   //check if EPT is enabled, Yes it is
# rmmod kvm_intel
# modprobe kvm_intel ept=0,vpid=0  //Re-modprobe kvm_intel, but turn off EPT and VPID
# cat /sys/module/kvm_intel/parameters/ept
 N   // EPT is disabled
# cat /sys/module/kvm_intel/parameters/vpid
 Y   //VPID is still enabled

After these commads, I expect the EPT is disabled, However, I create a VM with 4 vcpu, but in VM, I use htop in VM only find i vcpu. I don't know why.

So, I turn on ept again, I can see 4 vcpu in vm using htop. But, on another server, I turn off ept, in VM, I still can find 4 vcpu.

In host, I test qemu thread num:

pstree -p | grep qemu
       |-qemu-kvm(20594)-+-{qemu-kvm}(20612)
       |                 |-{qemu-kvm}(20613)
       |                 |-{qemu-kvm}(20614)
       |                 |-{qemu-kvm}(20615)
       |                 |-{qemu-kvm}(20618)
       |                 `-{qemu-kvm}(23429)

There are still muti threads.

In KVM VM, I use lscpu to check:

    # lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0
Off-line CPU(s) list:  1-3
Thread(s) per core:    1
Core(s) per socket:    1
座:                 1
NUMA 节点:         1
厂商 ID:           GenuineIntel
CPU 系列:          6
型号:              62
型号名称:        Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHz
步进:              4
CPU MHz:             1999.999
BogoMIPS:            3999.99
超管理器厂商:  KVM
虚拟化类型:     完全
L1d 缓存:          32K
L1i 缓存:          32K
L2 缓存:           4096K
NUMA 节点0 CPU:    0
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase tsc_adjust smep erms xsaveopt
1

There are 1 best solutions below

0
On

VPID is still enabled cause your command format was incorrect

# modprobe kvm_intel ept=0 vpid=0(Use spaces instead of commas)