`
javasee
  • 浏览: 965879 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Xen Memory Management

阅读更多

Below was cited fromhttps://wiki.cs.dartmouth.edu/nihal/doku.php/xen:memory. Changes subject to this site.

  • All low-level memory operations go through Xen.
  • Guest OSes are responsible for allocating and initializing PTs for processes (restricted to read only access)
    • allocates and initialize a page and register it with Xen to serve as the new PT
  • Direct page writes are intercepted, validated and applied by the Xen VMM
    • update can be batched into a single hypercall (reduce cost of entering/exiting Xen)
  • page_info struct associated with each machine page frame
    • page type (none, l1, l2, l3, l4, LDT, GDT, RW)
    • reference count – number of references to the page
    • page frame can be reused only when unpinned and its reference count is zero
  • Each domain has a maximum and current memory allocation
    • max allocation is set at domain creation time and cannot be modified
  • PT updates
    • hypercall –> mmu_update()
    • writable page tables –> vm_assist()
  • Xen exists in the top 64MB (0xFC000000 – 0xFFFFFFFF) section of every guest virtual address space (TLB flush avoided when entering/leaving the hypervisor)
    • not accessible or remappable by guest OSes.
  • “fast handler” for system calls - direct access from app into guestOS, without going through Xen
    • muse execute outside Ring 0
  • Each guest supports a “ballon” memory management driver - that is used by the VMM to dynamically adjust the guest’s memory usage
  • Page fault handling
    • faulting address is written into an extended stack frame on the guestOSstack (normally the faulting address is read from a privileged processor register (CR2))
  • In terms of page protection, Ring1/2 are considered to be part of ‘supervisor mode’. The WP bit in CR0 controls whether read-only restrictions are respected in supervisor mode – if the bit is clear then any mapped page is writable. Xen gets around this by always setting the WP bit and disallowing updates to it. xen/arch/x86/boot/x86_32.S#153
  • Xen provides a domain with a list of machine frames during bootstrapping, and it is the domain’s responsibility to create the pseudo-physical address space from this

No guarantee that a domain will receive a contiguous stretch of physical memory. Most OSes do not have good support for operating in a fragmented physical address space.

  • Machine memory
    • entire amount of memory installed in the machine (physical memory)
    • 4kB machine page frames numbered consecutively starting from 0.
  • Pseudo-physical memory
    • per-domain abstraction.
    • allows a guestOSto consider its memory allocation to consist of a contiguous range of physical page frames starting at physical frame 0.
  • machine-to-physical table
    • globally readable table maintained by Xen
    • records the mapping from machine addresses to pseudo-physical addresses
    • table size is proportional to the amount of RAM installed in the machine
  • physical-to-machine table
    • per-domain table which performs the inverse (physical-to-machine) mapping.
    • table size is proportional to the memory allocation of the given domain.

(XEN) VIRTUAL MEMORY ARRANGEMENT (for DOM0)
(XEN) Loaded kernel: c0100000→c042e254
(XEN) Init. ramdisk: c042f000→c07fca00
(XEN) Phys-Mach map: c07fd000→c086e894 == 454MB(as can be verified by: xm list)
(XEN) Start info: c086f000→c0870000
(XEN) Page tables: c0870000→c0874000 == 16MB
(XEN) Boot stack: c0874000→c0875000
(XEN) TOTAL: c0000000→c0c00000
(XEN) ENTRY ADDRESS: c0100000


x86-32 Xen supports only guests with 2-level page tables. PGD = l2, PTE =l1


How to intercept interrupts from guest domains
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00597.html
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00604.html

Page fault handling for Xen guests
http://lists.xensource.com/archives/html/xen-devel/2006-02/msg00263.html

show pagetable walk if guest cannot handle page
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00612.html

Memory management, mapping, paging questions...
http://lists.xensource.com/archives/html/xen-devel/2006-10/msg01151.html

Information related to shadowing
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00319.html
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00793.html
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00802.html

How to intercept memory operation in Xen
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00659.html
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00664.html
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00717.html

alert message from dom0 to domU
http://lists.xensource.com/archives/html/xen-devel/2006-12/msg00967.html

Share Memory Between DomainU and Domain0
http://lists.xensource.com/archives/html/xen-devel/2006-12/msg01008.html

Call hypercall straightly from user space
http://lists.xensource.com/archives/html/xen-devel/2006-12/msg01061.html


xen/arch/x86/traps.c#do_page_fault –> fixup_page_fault –> mm.c#ptwr_do_page_fault


xen-3.0.2-2/xen/arch/x86/setup.c#__start_xen()
                |                                 \
                v                                  \
xen-3.0.2-2/xen/common/domain.c#domain_create()     \
                |                                    \
                v                                     \
xen-3.0.2-2/xen/arch/x86/domain.c#arch_domain_create() \
                                                        \
                                                         v
                xen-3.0.2-2/xen/arch/x86/domain_build.c#construct_dom0()

Xen-ELF image vmlinux-syms-2.6.16-xen has a special'__xen_guest' section


Xen hypercall table:
/xen-3.0.2-2/xen/arch/x86/x86_32/entry.S


#I think this is called when DOM0 attempts to create a DOMU
xen-3.0.2-2/xen/common/dom0_ops.c#do_dom0_op()




trousers-0.2.7/src/tspi/spi_tpm.c#Tspi_TPM_Quote()
                |
                v
trousers-0.2.7/src/tcsd_api/calltcsapi.c#TCSP_Quote()
                |
                v
trousers-0.2.7/src/tcsd_api/tcstp.c#TCSP_Quote_TP()
                |
                v
trousers-0.2.7/src/tcsd_api/tcstp.c#sendTCSDPacket()

分享到:
评论

相关推荐

    《Efficient Memory Sharing in the Xen Virtual Machine Monitor》

    主要讲解了xen architecture,xen memory management ,xen方面的欢迎多多交流~

    Memory CoW in Xen

    Memory CoW in Xen xen memory cow 介绍

    Xen Management API

    ### Xen Management API 知识点解析 #### 一、引言 Xen Management API(Xen管理API)是一套远程配置与控制运行在Xen主机上的虚拟化客户端(即“guest”)的接口。该文档提供了对Xen Management API 的详细描述,...

    xenapi-1.0.6(Xen Management API)

    ### Xen Management API (xenapi-1.0.6) #### 概述 Xen Management API(简称XenAPI)是一套用于远程配置与控制在Xen主机上运行的虚拟化客户端的操作接口。该API通过一系列远程过程调用(RPCs)来实现,其线上传输...

    swiotlb-xen.rar_memory

    在Xen虚拟化环境中,"swiotlb-xen.rar_memory"这一主题主要涉及的是Xen PV(Para-Virtualized)客户机在非连续内存架构下的内存管理策略。在这个环境中,物理内存并不直接映射到虚拟机(Guest)的地址空间,而是通过...

    xen4.1.3源代码

    7. **Memory Management**:Xen的内存管理是其性能的关键因素。4.1.3版本可能引入了更精细的内存分配策略,以减少内存碎片和提高利用率。`xen/mm`目录下的代码对此进行了详细描述。 8. **Scheduler**:Xen的调度器...

    xen 4.0 最新源码 xen 4.0 最新源码

    1. **内存管理优化**:Xen 4.0对内存管理进行了优化,引入了更高效的内存分配策略,如 balloon driver 和 memory ballooning,以动态调整虚拟机之间的内存分配,确保资源得到充分利用。 2. **网络虚拟化**:Xen支持...

    c语言监控xen虚拟机

    内存信息可以通过`xen_vm_get_memory_target`和`xen_vm_get_memory_static_max`获取,它们分别代表虚拟机的目标内存大小和最大可分配内存。此外,`xen_vm_get_memory_actual`可以获取当前实际使用的内存。 网络信息...

    xen-balloon.rar_memory

    标题中的"xen-balloon.rar_memory"暗示了我们正在讨论的是与Xen虚拟化平台相关的内存调整工具,特别是“balloon”驱动。这个压缩包可能包含了实现这一功能的关键源代码文件“xen-balloon.c”。 Xen balloon驱动程序...

    xen虚拟化实战

    《Xen虚拟化实战》是一本深入探讨Xen虚拟化技术的专业书籍,旨在帮助读者掌握在实际环境中运用Xen的技巧。Xen是一款开源的全虚拟化解决方案,它允许在一个物理服务器上运行多个独立的操作系统实例,提高了硬件资源的...

    xen-4.1.0源代码下载

    8. **管理 Xen**:Xen 提供了多种管理工具,如 `xm`(Xen Management Tool)或 `xl`(Xen Light),用于创建、启动、停止和监控虚拟机。 了解 Xen 源代码可以帮助你深入理解虚拟化技术,包括内存管理、I/O 虚拟化、...

    Xen-4.0.1虚拟机API接口

    `xen.xenapi.VM.set_memory()`和`xen.xenapi.VM.set_vcpus()`分别用于设定虚拟机的内存大小和虚拟CPU数量。 5. **日志和监控**:收集和分析虚拟机及Hypervisor的运行状态和性能数据。`xen.xenapi.VM.get_metrics()`...

    Xen虚拟化内存技术

    这种技术的核心在于Xen Shadow Page Table(SPT),它允许在不修改硬件MMU(Memory Management Unit)的情况下,提供有效的虚拟内存支持。 Xen内存虚拟化的目标是为每个guest OS提供一个独立的、隔离的地址空间,...

    使用yum安装Xen

    在Linux系统中,Xen是一种流行的开源虚拟化技术,它允许在一个物理服务器...- `virt-install --name=test1 --memory=512 --vcpus=1 --disk path=/opt/xen/test1/disk.img,size=10 --network bridge=xenbr0 --location='...

    Xen3.0虚拟机入门

    ### Xen 3.0 虚拟机入门详解 #### Xen简介 Xen是一款由剑桥大学开发并开源的虚拟机软件,首次发布版本为Xen Release 1.0,时间为2003年10月。Xen以其卓越的性能和广泛的适用性而在虚拟化领域占据了一席之地。它...

    XEN V1.0.7 [CyberNation]_rat_V|XEN.com_

    从标题来看,"XEN"可能是指一个特定的软件版本或平台,而"V1.0.7"表示这是其发展的第1.0.7个迭代。"[CyberNation]"可能是一个团队、组织或社区的名称,这通常与黑客、安全研究人员或者网络安全社区有关。"rat"通常在...

    ubuntu10.04安装xen虚拟机

    Ubuntu 10.04 安装 Xen 虚拟机 Xen 是一个开源的虚拟机监视器,可以在多种操作系统上运行。安装 Xen 虚拟机可以让我们在 Ubuntu 10.04 上运行多个虚拟机,从而提高系统的灵活性和可靠性。本文将指导您如何在 ...

    xen 安装配置与运维

    **Xen 安装配置与运维详解** Xen 是一款开源的虚拟化平台,它允许在一个物理服务器上创建和运行多个虚拟机(称为 Domains,或 Dom0 和 DomU),从而实现硬件资源的有效利用和隔离。Xen 主要应用于云计算环境,提供...

    Xen与虚拟化艺术 来自Xen小组

    《Xen与虚拟化艺术——来自Xen小组》是一本深入探讨Xen虚拟化技术的专业著作,它揭示了Xen如何通过独特的半虚拟化技术在IT领域开创了一种全新的虚拟化解决方案。Xen,作为开源虚拟化平台的代表,以其高效、灵活的...

Global site tag (gtag.js) - Google Analytics