自己通过看代码总结的内核中包含kvm的文件夹:

(1)Linux-3.17.4\Documentation\virtual\kvm\

(2)Linux-3.17.4\include\

(3)Linux-3.17.4\drivers\s390\kvm\

(4)Linux-3.17.4\virt\kvm\

(5)Linux-3.17.4\arch\*\kvm\   (*号代表以下处理器体系架构:x86、tile、s390、powerpc、mips、ia64、arm64、arm)  先研究x86体系架构。

(6)linux-3.17.4\arch\x86\include\asm

注:因为每个文件都含有makefile,所以就不列举makefile文件了。

(1)  Linux-3.17.4\Documentation\virtual\kvm\下面为文档介绍,主要介绍了KVM中的使用的一些技术,对其中一部分数据结构和方法进行说明。

(2)  Linux-3.17.4\include\kvm\中有2个文件:代码总共行数:4957

Arm_arch_timer.h:KVM定时器相关的函数      代码行数:103

Arm_vgic.h:虚拟通用中断控制器相关的数据结构和函数     代码行数:314

1)linux-3.17.4\include\trace\events\kvm.h: 代码行数:322

一些跟踪事件函数的声明

其中一段代码:

#define kvm_trace_exit_reason                                        \

ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL),  \

ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN),       \

ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR),       \

ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\

ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI), ERSN(PAPR_HCALL),      \

ERSN(S390_UCONTROL), ERSN(WATCHDOG), ERSN(S390_TSCH)

2)linux-3.17.4\include\linux\kvm_host.h:      代码行数:1101

非常重要的头文件

/*

* The bit 16 ~ bit 31 of kvm_memory_region::flags are internally used

* in kvm, other bits are visible for userspace which are defined in

* include/linux/kvm_h.

*/

3)linux-3.17.4\include\linux\kvm_para.h:      代码行数:27

一个函数:static inline int kvm_para_has_feature(unsigned int feature)

4)linux-3.17.4\include\linux\kvm_types.h:    代码行数:79

/*

* Address types:

*  gva - guest virtual address

*  gpa - guest physical address

*  gfn - guest frame number

*  hva - host virtual address

*  hpa - host physical address

*  hfn - host frame number

*/

5)linux-3.17.4\include\uapi\linux\kvm.h: 代码行数:1186

Userspace interface for /dev/kvm - kernel based virtual machine

/*The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace,

* other bits are reserved for kvm internal use which are defined in

* include/linux/kvm_host.h.*/

6)linux-3.17.4\include\uapi\linux\kvm_para.h:      代码行数:33

/*

* This header file provides a method for making a hypercall to the host

* Architectures should define:

* - kvm_hypercall0, kvm_hypercall1...

* - kvm_arch_para_features

* - kvm_para_available

*/

/* Return values for hypercalls */

/*

* hypercalls use architecture specific

*/

7)linux-3.17.4\include\uapi\asm-generic\kvm_para.h: 代码行数:0

/*

* There isn't anything here, but the file must not be empty or(否则) patch

* will delete it.

*/

8)linux-3.17.4\include\asm-generic\kvm_para.h: 代码行数:27

This function is used by architectures that support kvm to avoid issuing false soft lockup messages.

Uapi可能是user api的意思

(3)Linux-3.17.4\drivers\s390\kvm\文件夹下有2个文件:代码总共行数:1765

Kvm_virtio.c: 功能是 virtio for kvm on s390    代码行数:513

Virtio_ccw.c:  功能是ccw based virtio transport      代码行数:1252

virtio 是对半虚拟化 hypervisor 中的一组通用模拟设备的抽象。

重点看第(4)和(5)部分

(4)Linux-3.17.4\virt\kvm\  与体系结构无关的代码   代码总共行数:10629

包含一个名为arm的文件夹和15个文件。

assigned-dev.c 代码行数:1027

功能:Kernel-based Virtual Machine - device assignment support

async_pf.c和async_pf.h:   代码行数:228

kvm asynchronous fault support  KVM支持异步故障

coalesced_mmio.c和coalesced_mmio.h:     代码行数:183+39

KVM  coalesced(合并) MMIO

MMIO(Memory mapping I/O)即内存映射I/O,它是PCI规范的一部分,I/O设备被放置在内存空间而不是I/O空间。

eventfd.c: 代码行数:931

kvm eventfd support - use eventfd objects to signal various KVM events

ioapic.c和ioapic.h:       代码行数:646+103

apic: Advanced Programmable Interrupt Controller高级可编程中断控制器.

Iodev.h: 对io设备的操作头文件 代码行数:71

Iommu.c : 代码行数:361

input/output memory management unit。Device的IOMMU类似于CPU的MMU。

MMU是Memory Management Unit的缩写,中文名是内存管理单元,它是中央处理器(CPU)中用来管理虚拟存储器、物理存储器的控制线路,同时也负责虚拟地址映射为物理地址,以及提供硬件机制的内存访问授权,多用户多进程操作系统。

Irq_comm.c:   代码行数:370

Common API for in kernel interrupt controllers .

irqchip.c:   代码行数:215

Common API for in kernel interrupt controllers

This file is derived from virt/kvm/irq_comm.c.

IRQ全称为Interrupt Request,即是“中断请求”的意思,IRQ的作用就是在我们所用的电脑中,执行硬件中断请求的动作。

Kconfig: KVM common configuration items and defaults

Kvm_main.c:     代码行数:3279

Kernel-based Virtual Machine driver for Linux.This module enables machines with Intel VT-x extensions to run virtual machines without emulation or binary translation.

Vfio.c: 代码行数:278

VFIO-KVM bridge pseudo device

VFIO是一套用户态驱动框架,它提供两种基本服务:(1)向用户态提供访问硬件设备的接口(2) 向用户态提供配置IOMMU的接口

arm文件夹中包含4个文件。

arch_timer.c:KVM定时器  代码行数:318

Vgic:virtual generic interrupt controller,其它3个文件功能就是主要描述它的。V2和v3是第二第三个版本。 代码行数:2070+264+246

(5) Linux-3.17.4\arch\x86\kvm\   与体系结构相关的代码 代码总共行数:39246

包含25个文件

Cupid.c和cpuid.h: 代码行数:795+107

CPU ID 指用户计算机当今的信息处理器的信息。

Kernel-based Virtual Machine driver for Linux

cpuid support routines

derived from arch/x86/kvm/x86.c

emulate.c: 代码行数:5068

Generic x86 (32-bit and 64-bit) instruction decoder and emulator.

Linux coding style, mod r/m decoder, segment base fixes, real-mode privileged instructions

I8254.c和i8254.h: 代码行数:778+66

8253/8254 interval timer emulation,就是定时器仿真。Based on QEMU and Xen.

I8259.c:     代码行数:665

8259 interrupt controller emulation,中断控制器仿真。Port from Qemu.

irq.c:    代码行数:130

API for in kernel interrupt controller

irq.h:    代码行数:107

in kernel interrupt controller related definitions

Kconfig: KVM configuration;  source "virt/kvm/Kconfig"

Kvm_cache_regs.h: 代码行数:103

Lapic.c和Lapic.h:   代码行数:1937+174

Local APIC virtualization。apic: Advanced Programmable Interrupt Controller高级可编程中断控制器

Mmu.c和mmu.h: 代码行数:4608 + 182

Kernel-based Virtual Machine driver for Linux

* This module enables machines with Intel VT-x extensions to run virtual machines without emulation or binary translation.

* MMU support

Mmu_audit.c: Audit code for KVM MMU   代码行数:300

Mmutrace.h:     代码行数:334

paging_tmpl.h: 代码行数:993

Kernel-based Virtual Machine driver for Linux;MMU support;

pmu.c: 代码行数:573

Kernel-based Virtual Machine -- Performance Monitoring Unit support, 性能监视单元支持

svm.c:       代码行数:4424

Kernel-based Virtual Machine driver for Linux; AMD SVM support;svm:安全虚拟机

Trace.h:     代码行数:862

Tss.h:        代码行数:60

Vmx.c: 代码行数:9132

Kernel-based Virtual Machine driver for Linux;

X86.c和x86.h: 代码行数:7676 + 172

* Kernel-based Virtual Machine driver for Linux

* derived from drivers/kvm/kvm_main.c

(6)linux-3.17.4\arch\x86\include\asm下面有4个头文件代码总共行数:1663

kvm_emulate.h:      代码行数:428

Generic x86 (32-bit and 64-bit) instruction decoder and emulator. Copyright (c) 2005 Keir Fraser. From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4

kvm_guest.h:          代码行数:7

#ifndef _ASM_X86_KVM_GUEST_H//如果没有定义~

#define _ASM_X86_KVM_GUEST_H//则定义~,且编译以下代码

int kvm_setup_vsyscall_timeinfo(void);

#endif /* _ASM_X86_KVM_GUEST_H */

kvm_host.h:           代码行数:1096

This header defines architecture specific interfaces, x86 version

kvm_para.h:           代码行数:132

共有代码:58260行(只包含x86架构)。

KVM源代码框架的更多相关文章

  1. KVM源代码阅读--内核版本3.17.4

    为了更加深入的学习虚拟化,因此我必须把KVM源代码搞清楚,这是一个必须要挖的坑.我会把自己的一些阅读的代码贴上来,可能会有理解不对的地方,希望和大家一起交流,请多提意见,以便于纠正错误.所用的内核版本 ...

  2. jQuery源代码 框架分析

    每个框架都有一个核心.全部的结构都是基于这个核心之上,结构建立好了之后,剩下的就是功能的堆砌. jQuery的核心就是从HTML文档中匹配元素并对其操作. 就跟一座大楼一样.让我们一步一步了解这座大厦 ...

  3. jQuery源代码框架思路

    開始计划时间读源代码,第一节jQuery框架阅读思路整理 (function(){ jQuery = function(){}; jQuery一些变量和函数和给jQuery对象加入一些方法和属性 ex ...

  4. KVM源代码解读:linux-3.17.4\arch\x86\include\asm\kvm_host.h

    /* * Kernel-based Virtual Machine driver for Linux * * This header defines architecture specific int ...

  5. KVM源代码解读:linux-3.17.4\include\uapi\linux\kvm.h

    #ifndef __LINUX_KVM_H #define __LINUX_KVM_H /* * Userspace interface for /dev/kvm - kernel based vir ...

  6. KVM源代码解读:linux-3.17.4\include\linux\kvm_host.h

    #ifndef __KVM_HOST_H #define __KVM_HOST_H /* * This work is licensed under the terms of the GNU GPL, ...

  7. kvm源代码分析

    vmx是x86硬件虚拟化层,从代码看,qemu用户态是一层,kernel中KVM通用代码是一层,类似kvm_x86_ops是一层,针对各个不同的硬件架构,而vcpu_vmx则是具体架构的虚拟化方案一层 ...

  8. android AChartEnginee解说之源代码框架解读

    从上周把android ACHartEnginee的源代码check out出来后就一直在看这个东西是怎样使用的,以及底层是怎样实现的,把近期一周对这个东西的了解先发上来,即是给自己做一个总结,也希望 ...

  9. Live555 实战之框架简单介绍

    作者:咕唧咕唧liukun321 来自:http://blog.csdn.net/liukun321 上一篇文章简要介绍了怎样以共享库的方式交叉编译Live555,今天再来介绍live源代码框架. 先 ...

随机推荐

  1. 网络技术之TCP三次握手

    在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手方式建立一个连接 第一次握手:c->s 建立连接时,客户端发送SYN包(syn=j){注:syn:Synchronize Sequ ...

  2. CF&&CC百套计划4 Codeforces Round #276 (Div. 1) E. Sign on Fence

    http://codeforces.com/contest/484/problem/E 题意: 给出n个数,查询最大的在区间[l,r]内,长为w的子区间的最小值 第i棵线段树表示>=i的数 维护 ...

  3. amipy exampes

    jupyter notebook of backtest examples using amipy amipy examples: http://nbviewer.jupyter.org/github ...

  4. py-faster-rcnn代码阅读1-train_net.py & train.py

    # train_net.py#!/usr/bin/env python # -------------------------------------------------------- # Fas ...

  5. 采用jacob实现word转pdf

    网络上已经有很多这方面的内容,在用之前也是参考了好多别人的文章,下面记录下我自己的整合过程.整个过程都比较简单: 开发环境:win8 64位系统,在2008下面部署也是一样的. 文档要求jdk的版本要 ...

  6. python enumerate用法总结【转】

    enumerate()说明 enumerate()是python的内置函数 enumerate在字典上是枚举.列举的意思 对于一个可迭代的(iterable)/可遍历的对象(如列表.字符串),enum ...

  7. poj2054

    题意:给定一棵树,每个节点有一个权值,现要求给这些节点进行排列,设排列后的节点顺序为v1~vn,它们的权值是w1~wn,那么我们要求一种排列使得w1*1+w2*2+...+wn*n最小.还有一个限制就 ...

  8. mysql ON DUPLICATE KEY UPDATE重复插入时更新

    mysql当插入重复时更新的方法: 第一种方法: 示例一:插入多条记录 假设有一个主键为 client_id 的 clients 表,可以使用下面的语句: INSERT INTO clients (c ...

  9. 为什么尽量别用 setInterval

    为什么尽量别用setInterval   在开发一个在线聊天工具时,经常会有过多少毫秒就重复执行一次某操作的需求.“没问题”,大家都说,“用setInterval好了.”我觉得这个点子很糟糕. 原因之 ...

  10. SecureCRT中常用linux命令 -《转载》

    常用命令: 一.ls 只列出文件名 (相当于dir,dir也可以使用) -A:列出所有文件,包含隐藏文 件. -l:列表形式,包含文件的绝大部分属性. -R:递归显示. --help:此命令的帮助. ...