KVM Virtual Machine thread mechanism test
I. Purpose
Test to verify the relationship between processes, threads, and vcpu of the kvm virtual machine. Is 1 + x, where X is the number of vcpu.
Ii. Test process
1. restart the system (note that the PS parameter is-ELF and the related thread information is not listed)
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
1 s root 1181 2 0 60-20-0 rescue? 00:00:00 [KVM-irqfd-clean]
2. Single-core VM Test
// Single-core startup
Root @ starking-OptiPlex-990:/var/VMS # qemu-system-x86_64-M 1024-hda./kvm001.img-VNC: 0
[QEMU-KVM1.2DEBUG] KVM
// Single-core viewing information
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
1 s root 1181 2 0 60-20-0 rescue? 00:00:00 [KVM-irqfd-clean]
2 S root 3422 3059 44 80 0-319664 poll_s 00:00:08 pts/2 qemu-system-x86_64-M 1024-hda./kvm001.img-VNC: 0
1 s root 3425 2 0 80 0-0 kthrea 19: 37? 00:00:00 [KVM-pit/3422]
// Disable a single-core VM
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
1 s root 1181 2 0 60-20-0 rescue? 00:00:00 [KVM-irqfd-clean]
3. dual-core VM test (entering the virtual machine to view cpuinfo information is indeed two cores)
// Start SMP 2
Root @ starking-OptiPlex-990:/var/VMS # qemu-system-x86_64-SMP 2-M 1024-hda./kvm001.img-VNC: 0
[QEMU-KVM1.2DEBUG] KVM
// View information
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
1 s root 1181 2 0 60-20-0 rescue? 00:00:00 [KVM-irqfd-clean]
2 S root 3481 3059 29 80 0-357745 poll_s 00:00:34 pts/2 qemu-system-x86_64-SMP 2-M 1024-hda./kvm001.img-VNC: 0
1 s root 3485 2 0 80 0-0 kthrea 19: 47? 00:00:00 [KVM-pit/3481]
4. Test three core VMS
Root @ starking-OptiPlex-990:/var/VMS # qemu-system-x86_64-SMP 3-M 1024-hda./kvm001.img-VNC: 0
[QEMU-KVM1.2DEBUG] KVM
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
1 s root 1181 2 0 60-20-0 rescue? 00:00:00 [KVM-irqfd-clean]
2 S root 3507 3059 75 80 0-377207 poll_s 00:00:14 pts/2 qemu-system-x86_64-SMP 3-M 1024-hda./kvm001.img-VNC: 0
1 s root 3512 2 0 80 0-0 kthrea 19:52? 00:00:00 [KVM-pit/3507]
Conclusion: It is found that the number of virtual machine processes does not increase with the increase of SMP, and is always a process (not counted as [KVM-pit]).
The following test does not use the command-VNC: 0
In this case, qemu generates two more threads to process VNC operations. The-nographic parameter is used to indicate that no graphic output is required.
1. Single-core VM
Root @ starking-OptiPlex-990:/home/Starking # ps-elf | grep-V grep | grep KVM
Root 1181 2 1181 0 1? 00:00:00 [KVM-irqfd-clean]
Root 5093 5076 5093 0 2 00:00:00 pts/2 qemu-system-x86_64 kvm001.img-smp1-M 1024-nographic
Root 5093 5076 5095 2 00:00:07 pts/2 qemu-system-x86_64 kvm001.img-smp1-M 1024-nographic
Iii. Test Results
Summary: In a KVM virtual machine, each virtual machine has a virtual machine process, and the number of threads corresponding to the number of vcpu, the total number of threads generated is 1 + x, of which X is the number of vcpu.
Generally, the-VNC command is used for remote operations. In this case, two additional threads are generated to handle VNC operations and VNC operations are removed, you need to add the-nographic parameter at startup (the producer will crash at this time), indicating that the SSH link will be used without graphical display.
Iv. reference websites
1. http://smilejay.com/2012/08/kvm-vcpu-binding/
2. http://smilejay.com/2012/08/kvm-sdl-display/
3,