KVM 核心功能:CPU 虚拟化
1 vCPU 简介
[root@lianhua qemu-kvm]# /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
QEMU 2.6.0 monitor - type 'help' for more information
(qemu) VNC server running on '::1;5900' (qemu) info cpus
* CPU #0: pc=0x000000003fefa56a thread_id=1019305
CPU #1: pc=0x00000000000fd374 (halted) thread_id=1019307
(qemu) info cpus
* CPU #0: pc=0x000000003ff0d4ea (halted) thread_id=1019305
CPU #1: pc=0x00000000000fd374 (halted) thread_id=1019307 [root@lianhua home]# ps -eLf | grep qemu
root 1019294 1014044 1019294 0 5 12:53 pts/0 00:00:00 /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
root 1019294 1014044 1019300 0 5 12:53 pts/0 00:00:00 /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
root 1019294 1014044 1019305 6 5 12:53 pts/0 00:00:12 /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
root 1019294 1014044 1019307 0 5 12:53 pts/0 00:00:00 /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
root 1019294 1014044 1019309 0 5 12:53 pts/0 00:00:00 /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
2 vCPU 配置
[root@lianhua qemu-kvm]# /usr/libexec/qemu-kvm -smp 2 -m 1G lianhua.qcow -monitor stdio
[root@lianhua qemu-kvm]# /usr/libexec/qemu-kvm -smp 3,sockets=3,cores=1,threads=1 -m 1G lianhua.qcow -monitor stdio
<vcpu placement='static'>6</vcpu>
<cputune>
<shares>6144</shares>
<vcpupin vcpu='0' cpuset='9'/>
<vcpupin vcpu='1' cpuset='37'/>
<vcpupin vcpu='2' cpuset='11'/>
<vcpupin vcpu='3' cpuset='39'/>
<vcpupin vcpu='4' cpuset='34'/>
<vcpupin vcpu='5' cpuset='6'/>
<emulatorpin cpuset='6,9,11,34,37,39'/>
</cputune>
<cpu mode='host-model'>
<model fallback='allow'/>
<topology sockets='3' cores='1' threads='2'/>
<numa>
<cell id='0' cpus='0-5' memory='33554432' unit='KiB' memAccess='shared'/>
</numa>
</cpu>
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 61
model name : Intel Core Processor (Broadwell)
stepping : 2
microcode : 0x1
cpu MHz : 2394.454
cache size : 4096 KB
physical id : 0
siblings : 2
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 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds
bogomips : 4788.90
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
... $ /bin/bash cpu.sh
The physical cpu is: 3
core number in a physical cpu: 1
logical cpu number in a physical cpu: 2
The hyper threading is enabled, each core has 2 threads
logical cpu number in host: 6
3 vCPU 特性
3.1 vCPU overcommit
3.2 vCPU 热插拔
[root@lianhua qemu-kvm]# /usr/libexec/qemu-kvm -smp 3,maxcpus=5,sockets=3,cores=1,threads=1 -m 1G lianhua.qcow -monitor stdio
QEMU 2.6.0 monitor - type 'help' for more information
(qemu) VNC server running on '::1;5900' (qemu) info cpus
* CPU #0: pc=0x000000003fefa56a thread_id=356200
CPU #1: pc=0x00000000000fd374 (halted) thread_id=356201
CPU #2: pc=0x00000000000fd374 (halted) thread_id=356203
(qemu) cpu-add 3
(qemu) info cpus
* CPU #0: pc=0x00000000000fc373 (halted) thread_id=356200
CPU #1: pc=0x00000000000fd374 (halted) thread_id=356201
CPU #2: pc=0x00000000000fd374 (halted) thread_id=356203
CPU #3: pc=0x00000000fffffff0 thread_id=357997
3.3 vCPU 亲和性
<vcpu placement='static'>6</vcpu>
<cputune>
<shares>6144</shares>
<vcpupin vcpu='0' cpuset='9'/>
<vcpupin vcpu='1' cpuset='37'/>
<vcpupin vcpu='2' cpuset='11'/>
<vcpupin vcpu='3' cpuset='39'/>
<vcpupin vcpu='4' cpuset='34'/>
<vcpupin vcpu='5' cpuset='6'/>
<emulatorpin cpuset='6,9,11,34,37,39'/>
</cputune>
[root@lianhua home]# ps -eLo ruser,pid,ppid,lwp,psr,args | grep qemu | grep -v grep
... [root@lianhua home]# ps -eLo ruser,pid,ppid,lwp,psr,args | awk '{if($5==37) print $0}'
root 193 2 193 37 [watchdog/37]
root 194 2 194 37 [migration/37]
root 195 2 195 37 [ksoftirqd/37]
root 196 2 196 37 [kworker/37:0]
root 197 2 197 37 [kworker/37:0H]
root 145760 2 145760 37 [kworker/37:1]
qemu 879955 1 880096 37 /usr/libexec/qemu-kvm -name guest=lianhua ...
[root@lianhua home]# ps -eLo ruser,pid,ppid,lwp,psr,args | awk '{if($5==40) print $0}'
root 208 2 208 40 [watchdog/40]
root 209 2 209 40 [migration/40]
root 210 2 210 40 [ksoftirqd/40]
root 212 2 212 40 [kworker/40:0H]
root 390900 2 390900 40 [kworker/40:0]
root 673792 2 673792 40 [kworker/40:1]
root 674097 2 674097 40 [kworker/40:1H]
[root@lianhua home]# ps -eLo ruser,pid,ppid,lwp,psr,args | awk '{if($5==41) print $0}'
root 213 2 213 41 [watchdog/41]
root 214 2 214 41 [migration/41]
root 215 2 215 41 [ksoftirqd/41]
root 216 2 216 41 [kworker/41:0]
root 217 2 217 41 [kworker/41:0H]
KVM 核心功能:CPU 虚拟化的更多相关文章
- 虚拟化技术实现 — KVM 的 CPU 虚拟化
目录 文章目录 目录 前文列表 x86 体系结构的虚拟化 硬件辅助的 CPU 虚拟化 由 VMX 切换支撑的 CPU 虚拟化技术 KVM 的 CPU 虚拟化实现 vCPU 的调度方式 客户机 CPU ...
- [原] KVM 虚拟化原理探究(3)— CPU 虚拟化
KVM 虚拟化原理探究(3)- CPU 虚拟化 标签(空格分隔): KVM [TOC] CPU 虚拟化简介 上一篇文章笼统的介绍了一个虚拟机的诞生过程,从demo中也可以看到,运行一个虚拟机再也不需要 ...
- KVM之CPU虚拟化
1.1 为什么要虚拟化CPU 虚拟化技术是指在x86的系统中,一个或以上的客操作系统(Guest Operating System,简称:Guest OS)在一个主操作系统(Host Operatin ...
- kvm/qemu/libvirt学习笔记 (1) qemu/kvm/libvirt介绍及虚拟化环境的安装
kvm简介 kvm最初由Quramnet公司开发,2008年被RedHat公司收购.kvm全称基于内核的虚拟机(Kernel-based Virtual Machine),它是Linux的一个内核模块 ...
- CPU 虚拟化
前面 虚拟化技术总览 中从虚拟平台 VMM 的角度,将虚拟化分为 Hypervisor 模型和宿主模型,如果根据虚拟的对象(资源类型)来划分,虚拟化又可以分为计算虚拟化.存储虚拟化和网络虚拟化,再细一 ...
- Linux学习-核心编译的前处理与核心功能选择
硬件环境检视与核心功能要求 根据自己的需求来确定编译的选项 保持干净原始码: make mrproper 我们还得要处理一下核心原始码底下的残留文件才行!假设我们是第一次 编译, 但是我们不清楚到底下 ...
- [ kvm ] 学习笔记 3:KVM 基础功能详解
1. 构建 KVM 环境 KVM 从诞生开始就需要硬件虚拟化的支持,KVM 必需的硬件虚拟化扩展分别是:Intel 的虚拟化技术(Intel VT)和 AMD 的 AMD-V 技术.首先处理器(CPU ...
- kvm简介及创建虚拟化安装(1)
kvm虚拟化介绍 一.虚拟化分类 1.虚拟化,是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机.在一台计算机上同时运行多个逻辑计算机,每个逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立 ...
- 【原创】Linux虚拟化KVM-Qemu分析(四)之CPU虚拟化(2)
背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: KVM版本:5.9 ...
- [ kvm ] 学习笔记 4:KVM 高级功能详解
1. 半虚拟化驱动 1.1 virtio 概述 KVM 是必须使用硬件虚拟化辅助技术(如 Intel VT-x .AMD-V)的 Hypervisor,在CPU 运行效率方面有硬件支持,其效率是比较高 ...
随机推荐
- echarts设置多条折线不是你想的那样简单
简单的多条折线图 小伙伴写过多条折线图的都知道, 常见的折线图是 xAxis 配置项下的 data属性上设置时间或者日期. series配置项下是对应的 legend中的数据以及该条折线的数据. &l ...
- Kubernetes: client-go 源码剖析(一)
0. 前言 在看 kube-scheduler 组件的过程中遇到了 kube-scheduler 对于 client-go 的调用,泛泛的理解调用过程总有种隔靴搔痒的感觉,于是调转头先把 client ...
- Mybatis大于、小于....转义写法
描述 转义前 转义后 大于 > > 大于等于 >= >= 小于 < < 小于等于 <= <= 和 & & 单引号 ' &apos ...
- MyBatis的执行流程分析
核心流程介绍 我们都知道 MyBatis 是对 JDBC 的封装,不管怎样,JDBC 的那一套还是不会变的,只是做了抽象.封装.归类等:所以我们顺着 JDBC 的思路来说下MyBatis的执行流程,J ...
- 安卓app填写域名和端口后点击保存没有反应(填错注册信息)
解决方法:域名填写错误导致(仔细检查填写的域名和端口是否正常,注册的信息是否与填写的一致) 域名是:3q9l302537.wicp.vip 中间有个字母 l 不是数字 1 填写成了:3q91302 ...
- 从零玩转ShardingSphere分库分表 (概括)-shardingsphere1
title: 从零玩转ShardingSphere分库分表 (概括) date: 2022-05-25 17:58:25.61 updated: 2022-08-22 22:59:02.624 url ...
- 前端布局flex从入门到入土
前端布局flex从入门到入土 作为一个后端,谈不上多会前端,但是一些常见的布局都可以做到,例如flex布局.推荐菜鸟教程的布局:https://www.runoob.com/w3cnote/flex- ...
- CutMix&Mixup详解与代码实战
摘要:本文将通过实践案例带大家掌握CutMix&Mixup. 本文分享自华为云社区<CutMix&Mixup详解与代码实战>,作者:李长安. 引言 最近在回顾之前学到的知识 ...
- 华为云张昆:支持全场景全业务,GaussDB加速企业数字化转型
云.AI.5G等技术驱动,数据库行业迎来新的需求,云数据库也在不断演进升级.依托华为云与华为云Stack,通过全栈软硬件优化,华为云GaussDB进行了进阶与革新,以统一的架构,支持关系型与非关系型的 ...
- 大数据集群跨多版本升级、业务0中断,只因背后有TA
摘要:2021年4月21日,中国太平洋保险集团联合华为云完成了全球首例大数据集群跨多版本的大数据集群滚动升级. 本文分享自华为云社区<华为云FusionInsight助力太保跨多版本升级业务0中 ...