2021-05-12 14:32:11
KVM libvirt的CPU熱新增
1、CentOS7.3:
需求:說明:預設有兩個cpu,由於壓力較大的情況下,需要線上新增一個1個cpu
新增cpu前,檢視cpu資訊
[root@localhost ~]# cat /proc/cpuinfo
processor: 0
vendor_id: GenuineIntel
cpu family: 6
model: 58
model name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping: 9
microcode: 0x1
cpu MHz: 2494.342
cache size: 4096 KB
physical id: 0
siblings: 1
core id: 0
cpu cores: 1
apicid: 0
initial apicid: 0
fpu: yes
fpu_exception: yes
cpuid level: 13
wp: yes
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 rdtscp lm constant_tsc arch_perfmon rep_good nopl 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
bogomips: 4988.68
clflush size: 64
cache_alignment: 64
address sizes: 42 bits physical, 48 bits virtual
power management:
線上新增cpu資訊:
virsh setvcpus CentOS-7.3-X86_64 2 --live (將cpu的線上個數調整為3個)
新增後進行比對:
[root@localhost ~]# cat /proc/cpuinfo
processor: 0
vendor_id: GenuineIntel
cpu family: 6
model: 58
model name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping: 9
microcode: 0x1
cpu MHz: 2494.342
cache size: 4096 KB
physical id: 0
siblings: 1
core id: 0
cpu cores: 1
apicid: 0
initial apicid: 0
fpu: yes
fpu_exception: yes
cpuid level: 13
wp: yes
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 rdtscp lm constant_tsc arch_perfmon rep_good nopl 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
bogomips: 4988.68
clflush size: 64
cache_alignment: 64
address sizes: 42 bits physical, 48 bits virtual
power management:
processor: 1
vendor_id: GenuineIntel
cpu family: 6
model: 58
model name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
stepping: 9
microcode: 0x1
cpu MHz: 2494.342
cache size: 4096 KB
physical id: 1
siblings: 1
core id: 0
cpu cores: 1
apicid: 1
initial apicid: 1
fpu: yes
fpu_exception: yes
cpuid level: 13
wp: yes
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 rdtscp lm constant_tsc arch_perfmon rep_good nopl 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
bogomips: 4988.68
clflush size: 64
cache_alignment: 64
address sizes: 42 bits physical, 48 bits virtual
power management:
[root@localhost ~]# cat /proc/interrupts
CPU0 CPU1
0: 679 0 IO-APIC-edge timer
1: 10 0 IO-APIC-edge i8042
6: 3 0 IO-APIC-edge floppy
8: 0 0 IO-APIC-edge rtc0
9: 1 0 IO-APIC-fasteoi acpi
10: 28 0 IO-APIC-fasteoi ehci_hcd:usb1, uhci_hcd:usb2
11: 2930 0 IO-APIC-fasteoi uhci_hcd:usb3, uhci_hcd:usb4, virtio3
12: 15 0 IO-APIC-edge i8042
14: 3348 0 IO-APIC-edge ata_piix
15: 0 0 IO-APIC-edge ata_piix
24: 0 0 PCI-MSI-edge virtio0-config
25: 1707 0 PCI-MSI-edge virtio0-input.0
26: 1 0 PCI-MSI-edge virtio0-output.0
27: 0 0 PCI-MSI-edge virtio2-config
28: 5807 0 PCI-MSI-edge virtio2-req.0
29: 0 0 PCI-MSI-edge virtio1-config
30: 3 0 PCI-MSI-edge virtio1-virtqueues
NMI: 0 0 Non-maskable interrupts
LOC: 74004 208 Local timer interrupts
SPU: 0 0 Spurious interrupts
PMI: 0 0 Performance monitoring interrupts
IWI: 5362 6 IRQ work interrupts
RTR: 0 0 APIC ICR read retries
RES: 20 61 Rescheduling interrupts
CAL: 0 89 Function call interrupts
TLB: 0 3 TLB shootdowns
TRM: 0 0 Thermal event interrupts
THR: 0 0 Threshold APIC interrupts
DFR: 0 0 Deferred Error APIC interrupts
MCE: 0 0 Machine check exceptions
MCP: 12 1 Machine check polls
ERR: 0
MIS: 0
PIN: 0 0 Posted-interrupt notification event
PIW: 0 0 Posted-interrupt wakeup event
2、Win2012:
setvcpus win2012 2 --live
不需要進行啟用操作,系統會自動識別新的CPU
3、注意事項
a、KVM虛擬化不能線上減少CPU,cpu熱新增技術適合不能停機但是cpu效能嚴重不足的場景
b、CPU熱新增的技術對宿主機以及虛擬機器作業系統版本要求較高
c、CPU熱新增,總數不能大於最大CPU個數
<vcpu placement='auto' current=‘1’>4</vcpu>
本文永久更新連結地址:http://www.linuxidc.com/Linux/2017-05/144229.htm
相關文章