WO2014174580A1 - 情報処理装置、方法、及びプログラム - Google Patents

情報処理装置、方法、及びプログラム Download PDF

Info

Publication number
WO2014174580A1
WO2014174580A1 PCT/JP2013/061805 JP2013061805W WO2014174580A1 WO 2014174580 A1 WO2014174580 A1 WO 2014174580A1 JP 2013061805 W JP2013061805 W JP 2013061805W WO 2014174580 A1 WO2014174580 A1 WO 2014174580A1
Authority
WO
WIPO (PCT)
Prior art keywords
dmar
guest
vmm
virtual machine
virtual
Prior art date
Application number
PCT/JP2013/061805
Other languages
English (en)
French (fr)
Inventor
広隆 福島
Original Assignee
富士通株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 富士通株式会社 filed Critical 富士通株式会社
Priority to JP2015513387A priority Critical patent/JP5962853B2/ja
Priority to PCT/JP2013/061805 priority patent/WO2014174580A1/ja
Publication of WO2014174580A1 publication Critical patent/WO2014174580A1/ja
Priority to US14/883,679 priority patent/US10162657B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1458Protection against unauthorised use of memory or access to memory by checking the subject access rights
    • G06F12/1491Protection against unauthorised use of memory or access to memory by checking the subject access rights in a hierarchical protection system, e.g. privilege levels, memory rings
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1081Address translation for peripheral access to main memory, e.g. direct memory access [DMA]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/15Use in a specific computing environment
    • G06F2212/151Emulated environment, e.g. virtual machine

Definitions

  • the disclosed technology relates to an information processing apparatus, an information processing method, and an information processing program.
  • nested virtualization technology has been proposed as a virtualization technology for constructing a virtual computer (virtual machine) on a computer.
  • the nested virtualization technique is a virtualization technique for moving a virtual machine on a virtual machine.
  • BIOS Basic Input Input Output System
  • BIOS starts up a virtual machine.
  • Xen registered trademark
  • the virtual machine monitor that constructs the virtual machine basically performs processing by software, but there is also a virtual machine monitor that uses a virtualization support mechanism that takes part of the processing of the virtual machine monitor by hardware. To do.
  • a technology has been proposed in which a virtualization support mechanism by hardware is virtualized and provided for the second layer virtualization in the above-mentioned nested virtualization technology.
  • a virtualization technique in which a CPU having a virtualization support mechanism operates in a normal mode and a mode that provides a virtualization support mechanism has been proposed.
  • a host VMM Virtual Machine Monitor
  • the CPU operation mode is switched between a host mode in which the host VMM operates and a user mode in which the guest VMM or user program operates.
  • the host VMM emulates the guest VMM and guest OS commands under predetermined conditions.
  • the virtual CPU assigned to the virtual machine on which the guest OS runs provides the guest OS with a virtualization support mechanism.
  • DMA Direct Memory Access
  • I / O Input / Output
  • DMAR DMA Remapping
  • the hardware that provides this DMAR virtualization support mechanism is called DMAR-HW (hardware).
  • a hardware conversion mechanism that performs DMA address conversion of input / output devices such as the conventional DMAR-HW supports only one-level virtualization. Therefore, there is a problem that the virtual machine monitor and guest program higher than the second layer in the nested virtualization technology cannot be used.
  • One aspect of the disclosed technology is to speed up virtualization when providing a hardware translation mechanism for performing DMA address translation by an input / output device to a guest program in a nested virtualization environment. is there.
  • the disclosed technology includes a specifying unit that specifies the cause of the transition from the non-privileged mode to the privileged mode that occurs in the processing of the guest program in the nested virtual environment.
  • the nested virtualization environment is a virtualization environment in which an upper virtual machine is constructed by an upper virtual machine monitor that operates on a virtual machine constructed by a first layer virtual machine monitor.
  • the virtual machine monitor in the first layer operates in a privileged mode, and the upper virtual machine monitor and the guest program on the upper virtual machine operate in a non-privileged mode.
  • the disclosed technology includes a setting unit that sets a conversion table used in the conversion mechanism when the factor specified by the specifying unit is setting or updating of a virtual conversion table.
  • the virtual conversion table is provided to the guest program by virtualizing a hardware conversion mechanism using a conversion table in which DMA address conversion by an input / output device assigned to the upper virtual machine is set Used in.
  • the setting unit uses the virtual conversion table and the conversion table used in the conversion mechanism based on the correspondence between the guest memory space in which the guest program operates and the host memory space in which the first-layer virtual machine monitor operates. Set.
  • the disclosed technology can speed up virtualization when providing a hardware translation mechanism that performs DMA address translation by an input / output device to a guest program in a nested virtualization environment. It has the effect.
  • DMAR-HW It is the schematic which shows the address translation by DMAR-HW. It is a figure which shows an example of a DMAR table. It is a block diagram which shows the outline of virtualization of DMAR-HW. It is a figure which shows the relationship of the DMAR table in HPA and GPA. It is a figure for demonstrating the update of a DMAR table. It is a block diagram which shows the outline of the virtualization support mechanism of CPU in a nested virtualization structure. It is a block diagram which shows the outline of a comparative example. It is the schematic which shows the memory structure of a comparative example. It is a functional block diagram of VMM in a comparative example.
  • 14 is a flowchart showing processing of a VM-Exit handler in the third embodiment.
  • 14 is a flowchart illustrating VM-Exit processing from the VMM 120 in the third embodiment.
  • 14 is a flowchart illustrating a VM-Exit process from the VMM in the third embodiment. It is a flowchart which shows the DMAR virtualization process in 3rd Embodiment. It is a figure for demonstrating the transition between the non-privileged mode and privilege mode in 3rd Embodiment.
  • a guest OS (Operating System) on a virtual machine (VM) constructed by a virtual machine monitor (VMM) is used as an I / O (Input / Output) device to be used. Allocate resources.
  • I / O device accesses the allocated memory resource, it is necessary to convert the address in the guest memory space (GPA: Guest Physical Address) to the address in the host memory space (HPA: Host Physical Address). is there. This conversion is performed by the DMAR, and the hardware that performs the DMAR is called DMAR-HW.
  • the 0 to 2 GB area of the guest memory space is allocated to the I / O devices 801 and 802, and the 0 to 2 GB area of the guest memory space is assigned to 4 GB to 4 GB of the host memory space. Assume that it corresponds to a 6 GB area.
  • the I / O device 801 or 802 accesses an address in the 0 to 2 GB area of the guest memory space. Then, the guest memory space address (GPA) accessed by the I / O device is converted by the DMAR-HW 200 into the host memory space address (HPA).
  • GPSA guest memory space address
  • HPA host memory space address
  • DMAR-HW 200 In order to convert the address accessed by the I / O device from GPA to HPA, it is necessary to set in the DMAR-HW 200 a conversion table (DAR table) indicating what conversion is to be performed. This conversion table is created on the memory, and the head address is set in the register of the DMAR-HW 200.
  • DAR table conversion table
  • FIG. 2 shows a configuration example of the DMAR table 500 in VT-d, which is a virtualization support mechanism based on Intel (registered trademark) DMAR-HW.
  • the register of the DMAR-HW 200 is mapped to a specific area on the memory.
  • the entry corresponding to the I / O device in the DMAR table 500 includes a bus number (Bus), a device number (Dev), and a function number (Fun).
  • the DMAR table 500 has a hierarchical structure.
  • the bus entry numbers of the I / O devices are classified by the route entry table 500A of the first hierarchy, and the device numbers and function numbers of the I / O devices are given by the context entry table 500B of the second hierarchy. Classify.
  • the third and subsequent layers are called an address conversion table 500C, and a conversion method for converting GPA accessed by an I / O device into HPA is set.
  • the address conversion table can be shared and used. That is, the DMAR table 500 defines an association between an entry corresponding to an I / O device and a GPA-HPA conversion method.
  • the DMAR-HW can directly allocate an I / O device to the guest OS operating on the VM by converting the GPA to the HPA using such a conversion table.
  • the DMAR-HW can also be used for a normal OS other than the VMM.
  • a DMAR table may be set so that DMA cannot be performed from the I / O device to that area.
  • the VMM needs to virtualize the DMAR-HW and provide it to the guest OS so that the guest OS operating on the VM can use the DMAR-HW.
  • a CPU virtualization support mechanism such as Intel (registered trademark) VT-x can be used.
  • FIG. 3 shows an example of DMAR-HW virtualization implemented by the information processing apparatus 151.
  • the information processing apparatus 151 includes a CPU 400, which is a hardware resource, a memory 300, a DMAR-HW 200, and I / O devices 801 and 802.
  • the CPU 400 includes a hardware virtualization support mechanism 490 such as Intel (registered trademark) VT-x.
  • Intel registered trademark
  • the VMM 110 includes a VM-Exit handler 10 and a DMAR virtualization unit 11.
  • the DMAR virtualization unit 11 virtualizes the DMAR-HW 200 and provides it to the VM 111, which is shown to the guest OS 140 as the v (virtual) DMAR-HW 211.
  • the VM 112 is provided with the vDMAR-HW 212.
  • the DMAR virtualization unit 11 monitors access to the register of the vDMAR-HW 211 by the guest OS 140. Since the register of the DMAR-HW 200 is mapped to a specific address in the memory space, the DMAR virtualization unit 11 shows the guest OS 140 so that the register of the vDMAR-HW 211 is also mapped to the same position.
  • the guest OS 140 When the guest OS 140 accesses the mapped register, it sets the virtualization support mechanism 490 of the CPU 400 so that an exception occurs.
  • the VM Exit handler 10 specifies the cause when an exception occurs, and calls the DMAR virtualization unit 11 when the guest OS 140 accesses the mapped register.
  • the DMAR virtualization unit 11 identifies the location of the DMAR table 510 created by the guest OS 140 from the address that the guest OS 140 tried to set in the vDAR-HW 211 register.
  • the DMAR table 510 is a DMAR table that is set in the vDAR-HW 211 when the guest OS 140 initializes the I / O device assigned by the VMM 110.
  • the DMAR table 510 is created on the GPA by the guest OS 140 and includes settings related to the area on the GPA space allocated to the I / O device.
  • the VMM 110 creates a DMAR table 501 in which the contents of the DMAR table 510 are converted into the HPA space based on the address conversion method from the GPA space to the HPA space managed by the VMM 110.
  • a DMAR table 500 is set in advance. For example, it is assumed that an I / O device 801 is allocated to the VM 111 and an I / O device 802 is allocated to the VM 112.
  • the DMAR table 500 includes a setting for converting the DMA of the I / O device 801 allocated to the VM 111 and a setting for converting the DMA of the I / O device 802 allocated to the VM 112.
  • the DMAR virtualization unit 11 updates the setting regarding the I / O device 801 allocated to the VM 111 on which the guest OS 140 operates in the DMAR table 500 with the contents of the DMAR table 501. A method for updating the DMAR table will be described later.
  • the DMAR virtualization unit 11 uses the virtualization support mechanism 490 of the CPU 400 to set the area where the DMAR table 510 is placed in WP (Write Protect). This is for detecting an update of the DMAR table 510 by the guest OS 140. When an update of the DMAR table 510 is detected, emulation can be performed so that the updated contents are reflected in the DMAR table 501.
  • WP Write Protect
  • FIG. 4 shows the relationship of the DMAR table between HPA and GPA in the virtualization of DMAR-HW shown in FIG.
  • HPA address ranges 4 GB to 6 GB are assigned as GPA 0 GB to 2 GB.
  • the DMAR table 510 created on the GPA by the guest OS 140 includes a setting that the address range 1 GB to 2 GB of the GPA is an area allocated to the I / O device 801.
  • the DMAR table 501 is obtained by converting the DMAR table 510 onto the HPA.
  • the DMAR table 501 includes a setting that the HPA address range 5 GB to 6 GB is an area allocated to the I / O device 801. Based on the DMAR table 501 converted in this manner, the preset (initial state) DMAR table 500 is updated.
  • FIG. 5 shows an example of updating the DMAR table 500.
  • entries corresponding to the I / O device 801 are a bus number (Bus) N, a device number (Dev) i, and a function number (Fun) j.
  • the bus number N corresponds to the root entry N of the root entry table 500A
  • the device number i and the function number j correspond to the context entry M of the context entry table 500B corresponding to the root entry N.
  • this entry refers to the address translation table 500C1.
  • the address conversion table 500C2 is a part of the DMAR table 501 and the setting that the guest OS 140 converts to the I / O device 801 is converted to the HPA.
  • the update of the DMAR table 500 is performed by changing the reference of the entry of the root entry N and the context entry M, that is, the entry of the I / O device 800, from the address translation table 500C1 to the address translation table 500C2.
  • VT-x which is a virtualization support mechanism for an Intel (registered trademark) CPU
  • two operation modes a privileged mode and a non-privileged mode
  • the functions that can be used are limited, and if an unauthorized process such as execution of a privileged instruction is performed, an exception occurs and the privileged mode is entered.
  • the CPU is in the privileged mode, it is possible to execute all privileged instructions and to monitor and catch exceptions that occur in the non-privileged mode.
  • the transition of the CPU operation mode from the privileged mode to the non-privileged mode is referred to as VM-Entry, and the transition from the non-privileged mode to the privileged mode is referred to as VM-Exit.
  • FIG. 6 shows an example of nested virtualization implemented by the information processing apparatus 152.
  • the same parts as those in the prior art DMAR-HW virtualization example shown in FIG. 3 are denoted by the same reference numerals, and detailed description thereof is omitted.
  • the information processing apparatus 152 includes a CPU 400 and a memory 300 which are hardware resources.
  • the first layer VMM 110 is operated to construct the first layer VM 111.
  • the second layer VMM 120 is operated on the VM 111, the second layer VM 121 is constructed, and the guest OS 140 is operated on the VM 121.
  • the VMM 110 operates in the privileged mode, and the VMM 120 and the guest OS 140 operate in the non-privileged mode.
  • the host memory space where the VMM 110 operates is HPA
  • the guest memory space where the VMM 120 operates is GPA1
  • the guest memory space where the guest OS 140 operates is GPA2.
  • a v (virtual) memory 310 and a v (virtual) CPU 410 are allocated to the VM 111. Further, a v (virtual) memory 320 and a v (virtual) CPU 420 are allocated to the VM 121.
  • the CPU 400 includes a hardware virtualization support mechanism 490 such as Intel (registered trademark) VT-x.
  • Intel registered trademark
  • VT-x an area for holding the CPU state called VMCS (Virtual Machine Control Structure) is created on the memory, and the VMCS address is referred to the virtualization support mechanism 490 so that the CPU 400 state (privileged mode, non-privileged) Mode).
  • VMCS Virtual Machine Control Structure
  • the VMCS 700 holds control information such as a host state holding unit 701 that holds a state of a host that operates in a privileged mode, a guest state holding unit 702 that holds a state of a guest that operates in a non-privileged mode, and other settings and states.
  • the control information holding unit 703 is provided.
  • control information holding unit 703 is configured to specify, for example, what factors cause VM-Exit to be performed, identification of factors when actual VM-Exit is performed, and EPT (Extended) that performs GPA-HPA conversion of the CPU described later. Set Page Table).
  • a v (virtual) VMCS 710 for holding the state of the vCPU 410 assigned to the VM 111.
  • the vVMCS 710 is provided in the v memory 310 allocated to the VM 111, and includes a host state holding unit 711, a guest state holding unit 712, and a control information holding unit 713, similar to the VMCS 700.
  • the host state holding unit 711 of the vVMCS 710 stores the state of the vCPU 410 operating the VMM 120
  • the guest state holding unit 712 stores the state of the vCPU 420 operating the guest OS 140.
  • a VMCS-C (Copy) 600 which is a save area of the VMCS 700, is also placed.
  • the VMCS-C 600 also includes a host state holding unit 601, a guest state holding unit 602, and a control information holding unit 603. How to use VMCS-C600 will be described later.
  • a VMREAD instruction or a VMWRITE instruction which is a privileged instruction is used.
  • the VMM 120 in the second layer wants to set the guest state holding unit 712 of the vVMCS 710 to operate the guest OS 140, the VMWRITE instruction is executed.
  • the VMMM 120 operating in the non-privileged mode tries to execute the VMWRITE instruction, which is a privileged instruction, an exception occurs, and the VM-Exit is performed, and the process proceeds to the VMM 110.
  • the VMM 110 specifies that the VM-Exit factor (hereinafter referred to as “VM-Exit factor”) is the execution of the VMWRITE instruction.
  • VM-Exit factor the VM-Exit factor
  • the VMM 120 executes a VM-Entry instruction in order to transfer the process to the guest OS 140.
  • the VMM 120 operating in the non-privileged mode tries to execute the VM-Entry instruction that is a privileged instruction, an exception is generated and the VMM 110 is VM-Exited.
  • the VMM 110 When the VMM 110 specifies that the VM-Exit factor is execution of the VM-Entry instruction, the VMM 110 copies the state of the vCPU 410 held in the guest state holding unit 702 of the VMCS 700 to the host state holding unit 711 of the vVMCS 710. Then, the state of the vCPU 420 held in the guest state holding unit 712 of the vVMCS 710 is set in the guest state holding unit 702 of the VMCS 700.
  • the setting for monitoring and controlling the VMM 120 held in the control information holding unit 703 of the VMCS 700 is saved in the control information holding unit 603 of the VMCS-C 600.
  • the setting for monitoring and controlling the guest OS 140 is performed in the control information holding unit 703 of the VMCS 700.
  • This setting includes a setting for the VMM 110 held in the control information holding unit 603 of the VMCS-C 600 to monitor and control the VMM 120, and a VMM 120 held in the control information holding unit 713 of the vVMCS 710 monitor and control the guest OS 140. Created from with settings for.
  • the VMM 110 virtualizes a specific hardware resource and shows it to the VMM 120.
  • the VMM 110 sets the control information holding unit 703 of the VMCS 700 so as to perform VM-Exit when the VMM 120 accesses the hardware resource.
  • the VMM 120 is assumed to show the guest OS 140 as it is without virtualizing this hardware resource.
  • the control information holding unit 713 of the vVMCS 710 is not set to perform VM-Exit even when the guest OS 140 accesses this hardware resource.
  • the VMM 110 actually monitors and controls the guest OS 140, when the guest OS 140 accesses this hardware resource, it needs to be set to perform VM-Exit. Therefore, the setting for the VMM 110 to monitor and control the guest OS 140 is created from the setting for the VMM 110 to monitor and control the VMM 120 and the setting for the VMM 120 to monitor and control the guest OS 140.
  • the VMM 110 executes a VM-Entry instruction and moves the processing to the guest OS 140.
  • the process returns to the VMM 110.
  • the VMM 110 identifies the VM-Exit factor, and collates it with the VM-Exit factor set in the control information holding unit 713 of the vVMCS 710 as the VM-Exit factor processed by the VMM 120. If it is a VM-Exit factor to be processed by the VMM 120, the processing is shifted to the VMM 120, and the VMM 120 is caused to process an exception (processing according to the VM-Exit factor).
  • the state of the vCPU 420 held in the guest state holding unit 702 is copied to the guest state holding unit 712 of the vVMCS 710. Then, the state of the vCPU 410 held in the host state holding unit 711 of the vVMCS 710 is set in the guest state holding unit 702 of the VMCS 700. The settings saved in the control information holding unit 603 and information regarding the VM-Exit are set in the control information holding unit 703 of the VMCS 700. Finally, the VM-Entry instruction is executed, and the process is transferred to the VMM 120.
  • the VMM 120 determines that the VM-Exit processing from the guest OS 140 has been transferred by the VM-Entry from the VMM 110, and performs processing according to the VM-Exit factor.
  • the vVMCS 710 is set to return the process to the guest OS 140 and the VM-Entry instruction is executed. As described above, these are performed by emulation by the VMM 110.
  • the state transition between the VMM 120 in the second layer and the guest OS 140 is performed once via the VMM 110 in the first layer.
  • the CPU virtualization support mechanism is provided with a GPA-HPA conversion function for memory access by the CPU.
  • the GPA-HPA conversion of the CPU is performed using a conversion table, similar to DMAR.
  • this conversion table can also set memory attributes such as setting a specific area of GPA to WP.
  • this conversion table is called an EPT (Extended Page Table).
  • EPT Extended Page Table
  • an EPT 901 that is a conversion table between the address GPA 1 of the guest memory space of the VM 111 and the address HPA of the host memory space is created and set in the control information holding unit 703 of the VMCS 700.
  • an EPT 912 that is a conversion table between the address GPA 2 of the guest memory space of the VM 121 and the guest memory space GPA 1 of the VMM 120 is created and set in the control information holding unit 713 of the vVMCS 710.
  • the VMM 110 can create an EPT 902 that is a GPA2-HPA conversion table from an EPT 901 that is a GPA1-HPA conversion table and an EPT 912 that is a GPA2-GPA1 conversion table. That is, the EPT 902 is a conversion table set in the control information holding unit 703 when VM-Entry from the VMM 110 to the guest OS 140 is performed.
  • FIG. 7 shows an example of DMAR-HW nested virtualization in the case where the conventional nested virtualization and DMAR-HW virtualization are combined as they are.
  • the same parts as those of the prior art DMAR-HW virtualization shown in FIG. 3 and the nested virtualization example shown in FIG. 6 are denoted by the same reference numerals, and detailed description thereof is omitted.
  • the configuration shown in FIG. 7 is referred to as a comparative example.
  • the first-layer VMM 110 is operated to construct the first-layer VMs 111 and 112. Further, the second layer VMM 120 is operated on the VM 111, the second layer VM 121 is constructed, and the guest OS 140 is operated on the VM 121.
  • the host memory space where the VMM 110 operates is HPA
  • the guest memory space where the VMM 120 operates is GPA1
  • the guest memory space where the guest OS 140 operates is GPA2.
  • the VM 111 is provided with the vDMAR-HW 211 and is assigned with the v memory 311 and the vCPU 410. Further, the VM 121 is provided with a vDMAR-HW 221 and assigned with a v memory 321 and a vCPU 420.
  • FIG. 8 shows an example of the configuration of the memory 300 in the configuration of FIG.
  • the area allocated to the v memory 311 of the memory 300 includes an area allocated to the v memory 321.
  • the area allocated to the v memory 321 stores the GPA2-based DMAR table 520 created by the guest OS 140.
  • the DMAR table 512 obtained by converting the DMAR table 520 into the GPA1 standard, and the GPA1 standard DMAR table 510 created by the VMM 120 are stored.
  • a vVMCS 710 that holds the state of the vCPU 410 and an EPT 912 that is a conversion table between GPA 2 and GPA 1 are stored.
  • the memory 300 stores a DMAR table 500 created by the VMM 110 based on the HPA standard, a DMAR table 501 obtained by converting the DMAR table 510 into the HPA standard, and a DMAR table 502 obtained by converting the DMAR table 520 into the HPA standard. Further, the memory 300 stores VMCS 700 that holds the state of the CPU 400 and VMCS-C 600 that saves the state of the VMCS 700. The memory 300 also stores an EPT 901 that is a conversion table between GPA 1 and HPA, and an EPT 902 that is a conversion table between GPA 2 and HPA.
  • the VMM 110 includes a VM-Exit handler 10 and a DMAR virtualization unit 11.
  • the DMAR virtualization unit 11 includes a GPA1 DMAR table acquisition unit 12, a GPA1-HPA conversion unit 13, a WP setting unit 14, a DMAR table creation unit 15, and a host DMAR table update unit 16.
  • the VMM 120 also includes a VM-Exit handler 20 and a DMAR virtualization function 21, and provides the same functions as the VM-Exit handler 10 and the DMAR virtualization unit 11 of the VMM 110.
  • the VM-Exit handler 10 captures the VM-Exit from the guest OS 140 or the VMM 120, specifies the VM-Exit factor, and performs processing according to the VM-Exit factor.
  • the process according to the VM-Exit factor is, for example, setting for the VMCS when performing VM-Entry to the guest OS 140 or the VMM 120.
  • the VMM 120 changes the EPT 912 so that the VMM 120 sets the area of the DMAR table 520 created by the guest OS 140 in the WP
  • the VM-Exit handler 10 reflects the changed contents on the EPT 902.
  • the GPA1 DMAR table acquisition unit 12 acquires the DMAR table 510 and the DMAR table 512 managed by the VMM 120.
  • the GPA1-HPA conversion unit 13 converts GPA1 into HPA.
  • the WP setting unit 14 sets the area of the DMAR tables 510 and 512 to WP.
  • the DMAR table creation unit 15 creates a DMAR table obtained by performing GPA1-HPA conversion on the DMAR table acquired by the GPA1 DMAR table acquisition unit 12.
  • the host DMAR table update unit 16 updates the DMAR table 500 with the contents of the DMAR table created by the DMAR table creation unit 15.
  • FIG. 10 shows a processing flow by the VM-Exit handler 10.
  • FIG. 11 shows a process (1) flow for each VM-Exit factor in the process flow by the VM-Exit handler 10.
  • FIG. 12 shows a DMAR virtualization processing flow by the DMAR virtualization unit 11.
  • step S1 of the processing flow of the VM-Exit handler 10 shown in FIG. 10 the VM-Exit handler 10 sends the VM-Exit factor from the guest OS 140 or the VMM 120 to the control information holding unit 703 of the VMCS 700 in the virtualization support mechanism 490. Is specified by referring to the VM-Exit factor stored automatically. For example, when the guest OS 140 sets the DMAR table 520 in the vDMAR-HW 221, the guest OS 140 accesses the address to which the register of the vDMAR-HW 221 is mapped. The EPT 902 is set in advance so that an exception occurs when accessing this address.
  • the address causing the exception is obtained from the information stored in the control information holding unit 703 of the VMCS 700, and this address is the vDMR-HW221. If the register matches the mapped address, it can be determined that “setting to vDMAR-HW 221”.
  • step S 2 the VM-Exit handler 10 determines whether the captured VM-Exit is a VM-Exit from the guest OS 140 or a VM-Exit from the VMM 120. In the case of VM-Exit of the guest OS 140, the process proceeds to step S55, and in the case of VM-Exit from the VMM 120, the process proceeds to step S10.
  • step S55 the VM-Exit handler 10 determines whether the processing according to the VM-Exit factor is performed as it is by the VMM 110 or left to the VMM 120, that is, the processing destination. This determination is performed by previously setting a VM-Exit factor to be processed by the VMM 120 in the control information holding unit 713 of the vVMCS 710 and referring to this setting.
  • the VMM Exit factor is processed by the VMM 110
  • the process proceeds to step S20.
  • the VMM Exit factor is processed by the VMM 120, the process proceeds to step S61.
  • step S61 the VM-Exit handler 10 performs various settings in the VMCS for transferring processing to the VMM 120.
  • step S 62 the VM-Exit handler 10 performs VM-Entry to the VMM 120 in order to transfer the processing to the VMM 120.
  • step S20 the VM-Exit handler 10 executes the process (2) for each VM-Exit factor.
  • the process (2) for each VM-Exit factor is a process to be performed by the VMM 110, such as reading / writing a value to / from a register and executing an instruction.
  • the process (2) for each VM-Exit factor is completed, the process proceeds to step S22, and the VM-Exit handler 10 VM-Entry to the guest OS 140 in order to return the process to the guest OS 140.
  • step S10 the VM-Exit handler 10 determines whether the VM-Exit factor specified in step S1 is a VM-Entry instruction. If the VM-Exit factor is a VM-Entry instruction, the process proceeds to step S21, and the VM-Exit handler 10 performs various settings for moving the process to the guest OS 140 in the VMCS. Next, in step S ⁇ b> 22, the VM-Exit handler 10 performs VM-Entry to the guest OS 140 in order to transfer the processing to the guest OS 140.
  • step S10 determines in step S10 that the VM-Exit factor is not a VM-Entry instruction
  • the process proceeds to step S30, and the processing (1) for each VM-Exit factor shown in FIG. Execute.
  • the process proceeds to step S100, and when it is not the setting to vDMAR-HW 211, the process proceeds to step S32.
  • step S32 the VM-Exit handler 10 determines whether or not the DMAR table 510 in which the VM-Exit factor is set to WP is updated. If the VM-Exit factor is updating the DMAR table 510 with WP set, the process proceeds to step S100, and if not updating the DMAR table 510 with WP set, the process proceeds to step S33.
  • step S100 the DMAR virtualization unit 11 executes the DMAR virtualization process shown in FIG.
  • step S101 of the DMAR virtualization process shown in FIG. 12 the VM-Exit handler 10 determines whether the VM-Exit factor is set in the vDMAR-HW 211.
  • the process proceeds to step S102, and when the VM-Exit factor is the update of the DMAR table 510 in which the WP is set, the process proceeds to step S111.
  • step S102 the GPA1 DMAR table acquisition unit 12 acquires the DMAR table 510 created by the VMM 120.
  • the DMAR table 510 is created based on the GPA1 standard. Therefore, in the next step S103, the DMAR table creation unit 15 creates a DMAR table 501 obtained by converting the GPA1-based DMAR table 510 into the HPA standard using the GPA1-HPA conversion unit 13.
  • step S ⁇ b> 104 the host DMAR table update unit 16 updates the setting for the I / O device 801 in the DMAR table 500 with the contents of the DMAR table 501.
  • the WP setting unit 14 reflects the WP setting of the memory area in which the DMAR table 510 is stored in the EPT 901 that performs the GPA1-HPA conversion of the CPU 400 so that the update of the DMAR table 510 by the VMM 120 can be detected.
  • the process returns to the process (1) for each VM-Exit factor shown in FIG.
  • step S111 the GPA1 DMAR table acquisition unit 12 acquires the DMAR table 512 created by the VMM 120.
  • the DMAR table 512 is created based on the GPA1 standard. Therefore, in the next step S112, the DMAR table creation unit 15 creates the DMAR table 502 obtained by converting the GPA1-based DMAR table 512 into the HPA standard using the GPA1-HPA conversion unit 13.
  • step S113 the host DMAR table update unit 16 updates the setting for the I / O device 801 in the DMAR table 500 with the contents of the DMAR table 502.
  • step S114 the WP setting unit 14 sets the WP setting of the memory area in which the DMAR table 512 is stored to the EPT 901 that performs the GPA1-HPA conversion of the CPU 400 so that the update of the DMAR table 512 by the VMM 120 can be detected. reflect.
  • the process returns to the process (1) for each VM-Exit factor shown in FIG.
  • step S32 If a negative determination is made in step S32, the process proceeds to step S33, the VM-Exit handler 10 executes a process according to the VM-Exit factor, and returns to the process by the VM-Exit handler 10 shown in FIG. To do.
  • FIG. 13 shows the transition between the non-privileged mode and the privileged mode in the DMAR-HW nested virtualization process.
  • an I / O device 801 is assigned to the guest OS 140, and the guest OS 140 performs settings for the I / O device 801 in the vDAR-HW 221.
  • the VM-Exit from the non-privileged mode to the privileged mode is indicated by a one-dot chain line arrow
  • the VM-Entry from the privileged mode to the non-privileged mode is indicated by a two-dot chain line arrow.
  • step S500 of FIG. 13 when the guest OS 140 accesses the register of the vDMAR-HW 221 to set the DMAR table 520 in the vDMAR-HW 221, it performs a VM-Exit to the VMM 110. Originally, it is desired to transfer the processing to the VMM 120 of the second layer that manages the vDMAR-HW 221. However, since the guest OS 140 and the VMM 120 are both in the non-privileged mode and VM-Exit cannot be directly performed, the VM- Exit.
  • step S501 the VM-Exit handler 10 specifies a VM-Exit factor.
  • the VM-Exit factor is the setting of the vDAR-HW 221 by the guest OS 140, which is originally a process of the VMM 120, so the process moves to the VMM 120 in step S502.
  • Steps S501-> S502 correspond to steps S1-> S2-> S55-> S61-> S62 in FIG.
  • step S503 the VM-Exit handler 20 of the VMM 120 specifies that the VM-Exit factor is the setting for the vDAR-HW 221 by the guest OS 140.
  • step S504 the DMAR virtualization function 21 of the VMM 120 creates a DMAR table 512 obtained by converting the DMAR table 520 created based on the GPA2 space on the basis of the GPA1 space.
  • step S505 the DMAR virtualization function 21 updates the DMAR table 510 with the contents of the DMAR table 512. Since the WP is set in the memory area in which the DMAR table 510 is stored, an exception occurs due to the update of the DMAR table 510 and the VMM 110 is VM-Exited.
  • step S506 the VM-Exit handler 10 specifies that the VM-Exit factor is an update of the DMAR table 510 set with WP.
  • step S507 the GPA1 DMAR table acquisition unit 12 acquires the DMAR table 512.
  • the DMAR table creation unit 15 uses the GPA1-HPA conversion unit 13 to create the DMAR table 502 obtained by converting the GPA1-standard DMAR table 512 into the HPA standard.
  • step S508 the host DMAR table update unit 16 updates the DMAR table 500 with the contents of the DMAR table 502.
  • step S509 the WP setting unit 14 sets the memory area in which the DMAR table 512 is stored in the WP.
  • step S ⁇ b> 510 the VM-Exit handler 10 performs VM-Entry to the VMM 120 in order to transfer the processing to the VMM 120.
  • Steps S506 ⁇ S507 ⁇ S508 ⁇ S509 ⁇ S510 are steps S1 ⁇ S2 ⁇ S10 ⁇ S30 ⁇ S31 ⁇ S32 ⁇ S100 ⁇ S101 ⁇ S111 ⁇ S112 ⁇ S113 ⁇ S114 of FIG. It corresponds to.
  • step S511 the VMM 120 sets the WP of the memory area in which the DMAR table 520 created by the guest OS 140 is stored in the EPT 912 that performs the GPA2-GPA1 conversion of the vCPU 410.
  • step S 512 the VMM 120 performs setting for the VM-Entry to the guest OS 140 to the vVMCS 710 of the vCPU 410. Since the setting to the vVMCS 710 involves execution of the privileged command VMWRITE or VMREAD, the VMM 110 is VM-Exited.
  • step S513 the VM-Exit handler 10 specifies the VM-Exit factor as VMWRITE or VMREAD to the vVMCS 710.
  • step S514 the VM-Exit handler 10 sets the vVMCS 710 and the EPT 902.
  • step S ⁇ b> 515 the VM-Exit handler 10 performs VM-Entry to the VMM 120 in order to transfer the processing to the VMM 120.
  • the VM-Exit and the VM-Entry are repeated a plurality of times between the VMM 110 and the VMM 120.
  • the VM-Exit handler 10 reflects the change in the EPT 902 that performs GPA2-HPA conversion.
  • Steps S513 ⁇ S514 ⁇ S515 correspond to steps S1 ⁇ S2 ⁇ S10 ⁇ S30 in FIG. 10 ⁇ S31 ⁇ S32 ⁇ S33 ⁇ S61 in FIG.
  • step S5166 the VMM 120 executes a VM-Entry instruction to return the processing to the guest OS 140.
  • a VM-Entry instruction By executing the privileged instruction VM-Entry by the VMM 120 in the non-privileged mode, an exception occurs and the VMM 110 is VM-Exited.
  • step S517 the VM-Exit handler 10 identifies the VM-Exit factor as a VM-Entry instruction from the VMM 120 to the guest OS 140.
  • step S5108 the process moves to the guest OS 140.
  • the above steps S517 ⁇ S518 correspond to steps S1 ⁇ S2 ⁇ S10 ⁇ S21 ⁇ S22 in FIG.
  • FIG. 14 shows an example of the relationship of the DMAR table in the DMAR-HW nested virtualization.
  • the HPA address range of 4 GB to 10 GB is allocated as 0 GB to 6 GB of GPA1. Further, the address range 4 GB to 6 GB of GPA 1 is assigned as 0 GB to 2 GB of GPA 2.
  • the DMAR table 520 created on the GPA 2 includes a setting that the address range 1 GB to 2 GB of the GPA 2 is an area allocated to the I / O device 801.
  • the DMAR table 512 is obtained by converting the DMAR table 520 onto the GPA1, and the DMAR table 502 is obtained by converting the DMAR table 512 onto the HPA.
  • the DMAR table 502 includes a setting that the HPA address range 9 GB to 10 GB is an area allocated to the I / O device 801.
  • the DMAR table 501 is obtained by converting the DMAR table 510 created on the GPA 1 into the HPA by the VMM 120.
  • the role of the VMM 120 is to convert the GPA2-based DMAR table 520 created by the guest OS 140 into the GPA1-based DMAR table 512 and set it in the vDMAR-HW 211.
  • the settings made in the vDMAR-HW 211 are reflected on the DMAR-HW 200 by the VMM 110 in the first layer by converting the DMAR table 512 into the DMAR table 502 based on the HPA.
  • the VMM 120 is only a relay point until the DMAR table 520 created by the guest OS 140 is set in the DMAR-HW 200. If the VMM 110 can directly set the DMAR table 520 of the guest OS 140 in the DMAR-HW 200, it is not necessary to relay the VMM 120 in the second layer.
  • the VMM 120 in the second layer does not know that the guest OS 140 is using the vDAR-HW221.
  • the VMM 120 recognizes that the guest OS 140 is not using the vDAR-HW 221. That is, the VMM 120 in the second layer need only perform its own setting to the vDAR-HW 211 without being aware of the setting of the upper guest OS 140.
  • the DMAR settings made by the guest OS 140 and the VMM 120 in the second layer are finally reflected in the DMAR-HW 200 by the VMM 110 in the first layer. That is, as shown in the right diagram of FIG. 15, the GPA2-based DMAR table 520 is directly converted into the HPA-based DMAR table 502 by the VMM 110B (first-layer VMM of the disclosed technology).
  • FIG. 16 shows the information processing apparatus 100 according to the first embodiment.
  • the first-layer VMM 110B operating on the information processing apparatus 100 includes a VM-Exit handler 10B and a DMAR virtualization unit 11B.
  • the VM-Exit handler 10B is an example of a specific unit of the disclosed technology.
  • the DMAR virtualization unit 11B is an example of a setting unit of the disclosed technology.
  • the VM-Exit handler 10B captures the VM-Exit from the guest OS 140 or the VMM 120 and identifies the VM-Exit factor. The VM-Exit handler 10B determines, for the VM-Exit from the guest OS 140, whether the VM-Exit factor is “setting to the DMAR-HW 221” or “updating the DMAR table 520 set with WP”. When the VM-Exit factor is “setting to DMAR-HW 221” or “update of DMAR table 520 with WP setting”, the processing is not performed by the VMM 120 but executed by the VMM 110B.
  • the setting of the DMAR table in the DMAR-HW is performed by accessing the register of the DMAR-HW mapped in the memory.
  • the guest OS 140 accesses the memory and the VM-Exit is performed, if the accessed address matches the register address of the vDAR-HW 221 shown to the guest OS 140, the access is to the DMAR-HW 221.
  • the vDMAR-HW221 register address that the VMM 120 of the second layer shows to the guest OS 140 is the same as the address to which the register of the DMAR-HW200 is mapped. There must be. If the vMMAR-HW 221 register address that the second layer VMM 120 shows to the guest OS 140 is freely changed, the first layer VMM 110 has no way of knowing the address, and therefore detects access to the vDMAR-HW 221. I can't.
  • the VMM generally shows (virtualizes) the physical DMAR-HW register address as it is to the host guest, the above limitation is not particularly problematic.
  • the update of the DMAR table 520 set with the WP can be determined by checking whether or not the address matches the area in which the DMAR table 520 is stored when an exception occurs due to memory access.
  • a GPA2DMAR table acquisition unit 17 and a GPA2-HPA conversion unit 18 are added to the functional units of the DMAR virtualization unit 11 of the comparative example shown in FIG.
  • the GPA2 DMAR table acquisition unit 17 acquires the DMAR table 520 created by the guest OS 140 when the VM-Exit factor is the setting to the vDAR-HW 221 by the guest OS 140 or the update of the DMAR table 520.
  • GPA2-HPA conversion unit 18 converts GPA2 into HPA.
  • the GPA2-HPA conversion unit 18 is used when the DMAR table creation unit 15 creates the DMAR table 502 obtained by converting the DMAR table 520 created by the guest OS 140 into the HPA standard.
  • the GPA2-HPA converter 18 uses the EPT 902 that performs GPA2-HPA conversion created for the virtualization support mechanism of the CPU.
  • the memory 300 since the DMAR table 512 obtained by converting the DMAR table 520 into the GPA1 standard is not created, as shown in FIG. 18, the memory 300 has a DMAR unlike the memory configuration of the comparative example of FIG. An area for storing the table 512 is not provided.
  • the information processing apparatus 100 is realized by a server 40 having a nonvolatile storage unit 600 and an input / output interface (I / F) 800 in addition to a CPU 400, a memory 300, and a DMAR-HW 200. can do.
  • the CPU 400, the memory 300, the DMAR-HW 200, the storage unit 600, and the input / output I / F 800 are connected to each other via the bus 42.
  • the I / O devices 801 and 802 are connected to the server 40 via the input / output I / F 800.
  • the storage unit 600 can be realized by an HDD, a flash memory, or the like.
  • An information processing program 50 for causing the server 40 to function as the information processing apparatus 100 is stored in the storage unit 600 serving as a recording medium.
  • the CPU 400 reads the information processing program 50 from the storage unit 600 and develops it in the memory 300, and sequentially executes the processes included in the information processing program 50.
  • the information processing program 50 includes a VM-Exit handler process 51 and a DMAR virtualization process 52.
  • the CPU 400 operates as the VM-Exit handler 10B shown in FIG. 17 by executing the VM-Exit handler process 51.
  • the CPU 400 operates as the DMAR virtualization unit 11B illustrated in FIG. 17 by executing the DMAR virtualization process 52.
  • the server 40 that has executed the information processing program 50 functions as the information processing apparatus 100.
  • Each function realized by the CPU 400 can be realized by, for example, a semiconductor integrated circuit, more specifically, ASIC (Application ⁇ Specific Integrated Circuit) or the like.
  • ASIC Application ⁇ Specific Integrated Circuit
  • FIG. 20 shows a processing flow by the VM-Exit handler 10B.
  • FIG. 21 shows a flow of the DMAR virtualization process B by the DMAR virtualization unit 11B. It should be noted that the same processing as the DMAR-HW nested virtualization processing in the comparative example shown in FIGS. 10 to 12 is denoted by the same reference numeral, and detailed description thereof is omitted.
  • step S1 of the processing flow of the VM-Exit handler 10B shown in FIG. 20 the VM-Exit handler 10B captures the VM-Exit and specifies the VM-Exit factor.
  • step S2 the VM-Exit handler 10 determines whether the trapped VM-Exit is a VM-Exit from the guest OS 140 or a VM-Exit from the VMM 120. In the case of the VM-Exit of the guest OS 140, the process proceeds to step S51. In the case of the VM-Exit from the VMM 120, the process proceeds to step S10.
  • step S51 the VM-Exit handler 10B determines whether or not the VM-Exit factor determined in step S1 is the setting to the vDAR-HW 221 by the guest OS 140. In the case of setting to vDMAR-HW221, in order to continue the processing in the VMM 110, the process proceeds to step S20B, and in the case of not setting to vDMAR-HW221, the process proceeds to step S52.
  • step S52 the VM-Exit handler 10B determines whether or not the VM-Exit factor determined in step S1 is an update of the WP-set DMAR table 520 by the guest OS 140. In the case of updating the DMAR table 520 in which WP is set, the process proceeds to step S20B in order to continue the processing in the VMM 110. If it is not an update of the DMAR table 520 set with WP, the process proceeds to step S55.
  • step S20B the VM-Exit handler 10B executes a process (2B) for each VM-Exit factor.
  • the process (2B) for each VM-Exit factor is the same as the process (1) for each VM-Exit factor shown in FIG.
  • “setting to vDMAR-HW211” in step S31 is read as “setting to vDMAR-HW221”.
  • “update the WP-set DMAR table 510” in step S32 is read as “update the WP-set DMAR table 520”.
  • “DMAC virtualization processing” in step S100 is replaced with “DMAC virtualization processing B”.
  • “DAR virtualization process” in step S100 is replaced with “DAR virtualization process B”.
  • step S110 of the DMAR virtualization process B shown in FIG. 21 the VM-Exit handler 10B determines whether the VM-Exit factor is the setting to the vDAR-HW 221 by the guest OS 140 or the update of the WR-set DMAR table 520. judge. If the determination is affirmative, the process proceeds to step S121. On the other hand, if the VM-Exit factor is the setting to the vDMAR-HW 211 by the VMM 120 or the update of the DMAR table 510 with the WP setting, the process proceeds to step S131.
  • step S121 the GPA2 DMAR table acquisition unit 17 acquires the DMAR table 520 created by the guest OS 140 based on the address accessed by the guest OS 140.
  • the DMAR table 520 is created based on the GPA2 standard. Therefore, in the next step S122, the DMAR table creation unit 15 uses the GPA2-HPA conversion unit 18 to create the DMAR table 502 obtained by converting the GPA2-based DMAR table 520 into the HPA standard.
  • step S123 the host DMAR table update unit 16 updates the setting for the I / O device 801 in the DMAR table 500 with the contents of the DMAR table 502.
  • step S124 the WP setting unit 14 sets the WP setting of the memory area in which the DMAR table 520 is stored, so that the update of the DMAR table 520 by the guest OS 140 can be detected. To reflect.
  • the GPA1 DMAR table acquisition unit 12 acquires the DMAR table 510 created by the VMM 120 based on the address accessed by the VMM 120.
  • the DMAR table 510 is created based on the GPA1 standard. Therefore, in the next step S132, the DMAR table creation unit 15 creates the DMAR table 501 obtained by converting the GPA1-based DMAR table 510 into the HPA standard using the GPA1-HPA conversion unit 13.
  • step S133 the host DMAR table update unit 16 updates the setting for the I / O device 801 in the DMAR table 500 with the contents of the DMAR table 501.
  • step S134 the WP setting unit 14 sets the WP setting of the memory area in which the DMAR table 510 is stored to the EPT 901 that performs GPA1-HPA conversion of the CPU 400 so that the update of the DMAR table 510 by the VMM can be detected. reflect.
  • the process returns to the process (2B) for each VM-Exit factor shown in FIG.
  • FIG. 22 shows a transition between the non-privileged mode and the privileged mode in the DMAR-HW nested virtualization process in the first embodiment.
  • an I / O device 801 is assigned to the guest OS 140, and the guest OS 140 sets a DMAR table 520 that is a setting for the I / O device 801 in the vDAR-HW 221.
  • the VM-Exit from the non-privileged mode to the privileged mode is indicated by a one-dot chain line arrow
  • the VM-Entry from the privileged mode to the non-privileged mode is indicated by a two-dot chain line arrow.
  • the same parts as those in the transition between the non-privileged mode and the privileged mode in the DMAR-HW nested virtualization process are denoted by the same reference numerals, and detailed description thereof is omitted.
  • step S500 of FIG. 22 when the guest OS 140 accesses the register of the vDMAR-HW 221 to set the DMAR table 520 in the vDMAR-HW 221, it performs a VM-Exit to the VMM 110.
  • step S501 the VM-Exit handler 10B specifies a VM-Exit factor.
  • step S521 the VM-Exit handler 10B determines whether the VM-Exit factor is the setting to the vDAR-HW 221 by the guest OS 140 or the update of the DMAR table 520 in which the WP is set. If the VM-Exit factor is any one, the process proceeds to the next step S522 without moving the process to the VMM 120.
  • step S522 the GPA2 DMAR table acquisition unit 17 acquires the DMAR table 520. Then, the DMAR table creation unit 15 uses the GPA2-HPA conversion unit 18 to create the DMAR table 502 obtained by converting the GPA2-based DMAR table 520 into the HPA standard.
  • step S508 the host DMAR table update unit 16 updates the DMAR table 500 with the contents of the DMAR table 502.
  • step S523 the WP setting unit 14 reflects the WP setting of the memory area in which the DMAR table 520 is stored in the EPT 902.
  • step S518, the process moves to the guest OS 140.
  • Steps S501 ⁇ S521 ⁇ S522 ⁇ S508 ⁇ S523 ⁇ S518 are as follows: S1 ⁇ S2 ⁇ S51 ( ⁇ S52) ⁇ S20B ⁇ S31 ( ⁇ S32) ⁇ S100 ⁇ S121 ⁇ S122 ⁇ S123 of FIG. ⁇ S124 ⁇ corresponds to S22 in FIG.
  • FIG. 23 shows an example of the relationship of the DMAR table in the DMAR-HW nested virtualization in the first embodiment.
  • the relationship of the DMAR table and the allocation of the memory area in the virtualization of the DMAR-HW nested in the comparative example shown in FIG. 14 are the same.
  • the first embodiment is different in that the DMAR table 512 obtained by converting the DMAR table 520 into the GPA 1 is not created.
  • the second layer The processing is performed by the VMM in the first layer without moving the processing to the VMM. This makes it possible to reduce the transition between the non-privileged mode and the privileged mode, as is apparent from FIG. For this reason, it is possible to speed up the virtualization when providing the DMAR-HW to the guest OS in the nested virtualization environment.
  • the information processing apparatus 101 includes hardware resources such as a CPU 400, a memory 300, a DMAR-HW 200, and I / O devices 801, 802, 803, and 804.
  • the CPU 400 includes eight cores (cores 401, 402, ..., 408).
  • the DMAR-HW 200 controls DMA from the I / O devices 801, 802, 803, and 804.
  • the VMM 110B constructs the VMs 111 and 112, divides and allocates the hardware resources of the information processing apparatus 101 into the VM 111 and the VM 112, and monitors and controls the state.
  • Cores 401,..., 404 are assigned to the VM 111 and operate as the vCPUs 411,.
  • a part of the memory 300 is allocated to the VM 111 as the v memory 311.
  • I / O devices 801 and 802 are also directly assigned to the VM 111.
  • the VM 111 is provided with a vDMAR-HW 211.
  • the cores 405,..., 408 are allocated to the VM 112, and operate as the vCPUs 415,.
  • a part of the memory 300 is allocated to the VM 112 as the v memory 312.
  • I / O devices 803 and 804 are also directly assigned to the VM 112.
  • the VM 112 is also provided with a vDMAR-HW 212.
  • the vDMAR-HWs 211 and 212 are emulated by the VMM 110B, and the setting of the DMAR table in the vDMAR-HWs 211 and 212 is reflected in the DMAR-HW 200.
  • the VMM 120 in the second layer is operating on the VM 111, and the VMM 120 monitors and controls the state of the VM 121 operating on the VM 111.
  • the vCPU 411 is assigned to the VM 121 and operates as the vCPU 421 of the VM 121.
  • a part of the v memory 311 is allocated to the VM 121 as the v memory 321.
  • an I / O device 801 is also directly assigned to the VM 121.
  • the VM 121 is provided with vDMAR-HW221.
  • the vDMAR-HW 221 is emulated by the VMM 110B, and the setting of the DMAR table 520 in the vDMAR-HW 221 is reflected in the DMAR-HW 200.
  • the guest OS 140 is operating.
  • FIG. 25 shows the allocation of memory to the VMs 111, 112, and 121.
  • a range of 4 GB to 12 GB is allocated to the VM 111, and a range of 12 GB to 16 GB is allocated to the VM 112.
  • the memory space allocated to the VM 111 is GPA 11, and the memory space allocated to the VM 112 is GPA 12.
  • the range of 0 GB to 2 GB of HPA is used by the VMM 110 B, and the range of 2 GB to 4 GB is an area to which hardware registers and the like are mapped.
  • the 4 GB to 8 GB range in the memory space (GPA 11) of the VM 111 is allocated to the VM 121.
  • a memory space allocated to the VM 121 is referred to as GPA 21.
  • the VMM 110B creates an EPT necessary for the vCPU operating on the VM to access the memory and a DMAR table necessary for the I / O device assigned to the VM to access the memory on the memory.
  • the memory area in which the EPT and DMAR tables are stored ranges from 0 to 2 GB allocated for the VMM 110B.
  • FIG. 26 shows the EPT and DMAR table stored in the memory 300. Note that the above-described VMCS and the like are also stored in the memory 300, but the description thereof is omitted here.
  • the EPT 901 is an EPT that performs conversion from GPA 11 to HPA, and is set to the VMCS of the cores 401,.
  • the EPT 920 is an EPT that performs conversion from the GPA 12 to the HPA, and is set to the VMCS of the cores 405,.
  • FIG. 27 shows the DMAR table 500 set in the DMAR-HW 200.
  • the I / O device 801 has a bus number 10, a device number 1, and a function number 0.
  • the entry corresponding to the I / O device 801 refers to the root entry 10 of the bus number 10 in the route entry table 500A.
  • the context entry table 500B (Bus10) is referenced from the root entry 10.
  • the device number 1 and the function number 0 in the context entry table 500B (Bus10) correspond to the context entry 8.
  • Context entry 8 refers to the address conversion table 500C1.
  • the address conversion table 500C1 is a table for converting from GPA 11 to HPA.
  • the I / O device 802 is set to bus number 20, device number 2, and function number 0. Further, the I / O device 803 is assumed to have a bus number 30, a device number 3, and a function number 0. Further, the I / O device 804 is assumed to be a bus number 40, a device number 4, and a function number 0. Further, it is assumed that the address conversion table 500C2 is a table for converting from GPA 12 to HPA. In the example of FIG. 27, the I / O devices 801 and 802 assigned to the VM 111 refer to the address conversion table 500C1, and the I / O devices 803 and 804 assigned to the VM 112 refer to the address conversion table 500C2. I understand.
  • the VMM 120 creates the EPT 912 so that access to the v memory 321 by the vCPU 421 operating on the VM 121 is converted into access to the v memory 311.
  • the EPT 912 is a table that performs conversion from GPA 21 to GPA 11 and is created on the v memory 311.
  • the EPT 912 is set to the vVMCS of the vCPU 411.
  • the VMM 120 calls a VMWRITE instruction which is a privileged instruction.
  • the VMM 120 operating in the non-privileged mode calls the VMWRITE instruction, a VM-Exit is generated and the processing moves to the VMM 110B.
  • An EPT 902 is a table that performs conversion from GPA 21 to HPA.
  • the EPT 902 is created using an EPT 912 that performs conversion from GPA 21 to GPA 11 and an EPT 901 that performs conversion from GPA 11 to HPA.
  • the VMM 120 sets the DMAR table 510 in the vDMAR-HW 211.
  • the DMAR table 510 is for converting the DMA by the I / O device 801 assigned to the VM 121 from the GPA 21 to the GPA 11.
  • the VMM 120 accesses the register of the vDMAR-HW 211 in order to set the DMAR table 510, a VM-Exit occurs, and the process moves to the VMM 110B.
  • FIG. 28 shows the DMAR table 500 updated with the DMAR table 501.
  • the DMAR table 510 created by the VMM 120 converts the DMA of the I / O device 801 assigned to the VM 121 from GPA 21 to GPA 11.
  • the entry corresponding to the I / O device 802 in the DMAR table 510 is set to pass-through (facing the memory space of the VM 111). .
  • the DMA of the I / O device 801 is converted from GPA 21 to HPA.
  • the DMAR table 501 is created by using an address conversion table 500C4 in the DMAR table 510 that performs conversion from GPA 21 to GPA 11 and an EPT 901 that performs conversion from GPA 11 to HPA.
  • the settings of the I / O devices 801 and 802 assigned to the VM 111 are updated with the contents of the DMAR table 501.
  • the entry corresponding to the I / O device 801 in the DMAR table 500 is updated so as to refer to the address translation table 500C3.
  • the entry corresponding to the I / O device 802 in the DMAR table 500 is changed while referring to the address translation table 500C1 because the entry corresponding to the I / O device 802 in the DMAR table 501 has a pass-through setting. Not.
  • the VM 110B reflects the WP setting of the memory area in which the DMAR table 510 is created in the EPT 901 so that the VMM 120 can detect that the DMAR table 510 has been updated.
  • the VMM Entry is sent to the VMM 120 to return the processing.
  • the VMM 120 performs setting for moving the vCPU 421 in the vVMCS of the vCPU 411.
  • the setting to vVMCS involves execution of VMREAD / VMWRITE, which are privileged instructions, and is therefore VM-Exited and processed by VMM 110B.
  • VMREAD / VMWRITE which are privileged instructions
  • VMM 110B When these settings are completed, a VM-Entry instruction is executed in order to transfer processing to the guest OS 140.
  • the VMM 120 operating in the non-privileged mode calls the VM-Entry that is a privileged instruction
  • the VM-Exit is performed, and the process proceeds to the VMM 110B.
  • the VM 110B specifies that the VM-Exit factor is a call to the VM-Entry instruction
  • the VM 110B performs setting for operating the VM 121 in the VMCS of the core 401, and performs VM-Entry to the guest OS 140.
  • the guest OS 140 operating on the VM 121 sets the DMAR table 520 in the vDAR-HW 221 to limit the DMA of the I / O device 801.
  • a restriction is set to permit access to only the 0 to 2 GB area of the GPA 21 to the I / O device 801.
  • the address conversion table 500C6 of the DMAR table 520 is set to reject access to a range other than 0 to 2 GB of the GPA 21.
  • the guest OS 140 accesses a register of the vDAR-HW 221 in order to set the DMAR table 520 in the vDAR-HW 520. This access generates a VM-Exit.
  • the VMM 110B identifies that the VM-Exit factor is the setting of the DMAR table 520 in the vDMAR-HW 221, the VMM 110B proceeds with the process without moving the process to the VMM 120.
  • the VMM 110B creates a DMAR table 502 obtained by converting the DMAR table 520 in the GPA 21 space into the HPA space.
  • the address conversion table 500C6 of the DMAR table 520 is converted into the address conversion table 500C5 using the EPT 902 that performs conversion from the GPA 21 to the HPA.
  • the address conversion table 500C5 is configured to convert the area of 0 to 2 GB of the GPA 21 to the area of 6 GB to 8 GB of the HPA and deny access to other areas.
  • the VMM 110B changes the entry corresponding to the I / O device 801 in the DMAR table 500 to refer to the address conversion table 500C5 of the DMAR table 502.
  • the VM 110B reflects the WP setting of the memory area in which the DMAR table 520 is created in the EPT 902 so that the guest OS 140 can detect that the DMAR table 520 has been updated.
  • the VMM 110B executes a VM-Entry instruction to return the processing to the guest OS 140.
  • the DMAR-HW 200 is initialized by the guest OS 140 on the VM 121.
  • the address conversion table 500C8 in the DMAR table 520 is a setting indicating that only the address range 4 GB to 6 GB of the GPA 21 can be accessed.
  • the guest OS 140 creates the address conversion table 500C8 and updates the address conversion table 500C8 so that the entry corresponding to the I / O device 801 in the DMAR table 520 is referred to.
  • VM-Exit is generated by this update.
  • the process proceeds without being transferred to the VMM 120.
  • the VMM 110B specifies that the entry corresponding to the I / O device 801 in the DMAR table 520 refers to the new address translation table 500C8.
  • an address conversion table 500C7 obtained by converting the address conversion table 500C8 in the GPA 21 space into the HPA space is created, and the entry corresponding to the I / O device 801 in the DMAR table 502 is referred to.
  • the address conversion table 500C7 is also referred to from an entry corresponding to the I / O device 801 in the DMAR table 500. If the address conversion table 500C5 is no longer referred to by any entry, it may be deleted. Then, the WP setting of the memory area used by the address conversion table 500C6 is canceled, and the WP setting of the area of the address conversion table 500C8 is newly reflected in the EPT 902.
  • the DMAR table 500 set in the DMAR-HW 200 is updated by the guest OS 140 on the VM 121.
  • the setting of the DMAR table 500 in the DMAR-HW 200 when the VMM 120 deletes the VM 121 will be described.
  • the I / O device 801 assigned to the VM 121 is also released and placed in the management of the VMM 120.
  • the entry corresponding to the I / O device 801 in the DMAR table 510 managed by the VMM 120 refers to the address translation table 500C4. Therefore, in order to return this reference to the pass-through setting, the entry corresponding to the I / O device 801 in the DMAR table 510 is updated. Since the area of the DMAR table 510 is WP, a VM-Exit is generated by this update.
  • the VMM 110B makes the entry corresponding to the I / O device 801 in the DMAR table 500 refer again to the address conversion table 500C1 that performs GPA11-HPA conversion. If the address conversion table 500C3 is not referred to by any entry, it may be deleted. Then, it is reflected in the EPT 901 so as to release the WP of the memory area used by the address conversion table 500C4. Further, the DMAR table 502 is not referred to from the DMAR table 500 and may be deleted. Further, the WP setting of the memory area used by the DMAR table 520 is reflected to the EPT 902 so as to be released.
  • the DMAR table 500 is updated when the VM 121 is deleted.
  • the hardware resources of the information processing apparatus 102 according to the third embodiment are the same as those of the information processing apparatus 101 according to the second embodiment.
  • three layers of virtualization are configured.
  • the VMM 130 is present on the VM 121
  • the VM 131 is further constructed on the VMM 130
  • the guest OS 140 is operating on the VM 131.
  • a vCPU 431 and a v memory 331 are allocated to the VM 131, and an I / O device 801 is also directly allocated.
  • the VM 131 is provided with vDAR-HW231.
  • a memory space in which the guest OS 140 operates is GPA3.
  • FIG. 33 shows the DMAR table and EPT stored in the memory 300 in the configuration of FIG.
  • the memory 300 is different from the memory 300 configuration in the first embodiment shown in FIG. 17 in that a part of the area allocated to the v memory 321 is allocated to the v memory 331. Further, the GPA3-based DMAR table 530 created by the guest OS 140 is stored in the area allocated to the v memory 331. The memory 300 also stores a DMAR table 503 obtained by converting the DMAR table 530 into an HPA standard. Further, the memory 300 stores an EPT 903 which is a conversion table between GPA3 and HPA.
  • the VMM 110C includes a VM-Exit handler 10C and a DMAR virtualization unit 11C.
  • the DMAR virtualization unit 11C includes a GPA # nDMAR table acquisition unit 17C, a GPA # n-HPA conversion unit 18C, a WP setting unit 14, a DMAR table creation unit 15, and a host DMAR table update unit 16.
  • FIG. 35 shows a processing flow by the VM-Exit handler 10C.
  • FIG. 36 shows a VM-Exit processing flow from the VMM 120 in the processing flow by the VM-Exit handler 10C.
  • FIG. 37 shows the VM-Exit processing flow from the VMM 130 in the processing flow by the VM-Exit handler 10C.
  • FIG. 38 shows a flow of the DMAR virtualization process C by the DMAR virtualization unit 11C. Note that the same processing as the DMAR-HW nesting virtualization processing in the first embodiment shown in FIGS. 20 and 21 is denoted by the same reference numeral, and detailed description thereof is omitted.
  • step S1 of the processing flow of the VM-Exit handler 10C shown in FIG. 35 the VM-Exit handler 10C captures the VM-Exit from the guest OS 140, the VMM 120, or the VMM 130. Then, the VM-Exit handler 10C specifies the VM-Exit factor of the captured VM-Exit.
  • step S2 the VM-Exit handler 10C determines whether or not the captured VM-Exit is a VM-Exit from the guest OS 140. In the case of VM-Exit from the guest OS 140, the process proceeds to step S53, and in the case of VM-Exit from the VMM 120 or VMM 130, the process proceeds to step S3.
  • step S53 the VM-Exit handler 10C determines whether or not the VM-Exit factor determined in step S1 is the setting in the vDAR-HW 231 by the guest OS 140. In the case of setting to vDMAR-HW231, in order to continue the processing in the VMM 110C, the process proceeds to step S20C, and in the case of not setting to vDMAR-HW231, the process proceeds to step S54.
  • step S54 the VM-Exit handler 10C determines whether or not the VM-Exit factor determined in step S1 is an update of the WP-set DMAR table 530 by the guest OS 140. In the case of updating the DMAR table 530, the process proceeds to step S20C in order to continue the processing in the VMM 110C, and in the case of not updating the DMAR table 530, the process proceeds to step S55.
  • step S20C the VM-Exit handler 10C executes processing (2C) for each VM-Exit factor.
  • the process (2C) for each VM-Exit factor is the same as the process (1) for each VM-Exit factor shown in FIG.
  • “setting to vDMAR-HW211” in step S31 is read as “setting to vDMAR-HW231”.
  • “update of WP-set DMAR table 510” in step S32 is read as “update of WP-set DMAR table 530”.
  • “DMAC virtualization processing” in step S100 is replaced with “DMAC virtualization processing C”.
  • step S3 the VM-Exit handler 10C determines whether the trapped VM-Exit is a VM-Exit from the VMM 120 or not. In the case of the VM-Exit from the VMM 120, the process proceeds to step S80, and the VM-Exit process from the VMM 120 shown in FIG. 36 is executed. In the case of the VM-Exit from the VMM 130, the process proceeds to step S90, and the VM-Exit process from the VMM 130 shown in FIG. 37 is executed.
  • step S10 of the VM-Exit process from the VMM 120 the VM-Exit handler 10C determines whether or not the VM-Exit factor specified in step S1 is a VM-Entry instruction.
  • the VM-Exit handler 10 performs various settings for transferring processing to the VMM 130 in the VMCS.
  • step S42 the VM-Exit handler 10C performs VM-Entry to the VMM 130 in order to transfer the processing to the VMM 130, and returns to the processing of the VM-Exit handler 10C shown in FIG.
  • step S10 determines in step S10 that the VM-Exit factor is not a VM-Entry instruction
  • the process proceeds to step S30, and the processing (1) for each VM-Exit factor shown in FIG. Execute.
  • “DMA virtualization processing” in step S100 is replaced with “DMAC virtualization processing C”.
  • step S62 the VM-Exit handler 10C performs VM-Entry to the VMM 120 in order to transfer the processing to the VMM 120, and returns to the processing of the VM-Exit handler 10C shown in FIG.
  • step S10 of the VM-Exit process from the VMM 130 shown in FIG. 37 the VM-Exit handler 10C determines whether or not the VM-Exit factor specified in step S1 is a VM-Entry instruction. If the VM-Exit factor is a VM-Entry instruction, in step S21, the VM-Exit handler 10C performs various settings for transferring processing to the guest OS 140 to the VMCS. Next, in step S22, the VM-Exit handler 10C performs VM-Entry to the guest OS 140 in order to transfer the processing to the guest OS 140, and returns to the processing of the VM-Exit handler 10C shown in FIG.
  • step S10 determines in step S10 that the VM-Exit factor is not a VM-Entry instruction
  • the process proceeds to step S55.
  • step S55 the VM-Exit handler 10C determines whether the processing according to the VM-Exit factor is performed as it is by the VMM 110C or left to the VMM 120.
  • the process proceeds to step S40, and when processing is performed by the VMM 120, the process proceeds to step S61.
  • step S61 the VM-Exit handler 10C performs various settings in the VMCS for transferring processing to the VMM 120.
  • step S62 the VM-Exit handler 10C performs VM-Entry to the VMM 120 in order to transfer the processing to the VMM 120, and returns to the processing of the VM-Exit handler 10C shown in FIG.
  • step S40 the VM-Exit handler 10C executes the process (3) for each VM-Exit factor.
  • the process (3) for each VM-Exit factor is the same as the process (1) for each VM-Exit factor shown in FIG.
  • “setting to DMAR-HW 211” in step S31 is read as “setting to DMAR-HW 221”.
  • “update the WP-set DMAR table 510” in step S32 is read as “update the WP-set DMAR table 520”.
  • “DMAC virtualization processing” in step S100 is replaced with “DMAC virtualization processing C”.
  • step S42 the VM-Exit handler 10C performs VM-Entry to the VMM 130 in order to transfer the processing to the VMM 130, and returns to the processing of the VM-Exit handler 10C shown in FIG.
  • the VM-Exit handler 10C determines whether the VM-Exit factor is set to the vDAR-HW 231 by the guest OS 140 or the WR-set DMAR table 530 is updated. Determine whether or not. If the determination is affirmative, the process proceeds to step S141. If the determination is negative, the process proceeds to step S120.
  • step S141 the GPA # nDMAR table acquisition unit 17C acquires the DMAR table 530 created by the guest OS 140.
  • the DMAR table 530 is created based on the GPA3 standard. Therefore, in the next step S142, the DMAR table creation unit 15 creates a DMAR table 503 obtained by converting the GPA3-based DMAR table 520 into the HPA standard using the GPA # n-HPA conversion unit 18C.
  • step S143 the host DMAR table update unit 16 updates the setting for the I / O device 801 in the DMAR table 500 with the contents of the DMAR table 503.
  • step S144 the WP setting unit 14 sets the WP setting of the memory area in which the DMAR table 530 is stored, and performs the GPA3-HPA conversion of the CPU 400 so that the update of the DMAR table 530 by the guest OS 140 can be detected. To reflect.
  • the VM-Exit handler 10C determines whether the VM-Exit factor is the setting to the vDAR-HW 221 by the VMM 130 or the update of the DMAR table 520 in which the WR is set. If the determination is affirmative, the process proceeds to step S121, and if the VM-Exit factor is the setting to the vDAR-HW 211 by the VMM 120 or the update of the DMAR table 510 in which the WR is set, the determination is negative, and the process proceeds to step S131. .
  • steps S121 to S124 and 131 to 134 are executed, and the process returns to the process of the VM-Exit handler 10C shown in FIG.
  • FIG. 39 shows a transition between the non-privileged mode and the privileged mode in the DMAR-HW nested virtualization process in the third embodiment.
  • an I / O device 801 is assigned to the guest OS 140, and the guest OS 140 performs settings for the I / O device 801 in the vDAR-HW 231.
  • the VM-Exit from the non-privileged mode to the privileged mode is indicated by a one-dot chain line arrow
  • the VM-Entry from the privileged mode to the non-privileged mode is indicated by a two-dot chain line arrow.
  • the transition between the non-privileged mode and the privileged mode in the third embodiment is the same as the transition between the non-privileged mode and the privileged mode in the first embodiment shown in FIG.
  • the disclosed technology can be similarly applied.
  • the setting or update of the GPA # n-based DMAR table by the upper guest OS is detected. If these are detected, the DMAR table created based on the GPA # n standard may be converted into the HPA standard DMAR table by the VMM of the first layer without moving the processing to the higher-order VMM.
  • VT-x and VT-d of Intel have been described as examples of the virtualization support mechanism of the CPU and the virtualization support mechanism of the DMAR-HW.
  • the present invention is not limited to this. Any CPU virtualization support mechanism may be used as long as the CPU operates in a privileged mode and a non-privileged mode.
  • the DMAR-HW virtualization support mechanism may be a mechanism that performs DMA using a conversion table.
  • the mode in which the information processing program 50 as an example of the information processing program in the disclosed technology is stored (installed) in the storage unit 600 in advance has been described.
  • the information processing program in the disclosed technology can be provided in a form recorded on a recording medium such as a CD-ROM or a DVD-ROM.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

 入れ子の仮想化環境におけるゲストプログラムに、DMAR-HWを提供する際の仮想化を高速化する。第1層VMM、第1層VM、第2層VMM、第2層VMを含む入れ子の仮想化環境で、VM-Exitハンドラが、第1層VM上で動作するゲストOSからのVM-Exitを捕捉する。VM-Exitハンドラは、VM-Exit要因を特定する。VM-Exit要因が、ゲストOSによるvDMAR-HWへのDMARテーブルの設定または更新の場合には、第2層VMMへ処理を移すことなく、第1層VMMでVM-Exit要因に応じた処理を実行する。DMAR仮想化部は、ゲストOSが作成したDMARテーブルを取得し、ゲストOSのゲストメモリ空間をホストメモリ空間に変換したDMARテーブルを作成し、DMAR-HWに設定する。

Description

情報処理装置、方法、及びプログラム
 開示の技術は、情報処理装置、情報処理方法、及び情報処理プログラムに関する。
 近年、コンピュータ上に仮想的なコンピュータ(仮想マシン)を構築する仮想化技術において、入れ子の仮想化技術が提案されている。入れ子の仮想化技術とは、仮想マシン上で仮想マシンを動かす仮想化技術であり、例えば、BIOS(Basic Input Output System)が仮想マシンを立ち上げる。そして、その仮想マシン上でXen(登録商標)などの既存の仮想化ソフト(仮想マシンモニタ)を動かすような技術である。
 また、仮想マシンを構築する仮想マシンモニタは、基本的にはソフトウェアによる処理を行っているが、仮想マシンモニタの処理の一部をハードウェアにより担う仮想化支援機構を利用した仮想マシンモニタも存在する。
 さらに、上記の入れ子の仮想化技術における第2層の仮想化に対して、ハードウェアによる仮想化支援機構を仮想化して提供する技術が提案されている。例えば、仮想化支援機構を備えたCPUが、通常モードと仮想化支援機構を提供するモードとで動作する仮想化技術が提案されている。この技術では、仮想化支援機構を提供するモードでは、ホストVMM(Virtual Machine Monitor)が、ゲストOS(Operating System)を監視する。そして、CPUの動作モードを、ホストVMMが動作するホストモードと、ゲストVMMまたはユーザプログラムが動作するユーザモードとに切り替える。そして、所定の条件でホストVMMがゲストVMM及びゲストOSの命令をエミュレートする。これにより、ゲストOSが稼働する仮想マシンに割り当てられた仮想CPUが、ゲストOSに対して、仮想化支援機構を提供するように見せかける。
 また、仮想マシンに割り当てられたI/O(Input/Output)デバイス(入出力装置)がメモリ空間へアクセスすることをDMA(Direct Memory Access)という。このI/OデバイスによるDMAのアドレス変換を行う仮想化支援機構として、DMAR(DMA Remapping)という技術が提案されている。このDMARの仮想化支援機構を提供するハードウェアをDMAR-HW(hardware)という。
特開2009-3749号公報
「Intel Virtualization Technology for Directed I/O Architecture Specification」、[online]、Intel corp.発行、[平成25年3月19日検索]、インターネット<URL:http://software.intel.com/en-us/articles/intel-virtualization-technology-for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-of-io-devices>
 従来技術のDMAR-HWのような入出力装置のDMAのアドレス変換を行うハードウェアによる変換機構は、1階層の仮想化のみに対応している。従って、入れ子の仮想化技術における第2層より上位の仮想マシンモニタやゲストプログラムでは使用できない、という問題がある。
 上述の入れ子の仮想化における第2層の仮想化に仮想化支援機構を提供する従来技術を、DMAR-HWの仮想化に対して適用することも考えられる。しかし、処理が煩雑であるため、オーバヘッドが大きくなり、ゲストプログラムに提供するためのDMAR-HWの仮想化に時間を要する、という問題がある。
 開示の技術は、一つの側面として、入れ子の仮想化環境におけるゲストプログラムに、入出力装置によるDMAのアドレス変換を行うハードウェアによる変換機構を提供する際の仮想化を高速化することが目的である。
 開示の技術は、入れ子の仮想化環境において、ゲストプログラムの処理で発生した非特権モードから特権モードへの遷移の要因を特定する特定部を備えている。入れ子の仮想化環境とは、第1層の仮想マシンモニタにより構築された仮想マシン上で動作する上位仮想マシンモニタにより上位仮想マシンが構築された仮想化環境である。また、前記第1層の仮想マシンモニタが特権モードで動作し、前記上位仮想マシンモニタ及び前記上位仮想マシン上のゲストプログラムが非特権モードで動作する。また、開示の技術は、前記特定部により特定された要因が、仮想変換テーブルの設定または更新の場合に、変換機構で用いる変換テーブルを設定する設定部を備えている。仮想変換テーブルは、前記上位仮想マシンに割り当てられた入出力装置によるDMAのアドレス変換を設定された変換テーブルを用いて行うハードウェアの変換機構を仮想化して前記ゲストプログラムに提供される仮想変換機構で用いる。設定部は、前記仮想変換テーブル、及び前記ゲストプログラムが動作するゲストメモリ空間と前記第1層の仮想マシンモニタが動作するホストメモリ空間との対応関係に基づいて、前記変換機構で用いる前記変換テーブルを設定する。
 開示の技術は、一つの側面として、入れ子の仮想化環境におけるゲストプログラムに、入出力装置によるDMAのアドレス変換を行うハードウェアによる変換機構を提供する際の仮想化を高速化することができる、という効果を有する。
DMAR-HWによるアドレス変換を示す概略図である。 DMARテーブルの一例を示す図である。 DMAR-HWの仮想化の概略を示す構成図である。 HPAとGPAとにおけるDMARテーブルの関係を示す図である。 DMARテーブルの更新を説明するための図である。 入れ子の仮想化構成でのCPUの仮想化支援機構の概略を示す構成図である。 比較例の概略を示す構成図である。 比較例のメモリ構成を示す概略図である。 比較例におけるVMMの機能ブロック図である。 比較例におけるVM-Exitハンドラの処理を示すフローチャートである。 比較例におけるVM-Exit要因毎の処理を示すフローチャートである。 比較例におけるDMAR仮想化処理を示すフローチャートである。 比較例における非特権モードと特権モードとの遷移を説明するための図である。 比較例におけるHPAとGPA1とGPA2とにおけるDMARテーブルの関係を示す図である。 開示の技術の概要を示す図である。 第1実施形態の構成を示す概略図である。 第1実施形態におけるVMMの機能ブロック図である。 第1実施形態のメモリ構成を示す概略図である。 情報処理装置として機能するサーバの一例を示す概略ブロック図である。 第1実施形態におけるVM-Exitハンドラの処理を示すフローチャートである。 第1実施形態におけるDMAR仮想化処理を示すフローチャートである。 第1実施形態における非特権モードと特権モードとの遷移を説明するための図である。 第1実施形態におけるHPAとGPA1とGPA2とにおけるDMARテーブルの関係を示す図である。 第2実施形態の構成を示す概略図である。 第2実施形態におけるメモリの割り当てを示す図である。 第2実施形態のメモリ構成を示す概略図である。 第2実施形態におけるDMARテーブルを示す図である。 第2実施形態におけるDMARテーブルの設定を示す図である。 第2実施形態におけるDMARテーブルの設定を示す図である。 第2実施形態におけるDMARテーブルの更新を示す図である。 第2実施形態におけるDMARテーブルの設定の削除を示す図である。 第3実施形態の構成を示す概略図である。 第3実施形態のメモリ構成を示す概略図である。 第3実施形態におけるVMMの機能ブロック図である。 第3実施形態におけるVM-Exitハンドラの処理を示すフローチャートである。 第3実施形態におけるVMM120からのVM-Exit処理を示すフローチャートである。 第3実施形態におけるVMM130からのVM-Exit処理を示すフローチャートである。 第3実施形態におけるDMAR仮想化処理を示すフローチャートである。 第3実施形態における非特権モードと特権モードとの遷移を説明するための図である。
 まず、第1実施形態の詳細を説明する前に、従来の入れ子の仮想化技術と、従来のDMAR-HW(Direct Memory Access Remapping - hardware)の仮想化技術とをそのまま組み合わせた場合の問題点を、以下の各項目に従って説明する。
<DMAR-HWの概要>
 仮想マシンモニタ(VMM:Virtual Machine Monitor)により構築された仮想マシン(VM:Virtual Machine)上のゲストOS(Operating System)は、使用するI/O(Input/Output)デバイスにゲストメモリ空間上のメモリリソースを割り当てる。I/Oデバイスがこの割り当てられたメモリリソースへアクセスする際には、ゲストメモリ空間上のアドレス(GPA:Guest Physical Address)からホストメモリ空間上のアドレス(HPA:Host Physical Address)へ変換する必要がある。この変換を行うのがDMARであり、DMARを行うハードウェアをDMAR-HWという。
 例えば、図1に示すように、I/Oデバイス801、802にゲストメモリ空間の0~2GBの領域が割り当てられており、このゲストメモリ空間の0~2GBの領域が、ホストメモリ空間の4GB~6GBの領域に対応するとする。I/Oデバイス801または802が、ゲストメモリ空間の0~2GBの領域内のアドレスにアクセスする。すると、I/Oデバイスがアクセスしたゲストメモリ空間のアドレス(GPA)が、DMAR-HW200により、ホストメモリ空間のアドレス(HPA)に変換される。
 I/Oデバイスがアクセスしたアドレスを、GPAからHPAへ変換するためには、どのような変換を行うかを示した変換表(DMARテーブル)を、DMAR-HW200に設定しておく必要がある。この変換表は、メモリ上に作成されて、その先頭のアドレスがDMAR-HW200のレジスタに設定される。
 例えば、インテル(登録商標)のDMAR-HWによる仮想化支援機構であるVT-dにおけるDMARテーブル500の構成例を、図2に示す。図2の例では、DMAR-HW200のレジスタは、メモリ上の特定の領域にマップされている。DMARテーブル500へのI/Oデバイスに対応したエントリは、バス番号(Bus)、デバイス番号(Dev)、及びファンクション番号(Fun)を含む。DMARテーブル500は階層構造になっており、第1階層のルートエントリテーブル500AでI/Oデバイスのバス番号を分類し、第2階層のコンテキストエントリテーブル500BでI/Oデバイスのデバイス番号及びファンクション番号を分類する。第3階層以降はアドレス変換テーブル500Cと呼ばれ、I/OデバイスがアクセスするGPAをHPAに変換するための変換方法が設定されている。複数のI/Oデバイスで同じ変換方法を適用する場合には、アドレス変換テーブルを共有して使用することが可能である。
 すなわち、DMARテーブル500は、I/Oデバイスに対応したエントリと、GPA-HPAの変換方法との対応付けを定めるものである。
 DMAR-HWが、このような変換表を用いてGPAをHPAに変換することにより、VM上で動作するゲストOSに、直接I/Oデバイスを割り当てることができる。
 なお、DMAR-HWは、VMM以外の通常のOSにも使用することができる。例えば、特定のメモリ領域を保護したい場合に、I/Oデバイスからその領域へのDMAができないようにDMARテーブルを設定すればよい。
<DMAR-HWの仮想化>
 VM上で動作するゲストOSがDMAR-HWを使用できるように、VMMはDMAR-HWを仮想化してゲストOSに提供する必要がある。この仮想化には、例えば、インテル(登録商標)VT-xのようなCPUの仮想化支援機構を利用することができる。
 図3に、情報処理装置151で実現されるDMAR-HWの仮想化の一例を示す。情報処理装置151は、ハードウェアリソースであるCPU400、メモリ300、DMAR-HW200、及びI/Oデバイス801、802を備えている。CPU400は、例えばインテル(登録商標)VT-xのようなハードウェアによる仮想化支援機構490を備えている。情報処理装置151において、VMM110を動作させ、VM111、112を構築し、VM111上でゲストOS140を動作させている。
 VMM110は、VM-Exitハンドラ10と、DMAR仮想化部11とを備えている。DMAR仮想化部11は、DMAR-HW200を仮想化してVM111に提供し、v(virtual)DMAR-HW211としてゲストOS140に見せる。同様に、VM112には、vDMAR-HW212が提供される。また、DMAR仮想化部11は、ゲストOS140によるvDMAR-HW211のレジスタへのアクセスを監視する。DMAR-HW200のレジスタは、メモリ空間の特定のアドレスにマップされているので、DMAR仮想化部11は、vDMAR-HW211のレジスタも同じ位置にマップされているようにゲストOS140に見せる。ゲストOS140がそのマップされたレジスタにアクセスした場合に、例外が発生するようにCPU400の仮想化支援機構490へ設定する。VM Exitハンドラ10は、例外が発生した場合に、その要因を特定し、それがゲストOS140によるそのマップされたレジスタへのアクセスである場合に、DMAR仮想化部11を呼び出す。
 DMAR仮想化部11は、ゲストOS140がvDMAR-HW211のレジスタに設定しようとしたアドレスから、ゲストOS140が作成したDMARテーブル510の場所を特定する。DMARテーブル510は、VMM110により割り当てられたI/OデバイスをゲストOS140が初期化する際に、vDMAR-HW211へ設定されるDMARテーブルである。DMARテーブル510は、ゲストOS140により、GPA上に作成されており、I/Oデバイスに割り当てられたGPA空間上の領域に関する設定が含まれる。VMM110は、VMM110が管理するGPA空間からHPA空間へのアドレス変換方法に基づいて、DMARテーブル510の内容をHPA空間上へ変換したDMARテーブル501を作成する。
 DMAR-HW200には、予めDMARテーブル500が設定される。例えば、VM111へI/Oデバイス801が割り振られ、VM112へI/Oデバイス802が割り振られているとする。この場合、DMARテーブル500には、VM111へ割り振られたI/Oデバイス801のDMAを変換する設定と、VM112へ割り振られたI/Oデバイス802のDMAを変換する設定とが含まれる。
 DMAR仮想化部11は、DMARテーブル500の内、ゲストOS140が動作するVM111に割り振られたI/Oデバイス801に関する設定を、DMARテーブル501の内容で更新する。なお、DMARテーブルの更新方法については、後述する。
 また、DMAR仮想化部11は、CPU400の仮想化支援機構490を使用して、DMARテーブル510の置かれた領域をWP(Write Protect)に設定する。これはゲストOS140によるDMARテーブル510の更新を検出するためである。DMARテーブル510の更新を検出した場合には、その更新内容をDMARテーブル501へ反映するようにエミュレーションすることも可能である。
 図4に、図3に示すDMAR-HWの仮想化でのHPAとGPAとにおけるDMARテーブルの関係を示す。図4の例では、HPAのアドレス範囲4GB~6GBが、GPAの0GB~2GBとして割り当てられている。ゲストOS140により、GPA上に作成されたDMARテーブル510には、GPAのアドレス範囲1GB~2GBがI/Oデバイス801に割り当てられた領域であるとの設定が含まれる。DMARテーブル510をHPA上に変換したものがDMARテーブル501であり、DMARテーブル501には、HPAのアドレス範囲5GB~6GBがI/Oデバイス801に割り当てられた領域であるとの設定が含まれる。このように変換されたDMARテーブル501に基づいて、予め設定されていた(初期状態の)DMARテーブル500を更新する。
<DMARテーブルの更新>
 図5に、DMARテーブル500の更新の一例を示す。例えばI/Oデバイス801に対応するエントリが、バス番号(Bus)N、デバイス番号(Dev)i、及びファンクション番号(Fun)jであるとする。バス番号Nは、ルートエントリテーブル500AのRoot entry Nに該当し、デバイス番号i及びファンクション番号jは、Root entry Nに対応するコンテキストエントリテーブル500BのContext entry Mに該当するものとする。初期状態のDMARテーブル500では、このエントリがアドレス変換テーブル500C1を参照していたとする。この場合、DMARテーブル501の一部で、ゲストOS140がI/Oデバイス801に与えた設定をHPA上へ変換したものがアドレス変換テーブル500C2であるとする。DMARテーブル500の更新は、Root entry N及びContext entry Mのエントリ、すなわちI/Oデバイス800のエントリの参照を、アドレス変換テーブル500C1からアドレス変換テーブル500C2へ変更することで行われる。
<入れ子の仮想化構成でのCPUの仮想化支援機構の動作>
 例えばインテル(登録商標)のCPUの仮想化支援機構であるVT-xでは、CPUに特権モードと非特権モードという2つの動作モードを与えている。CPUが非特権モードにあるときには、使用可能な機能が限られており、特権命令の実行などの許されていない処理を行うと、例外が発生し、特権モードへ遷移する。一方、CPUが特権モードにあるときは、全ての特権命令を実行することが可能であり、非特権モードで起きた例外を監視及び捕捉する役割を持つ。CPUの動作モードが、特権モードから非特権モードへ遷移することをVM-Entryといい、非特権モードから特権モードへ遷移することをVM-Exitという。
 図6に、情報処理装置152で実現される入れ子の仮想化の一例を示す。なお、図3に示す従来技術のDMAR-HWの仮想化の例と同一の部分については、同一符号を付して、詳細な説明を省略する。
 情報処理装置152は、ハードウェアリソースであるCPU400及びメモリ300を備えている。情報処理装置152において、第1層のVMM110を動作させ、第1層のVM111を構築している。さらに、VM111上で第2層のVMM120を動作させ、第2層のVM121を構築し、VM121上でゲストOS140を動作させている。VMM110は特権モードで動作し、VMM120及びゲストOS140は非特権モードで動作する。なお、VMM110が動作するホストメモリ空間をHPA、VMM120が動作するゲストメモリ空間をGPA1、及びゲストOS140が動作するゲストメモリ空間をGPA2とする。
 また、VM111には、v(virtual)メモリ310及びv(virtual)CPU410が割り当てられている。また、VM121には、v(virtual)メモリ320及びv(virtual)CPU420が割り当てられている。
 図3の場合と同様、CPU400は、例えばインテル(登録商標)VT-xのようなハードウェアによる仮想化支援機構490を備えている。VT-xでは、VMCS(Virtual Machine Control Structure)というCPUの状態を保持する領域をメモリ上に作成し、VMCSのアドレスを仮想化支援機構490に参照させて、CPU400の状態(特権モード、非特権モード等)を管理する。
 VMCS700は、特権モードで動作するホストの状態を保持するホスト状態保持部701、非特権モードで動作するゲストの状態を保持するゲスト状態保持部702、及びその他の設定や状態などの制御情報を保持する制御情報保持部703を備えている。
 特権モードから非特権モードへの遷移であるVM-Entryが発生すると、ホスト上のCPU400の状態がホスト状態保持部701へ保持され、ゲスト状態保持部702に保持されていた内容がCPU400にロードされる。一方、非特権モードから特権モードへの遷移であるVM-Exitが発生すると、ゲストのCPU(vCPU410)の状態がゲスト状態保持部702に保持されて、ホスト状態保持部701に保持されていた内容がCPU400にロードされる。また、制御情報保持部703へは、例えばどういった要因でVM-Exitさせるかといった設定や、実際にVM-Exitした場合の要因の特定、後述するCPUのGPA-HPA変換を行うEPT(Extended Page Table)の設定などを行う。
 入れ子の仮想化では、VM111に割り当てられたvCPU410の状態を保持するためのv(virtual)VMCS710が存在する。vVMCS710は、VM111に割り当てられたvメモリ310に設けられ、VMCS700と同様に、ホスト状態保持部711、ゲスト状態保持部712、及び制御情報保持部713を備えている。vVMCS710のホスト状態保持部711には、VMM120を動作させているvCPU410の状態が、ゲスト状態保持部712には、ゲストOS140を動作させているvCPU420の状態が格納される。
 また、メモリ300には、VMCS700の退避領域であるVMCS-C(Copy)600も置かれる。VMCS-C600も、VMCS700と同様に、ホスト状態保持部601、ゲスト状態保持部602、及び制御情報保持部603を備えている。VMCS-C600の使い方については、後述する。
 VMCSに対して読み書きを実行する場合には、特権命令であるVMREAD命令やVMWRITE命令を使用する。例えば、第2層のVMM120がvVMCS710のゲスト状態保持部712へゲストOS140を動作させるための設定を行いたい場合は、VMWRITE命令を実行する。しかし特権命令であるVMWRITE命令を、非特権モードで動作しているVMM120が実行しようとすると、例外が発生し、VM-ExitしてVMM110へ処理が移る。VMM110は、VM-Exitした要因(以下、「VM-Exit要因」という)がVMWRITE命令の実行であることを特定する。そして、VMWRITE命令で書かれようとした内容をvVMCS710のゲスト状態保持部712へ反映し、VM-Entryして、VMM120へ処理を戻す。
 VMM120へ処理が戻ると、VMM120では、ゲストOS140へ処理を移すために、VM-Entry命令を実行する。しかし非特権モードで動作しているVMM120が、特権命令であるVM-Entry命令を実行しようとすると、例外が発生し、VMM110へVM-Exitする。
 VMM110は、VM-Exit要因がVM-Entry命令の実行であることを特定すると、VMCS700のゲスト状態保持部702に保持されているvCPU410の状態をvVMCS710のホスト状態保持部711へコピーする。そして、vVMCS710のゲスト状態保持部712に保持されているvCPU420の状態をVMCS700のゲスト状態保持部702へ設定する。
 次に、VMCS700の制御情報保持部703に保持されているVMM120を監視及び制御していた設定を、VMCS-C600の制御情報保持部603へ退避する。そして、ゲストOS140を監視及び制御するための設定を、VMCS700の制御情報保持部703へ行う。この設定は、VMCS-C600の制御情報保持部603に保持されたVMM110がVMM120を監視及び制御するための設定と、vVMCS710の制御情報保持部713に保持されたVMM120がゲストOS140を監視及び制御するための設定とから作成される。
 VMM110がゲストOS140を監視及び制御するための設定を、VMM110がVMM120を監視及び制御するための設定とVMM120がゲストOS140を監視及び制御するための設定とを組み合わせて作成する理由を説明する。例えば、VMM110が特定のハードウェアリソースを仮想化して、VMM120に見せていたとする。VMM110は、このハードウェアリソースをエミュレーションするために、VMM120がハードウェアリソースにアクセスしたら、VM-Exitするように、VMCS700の制御情報保持部703を設定する。一方、VMM120は、このハードウェアリソースを仮想化せずにそのままゲストOS140に見せるとする。すると、vVMCS710の制御情報保持部713には、ゲストOS140がこのハードウェアリソースにアクセスしてもVM-Exitするような設定はされない。しかし、実際にゲストOS140を監視及び制御するのはVMM110であるため、ゲストOS140がこのハードウェアリソースにアクセスしたら、VM-Exitするように設定する必要がある。そのため、VMM110がVMM120を監視及び制御するための設定と、VMM120がゲストOS140を監視及び制御するための設定とから、VMM110がゲストOS140を監視及び制御するための設定を作成することになる。
 以上の処理が終わると、VMM110は、VM-Entry命令を実行し、ゲストOS140へ処理を移す。
 逆に、ゲストOS140で例外が発生してVM-Exitすると、VMM110へ処理が戻る。VMM110は、VM-Exit要因を特定し、vVMCS710の制御情報保持部713に、VMM120で処理するVM-Exit要因として設定されたVM-Exit要因と照合する。VMM120で処理するVM-Exit要因であった場合には、処理をVMM120へ移して、VMM120に例外(VM-Exit要因に応じた処理)を処理させる。
 VMM120へ例外を渡すために、ゲスト状態保持部702に保持されているvCPU420の状態をvVMCS710のゲスト状態保持部712へコピーする。そして、vVMCS710のホスト状態保持部711に保持されたvCPU410の状態を、VMCS700のゲスト状態保持部702へ設定する。制御情報保持部603に退避していた設定、及びVM-Exitに関する情報を、VMCS700の制御情報保持部703へ設定する。最後に、VM-Entry命令を実行して、VMM120へ処理を移す。
 VMM120は、VMM110からのVM-Entryにより、ゲストOS140からVM-Exitした処理が移されたと判断し、そのVM-Exit要因に応じた処理を行う。その処理が完了すると、処理をゲストOS140へ戻すためのvVMCS710の設定及びVM-Entry命令の実行を行う。これらは既に説明したように、VMM110によるエミュレーションによってなされる。
 このように第2層のVMM120とゲストOS140との間の状態遷移は、一度、第1層のVMM110を経由することで行われる。
<CPUのGPA-HPA変換>
 CPUの仮想化支援機構には、CPUによるメモリアクセスのためのGPA-HPA変換機能が用意されている。CPUのGPA-HPA変換は、DMARと同様に、変換テーブルを用いて行われる。この変換テーブルは、GPA-HPA変換の他に、GPAの特定の領域をWPに設定するなどのメモリ属性の設定も行える。例えばインテル(登録商標)のCPUの仮想化支援機構であるVT-xでは、この変換テーブルをEPT(Extended Page Table)と呼ぶ。VMCS700の制御情報保持部703には、このEPTを登録する場所が用意されている。
 VMM110がVM111を動かす場合には、VM111のゲストメモリ空間のアドレスGPA1とホストメモリ空間のアドレスHPAとの変換テーブルであるEPT901を作成して、VMCS700の制御情報保持部703に設定する。一方、VMM120がVM121を動かす場合には、VM121のゲストメモリ空間のアドレスGPA2とVMM120のゲストメモリ空間GPA1との変換テーブルであるEPT912を作成して、vVMCS710の制御情報保持部713に設定する。
 VMM110は、GPA1-HPAの変換テーブルであるEPT901と、GPA2-GPA1の変換テーブルであるEPT912とから、GPA2-HPAの変換テーブルであるEPT902を作成することが可能である。つまり、EPT902は、VMM110からゲストOS140へVM-Entryする際に、制御情報保持部703に設定される変換テーブルとなる。
<DMAR-HWの入れ子の仮想化>
 前述した1階層でのDMAR-HWの仮想化とCPUの仮想化支援機構の入れ子の仮想化とを組み合わせることにより、DMAR-HWの入れ子の仮想化を実現できる。
 図7に、従来技術の入れ子の仮想化とDMAR-HWの仮想化とをそのまま組み合わせた場合のDMAR-HWの入れ子の仮想化の一例を示す。なお、図3に示す従来技術のDMAR-HWの仮想化、及び図6に示す入れ子の仮想化の例と同一の部分については、同一符号を付して、詳細な説明を省略する。以下、図7に示す構成を比較例という。
 図7の比較例に係る情報処理装置150は、ハードウェアリソースであるCPU400、メモリ300、DMAR-HW200、及びI/Oデバイス801、802を備えている。情報処理装置150において、第1層のVMM110を動作させ、第1層のVM111、112を構築している。さらに、VM111上で第2層のVMM120を動作させ、第2層のVM121を構築し、VM121上でゲストOS140を動作させている。なお、VMM110が動作するホストメモリ空間をHPA、VMM120が動作するゲストメモリ空間をGPA1、及びゲストOS140が動作するゲストメモリ空間をGPA2とする。
 また、VM111には、vDMAR-HW211が提供されると共に、vメモリ311及びvCPU410が割り当てられている。また、VM121には、vDMAR-HW221が提供されると共に、vメモリ321及びvCPU420が割り当てられている。
 また、図8に、図7の構成のおけるメモリ300の構成の一例を示す。メモリ300のvメモリ311に割り当てられた領域は、vメモリ321に割り当てられた領域を含む。vメモリ321に割り当てられた領域には、ゲストOS140により作成されたGPA2基準のDMARテーブル520が記憶される。また、vメモリ311に割り当てられた領域には、DMARテーブル520をGPA1基準に変換したDMARテーブル512、VMM120により作成されたGPA1基準のDMARテーブル510が記憶される。さらに、vメモリ311に割り当てられた領域には、vCPU410の状態が保持されるvVMCS710、及びGPA2-GPA1間の変換テーブルであるEPT912が記憶される。また、メモリ300には、VMM110によりHPA基準で作成されたDMARテーブル500、DMARテーブル510をHPA基準に変換したDMARテーブル501、DMARテーブル520をHPA基準に変換したDMARテーブル502が記憶される。また、メモリ300には、CPU400の状態を保持するVMCS700、VMCS700の状態が退避されるVMCS-C600が記憶される。また、メモリ300には、GPA1-HPA間の変換テーブルであるEPT901、及びGPA2-HPA間の変換テーブルであるEPT902が記憶される。
 また、図7に示すように、VMM110は、VM-Exitハンドラ10、及びDMAR仮想化部11を備えている。さらに、DMAR仮想化部11は、図9に示すように、GPA1DMARテーブル取得部12、GPA1-HPA変換部13、WP設定部14、DMARテーブル作成部15、及びホストDMARテーブル更新部16を備えている。なお、VMM120も、同様に、VM-Exitハンドラ20、及びDMAR仮想化機能21を備えており、VMM110のVM-Exitハンドラ10、及びDMAR仮想化部11と同様の機能が提供される。
 VM-Exitハンドラ10は、ゲストOS140またはVMM120からのVM-Exitを捕捉し、VM-Exit要因を特定し、VM-Exit要因に応じた処理を行う。VM-Exit要因に応じた処理とは、例えば、ゲストOS140またはVMM120へVM-Entryする際のVMCSに対する設定などである。また、VM-Exitハンドラ10は、VMM120が、ゲストOS140が作成したDMARテーブル520の領域をWPに設定するために、EPT912を変更した際に、変更内容をEPT902へ反映する。
 GPA1DMARテーブル取得部12は、VMM120が管理するDMARテーブル510及びDMARテーブル512を取得する。GPA1-HPA変換部13は、GPA1をHPAへ変換する。WP設定部14は、DMARテーブル510、512の領域をWPに設定する。DMARテーブル作成部15は、GPA1DMARテーブル取得部12により取得されたDMARテーブルをGPA1-HPA変換したDMARテーブルを作成する。ホストDMARテーブル更新部16は、DMARテーブル作成部15により作成されたDMARテーブルの内容でDMARテーブル500を更新する。
 次に、図10~図12を参照して、比較例におけるDMAR-HWの入れ子の仮想化処理について説明する。図10は、VM-Exitハンドラ10による処理フローを示す。図11は、VM-Exitハンドラ10による処理フロー内のVM-Exit要因毎の処理(1)フローを示す。図12は、DMAR仮想化部11によるDMAR仮想化処理フローを示す。
 図10に示すVM-Exitハンドラ10の処理フローのステップS1で、VM-Exitハンドラ10が、ゲストOS140またはVMM120からのVM-Exitの要因を、VMCS700の制御情報保持部703に仮想化支援機構490により自動で格納されるVM-Exit要因を参照することにより、特定する。例えば、ゲストOS140が、vDMAR-HW221へDMARテーブル520を設定する際には、vDMAR-HW221のレジスタがマップされたアドレスへアクセスする。このアドレスへのアクセスで例外が発生するように、EPT902に予め設定しておく。これにより、VM-Exit要因が特定のアドレスへのアクセス例外である場合に、VMCS700の制御情報保持部703に格納される情報から、例外を起こしたアドレスを取得し、このアドレスがvDMAR-HW221のレジスタがマップされたアドレスに一致すれば、「vDMAR-HW221への設定」と判定することができる。
 次に、ステップS2で、VM-Exitハンドラ10が、捕捉したVM-ExitがゲストOS140からのVM-Exitか、またはVMM120からのVM-Exitかを判定する。ゲストOS140のVM-Exitの場合には、ステップS55へ移行し、VMM120からのVM-Exitの場合には、ステップS10へ移行する。
 ステップS55では、VM-Exitハンドラ10が、VM-Exit要因に応じた処理を、そのままVMM110で行うか、またはVMM120へ任せるか、すなわち処理先を判定する。この判定は、vVMCS710の制御情報保持部713に、VMM120が処理するVM-Exit要因を予め設定しておき、この設定を参照することにより行う。VM-Exit要因をVMM110で処理する場合には、ステップS20へ移行し、VMM120で処理する場合には、ステップS61へ移行する。
 ステップS61では、VM-Exitハンドラ10が、VMM120へ処理を移すための各種設定をVMCSへ行う。次に、ステップS62で、VM-Exitハンドラ10が、VMM120へ処理を移すために、VMM120へVM-Entryする。
 一方、ステップS20では、VM-Exitハンドラ10が、VM-Exit要因毎の処理(2)を実行する。VM-Exit要因毎の処理(2)とは、レジスタへの値の読み書きや命令の実行など、VMM110が行うべき処理である。VM-Exit要因毎の処理(2)が終わると、ステップS22へ移行し、VM-Exitハンドラ10が、ゲストOS140へ処理を返すために、ゲストOS140へVM-Entryする。
 また、ステップS10では、VM-Exitハンドラ10が、ステップS1で特定したVM-Exit要因が、VM-Entry命令か否かを判定する。VM-Exit要因が、VM-Entry命令の場合には、ステップS21へ移行し、VM-Exitハンドラ10が、ゲストOS140へ処理を移すための各種設定をVMCSへ行う。次に、ステップS22で、VM-Exitハンドラ10が、ゲストOS140に処理を移すために、ゲストOS140へVM-Entryする。
 一方、上記ステップS10で、VM-Exitハンドラ10が、VM-Exit要因がVM-Entry命令ではないと判定すると、ステップS30へ移行し、図11に示すVM-Exit要因毎の処理(1)を実行する。
 図11に示すVM-Exit要因毎の処理(1)のステップS31で、VM-Exitハンドラ10が、VM-Exit要因がvDMAR-HW211への設定か否かを判定する。VM-Exit要因がvDMAR-HW211への設定の場合には、ステップS100へ移行し、vDMAR-HW211への設定ではない場合には、ステップS32へ移行する。
 ステップS32では、VM-Exitハンドラ10が、VM-Exit要因がWP設定されたDMARテーブル510の更新か否かを判定する。VM-Exit要因がWP設定されたDMARテーブル510の更新の場合には、ステップS100へ移行し、WP設定されたDMARテーブル510の更新ではない場合には、ステップS33へ移行する。
 ステップS100では、DMAR仮想化部11が、図12に示すDMAR仮想化処理を実行する。
 図12に示すDMAR仮想化処理のステップS101で、VM-Exitハンドラ10が、VM-Exit要因がvDMAR-HW211への設定か否かを判定する。VM-Exit要因がvDMAR-HW211への設定の場合には、ステップS102へ移行し、VM-Exit要因がWP設定されたDMARテーブル510の更新の場合には、ステップS111へ移行する。
 ステップS102では、GPA1DMARテーブル取得部12が、VMM120が作成したDMARテーブル510を取得する。DMARテーブル510は、GPA1基準に作成されている。そこで、次のステップS103で、DMARテーブル作成部15が、GPA1-HPA変換部13を利用して、GPA1基準のDMARテーブル510をHPA基準に変換したDMARテーブル501を作成する。
 次に、ステップS104で、ホストDMARテーブル更新部16が、DMARテーブル500のI/Oデバイス801に対する設定を、DMARテーブル501の内容で更新する。ステップS105で、VMM120によるDMARテーブル510の更新を検出できるように、WP設定部14が、DMARテーブル510が記憶されたメモリ領域のWP設定を、CPU400のGPA1-HPA変換を行うEPT901に反映する。設定が終了すると、図11に示すVM-Exit要因毎の処理(1)へリターンする。
 一方、ステップS111では、GPA1DMARテーブル取得部12が、VMM120が作成したDMARテーブル512を取得する。DMARテーブル512は、GPA1基準に作成されている。そこで、次のステップS112で、DMARテーブル作成部15が、GPA1-HPA変換部13を利用して、GPA1基準のDMARテーブル512をHPA基準に変換したDMARテーブル502を作成する。
 次に、ステップS113で、ホストDMARテーブル更新部16が、DMARテーブル500のI/Oデバイス801に対する設定を、DMARテーブル502の内容で更新する。次に、ステップS114で、VMM120によるDMARテーブル512の更新を検出できるように、WP設定部14が、DMARテーブル512が記憶されたメモリ領域のWP設定を、CPU400のGPA1-HPA変換を行うEPT901に反映する。設定が終了すると、図11に示すVM-Exit要因毎の処理(1)へリターンする。
 上記ステップS32で否定判定された場合は、ステップS33へ移行し、VM-Exitハンドラ10が、VM-Exit要因に応じた処理を実行して、図10に示すVM-Exitハンドラ10による処理へリターンする。
 図13に、DMAR-HWの入れ子の仮想化処理における非特権モードと特権モードとの遷移を示す。なお、ここでは、ゲストOS140にI/Oデバイス801が割り当てられ、ゲストOS140が、vDMAR-HW221に、I/Oデバイス801に対する設定を行う場合を示している。また、非特権モードから特権モードへのVM-Exitを一点鎖線の矢印、特権モードから非特権モードへのVM-Entryを二点鎖線の矢印で示している。
 図13のステップS500で、ゲストOS140が、vDMAR-HW221へのDMARテーブル520の設定を行うため、vDMAR-HW221のレジスタにアクセスすると、VMM110へVM-Exitする。本来なら、vDMAR-HW221を管理する第2層のVMM120へ処理を移したいが、ゲストOS140及びVMM120は共に非特権モードであり、直接VM-Exitすることはできないため、ゲストOS140からVMM110へVM-Exitされる。
 次に、ステップS501で、VM-Exitハンドラ10が、VM-Exit要因を特定する。VM-Exit要因は、ゲストOS140によるvDMAR-HW221への設定であり、これは本来VMM120の処理であるため、ステップS502で、VMM120へ処理を移す。ステップS501→S502は、図10のステップS1→S2→S55→S61→S62に相当する。
 次に、ステップS503で、VMM120のVM-Exitハンドラ20が、VM-Exit要因を、ゲストOS140によるvDMAR-HW221への設定であると特定する。次に、ステップS504で、VMM120のDMAR仮想化機能21が、GPA2空間を基準にして作成されたDMARテーブル520を、GPA1空間を基準に変換したDMARテーブル512を作成する。次に、ステップS505で、DMAR仮想化機能21が、DMARテーブル510をDMARテーブル512の内容で更新する。DMARテーブル510が記憶されたメモリ領域はWPが設定されているため、DMARテーブル510の更新により例外が発生し、VMM110へVM-Exitする。
 次に、ステップS506で、VM-Exitハンドラ10が、VM-Exit要因を、WP設定されたDMARテーブル510の更新であると特定する。次に、ステップS507で、GPA1DMARテーブル取得部12が、DMARテーブル512を取得する。そして、DMARテーブル作成部15が、GPA1-HPA変換部13を利用して、GPA1基準のDMARテーブル512をHPA基準に変換したDMARテーブル502を作成する。
 次に、ステップS508で、ホストDMARテーブル更新部16が、DMARテーブル500を、DMARテーブル502の内容で更新する。次に、ステップS509で、WP設定部14が、DMARテーブル512が記憶されたメモリ領域をWPに設定する。次に、ステップS510で、VM-Exitハンドラ10が、VMM120に処理を移すために、VMM120へVM-Entryする。
 ステップS506→S507→S508→S509→S510は、図10のステップS1→S2→S10→S30→図11のS31→S32→S100→図12のS101→S111→S112→S113→S114→図10のS62に相当する。
 次に、ステップS511で、VMM120が、vCPU410のGPA2-GPA1変換を行うEPT912に、ゲストOS140の作成したDMARテーブル520が記憶されたメモリ領域のWPを設定する。
 次に、ステップS512で、VMM120は、ゲストOS140へVM-Entryするための設定を、vCPU410のvVMCS710へ行う。vVMCS710への設定は、特権命令であるVMWRITEまたはVMREADの実行を伴うため、VMM110へVM-Exitする。
 次に、ステップS513で、VM-Exitハンドラ10が、VM-Exit要因を、vVMCS710へのVMWRITEまたはVMREADであると特定する。次に、ステップS514で、VM-Exitハンドラ10が、vVMCS710及びEPT902への設定を行う。次に、ステップS515で、VM-Exitハンドラ10が、VMM120に処理を移すために、VMM120へVM-Entryする。vVMCS710及びEPT902への設定では、VMM110とVMM120との間で、VM-Exit及びVM-Entryが複数回繰り返されることになる。その設定の中で、VM-Exitハンドラ10は、EPT912が変更されていることを検出すると、GPA2-HPA変換を行うEPT902へその変更を反映する。
 上記ステップS513→S514→S515は、図10のステップS1→S2→S10→S30→図11のS31→S32→S33→図10のS61に相当する。
 次に、ステップS516で、VMM120が、ゲストOS140へ処理を戻すためにVM-Entry命令を実行する。非特権モードのVMM120による特権命令VM-Entryの実行により、例外が発生し、VMM110へVM-Exitする。
 次に、ステップS517で、VM-Exitハンドラ10が、VM-Exit要因を、VMM120からゲストOS140へのVM-Entry命令であると特定する。次に、ステップS518で、ゲストOS140へ処理を移す。上記のステップS517→S518は、図10のステップS1→S2→S10→S21→S22に相当する。
 図14に、DMAR-HWの入れ子の仮想化におけるDMARテーブルの関係の一例を示す。HPAのアドレス範囲4GB~10GBが、GPA1の0GB~6GBとして割り当てられている。さらにGPA1のアドレス範囲4GB~6GBが、GPA2の0GB~2GBとして割り当てられている。GPA2上に作成されたDMARテーブル520には、GPA2のアドレス範囲1GB~2GBがI/Oデバイス801に割り当てられた領域であるとの設定が含まれる。DMARテーブル520をGPA1上に変換したものがDMARテーブル512であり、DMARテーブル512をHPA上に変換したものがDMARテーブル502である。DMARテーブル502には、HPAのアドレス範囲9GB~10GBがI/Oデバイス801に割り当てられた領域であるとの設定が含まれる。
 また、VMM120により、GPA1上に作成されたDMARテーブル510をHPA上に変換したものがDMARテーブル501である。
<問題点>
 以上説明したように、従来技術をそのまま組み合わせた比較例によるDMAR-HWの入れ子の仮想化では、図13に示すように、特権モードと非特権モードとの間の遷移(VM-Entry及びVM-Exit)が多いことが分かる。特権モードと非特権モードとの間の遷移回数が多い場合には、オーバヘッドが大きくなり、ゲストOSにDMAR-HWを提供する際の仮想化に時間を要することになる。
<開示の技術の概要>
 まず、上記の問題点を解決するための開示の技術の概念について説明する。比較例におけるDMAR-HWの入れ子の仮想化における第2層のVMM120の役割を考える。図15の左図に示すように、VMM120の役割は、ゲストOS140の作成したGPA2基準のDMARテーブル520をGPA1基準のDMARテーブル512に変換して、vDMAR-HW211へ設定することである。vDMAR-HW211へ行われた設定は、第1層のVMM110が、DMARテーブル512をHPA基準のDMARテーブル502に変換して、DMAR-HW200へ反映する。
 つまり、VMM120は、ゲストOS140が作成したDMARテーブル520がDMAR-HW200へ設定されるまでの中継点にすぎない。VMM110が直接ゲストOS140のDMARテーブル520をDMAR-HW200へ設定することができれば、第2層のVMM120を中継させる必要がない。
 この場合、ゲストOS140がvDMAR-HW221を使用していることを、第2層のVMM120は知らないことになる。別の言い方をすれば、VMM120は、ゲストOS140がvDMAR-HW221を使用していないと認識することになる。つまり、第2層のVMM120は、上位のゲストOS140の設定を意識することなく、自分の設定だけをvDMAR-HW211へ行えばよい。そして、ゲストOS140及び第2層のVMM120のそれぞれが行ったDMARの設定を、最終的に第1層のVMM110によりDMAR-HW200へ反映する。すなわち、図15の右図に示すように、GPA2基準のDMARテーブル520を、VMM110B(開示の技術の第1層のVMM)により直接HPA基準のDMARテーブル502へ変換する。
<第1実施形態>
 以下、開示の技術の第1実施形態の一例を、図面を参照して詳細に説明する。
 図16に本第1実施形態に係る情報処理装置100を示す。以下、図7に示す比較例と異なる点について説明する。図16に示す第1実施形態では、情報処理装置100で動作する第1層のVMM110Bが、VM-Exitハンドラ10B及びDMAR仮想化部11Bを備えている。なお、VM-Exitハンドラ10Bは、開示の技術の特定部の一例である。また、DMAR仮想化部11Bは、開示の技術の設定部の一例である。
 VM-Exitハンドラ10Bは、ゲストOS140またはVMM120からのVM-Exitを捕捉し、VM-Exit要因を特定する。VM-Exitハンドラ10Bは、ゲストOS140からのVM-Exitについて、VM-Exit要因が「DMAR-HW221への設定」か、または「WP設定されたDMARテーブル520の更新」であるかを判定する。VM-Exit要因が「DMAR-HW221への設定」または「WP設定されたDMARテーブル520の更新」の場合は、処理をVMM120へ任せずにVMM110Bで実行する。
 上述したように、DMAR-HWへのDMARテーブルの設定は、メモリにマップされたDMAR-HWのレジスタへのアクセスにより行われる。ゲストOS140によるメモリへのアクセスで例外が発生し、VM-Exitした場合に、アクセスしたアドレスがゲストOS140に見せているvDMAR-HW221のレジスタのアドレスに一致すれば、DMAR-HW221へのアクセスであると判定できる。すなわち、vDMAR-HW221へのDMARテーブル520の設定により、VM-Exitしたと判定することができる。
 ここで、レジスタのアドレスへのアクセスを検出する場合には、第2層のVMM120がゲストOS140に見せているvDMAR-HW221のレジスタのアドレスは、DMAR-HW200のレジスタがマップされたアドレスと同じである必要がある。第2層のVMM120がゲストOS140へ見せるvDMAR-HW221のレジスタのアドレスを自由に変えてしまうと、第1層のVMM110はそのアドレスを知るすべを持たないため、vDMAR-HW221へのアクセスを検出することができない。
 ただし、VMMは、物理DMAR-HWのレジスタのアドレスをそのまま上位のゲストに見せる(仮想化する)ことが一般的であるため、上記の制限は特に問題にはならない。
 また、WP設定されたDMARテーブル520の更新は、メモリアクセスにより例外が発生した場合に、そのアドレスがDMARテーブル520が記憶されている領域に一致するか否かにより判定することができる。
 図17に示すように、DMAR仮想化部11Bは、図9に示す比較例のDMAR仮想化部11の各機能部に、GPA2DMARテーブル取得部17及びGPA2-HPA変換部18が追加されている。
 GPA2DMARテーブル取得部17は、VM-Exit要因がゲストOS140によるvDMAR-HW221への設定またはDMARテーブル520の更新の場合に、ゲストOS140が作成したDMARテーブル520を取得する。
 GPA2-HPA変換部18は、GPA2をHPAへ変換する。GPA2-HPA変換部18は、DMARテーブル作成部15が、ゲストOS140の作成したDMARテーブル520をHPA基準に変換したDMARテーブル502を作成する際に使用される。GPA2-HPA変換部18は、CPUの仮想化支援機構のために作成したGPA2-HPA変換を行うEPT902を使用する。
 また、本第1実施形態では、DMARテーブル520をGPA1基準に変換したDMARテーブル512は作成されないため、図18に示すように、メモリ300には、図8の比較例のメモリ構成と異なり、DMARテーブル512を記憶する領域は設けられない。
 情報処理装置100は、例えば図19に示すように、CPU400、メモリ300、及びDMAR-HW200に加え、不揮発性の記憶部600、及び入出力インターフェース(I/F)800を備えたサーバ40で実現することができる。CPU400、メモリ300、DMAR-HW200、記憶部600、及び入出力I/F800は、バス42を介して互いに接続されている。I/Oデバイス801、802は、入出力I/F800を介してサーバ40と接続されている。
 記憶部600はHDD、フラッシュメモリ等によって実現できる。記録媒体としての記憶部600には、サーバ40を情報処理装置100として機能させるための情報処理プログラム50が記憶されている。CPU400は、情報処理プログラム50を記憶部600から読み出してメモリ300に展開し、情報処理プログラム50が有するプロセスを順次実行する。
 情報処理プログラム50は、VM-Exitハンドラプロセス51、及びDMAR仮想化プロセス52を有する。CPU400は、VM-Exitハンドラプロセス51を実行することで、図17に示すVM-Exitハンドラ10Bとして動作する。また、CPU400は、DMAR仮想化プロセス52を実行することで、図17に示すDMAR仮想化部11Bとして動作する。これにより、情報処理プログラム50を実行したサーバ40が、情報処理装置100として機能することになる。
 なお、CPU400により実現される各機能は、例えば半導体集積回路、より詳しくはASIC(Application Specific Integrated Circuit)等で実現することも可能である。
 次に、図20及び図21を参照して、本第1実施形態に係る情報処理装置100の作用として、DMAR-HWの入れ子の仮想化処理について説明する。図20は、VM-Exitハンドラ10Bによる処理フローを示す。図21は、DMAR仮想化部11BによるDMAR仮想化処理Bフローを示す。なお、図10~図12に示す比較例におけるDMAR-HWの入れ子の仮想化処理と同様の処理については、同一符号を付して、詳細な説明を省略する。
 図20に示すVM-Exitハンドラ10Bの処理フローのステップS1で、VM-Exitハンドラ10Bが、VM-Exitを捕捉し、VM-Exit要因を特定する。
 次に、ステップS2で、VM-Exitハンドラ10が、トラップしたVM-ExitがゲストOS140からのVM-Exitか、またはVMM120からのVM-Exitかを判定する。ゲストOS140のVM-Exitの場合には、ステップS51へ移行し、VMM120からのVM-Exitの場合には、ステップS10へ移行する。
 ステップS51では、VM-Exitハンドラ10Bが、上記ステップS1で判定したVM-Exit要因が、ゲストOS140によるvDMAR-HW221への設定であるか否かを判定する。vDMAR-HW221への設定の場合には、VMM110で処理を続けるために、ステップS20Bへ移行し、vDMAR-HW221への設定ではない場合には、ステップS52へ移行する。
 ステップS52では、VM-Exitハンドラ10Bが、上記ステップS1で判定したVM-Exit要因が、ゲストOS140によるWP設定されたDMARテーブル520の更新か否かを判定する。WP設定されたDMARテーブル520の更新の場合には、VMM110で処理を続けるために、ステップS20Bへ移行する。WP設定されたDMARテーブル520の更新ではない場合には、ステップS55へ移行する。
 ステップS20Bでは、VM-Exitハンドラ10Bが、VM-Exit要因毎の処理(2B)を実行する。VM-Exit要因毎の処理(2B)は、図11に示すVM-Exit要因毎の処理(1)と同様である。ただし、ステップS31の「vDMAR-HW211への設定」を「vDMAR-HW221への設定」と読み替える。また、ステップS32の「WP設定されたDMARテーブル510の更新」を「WP設定されたDMARテーブル520の更新」と読み替える。また、ステップS100の「DMAR仮想化処理」を「DMAR仮想化処理B」と読み替える。さらに、S30で実行される図11に示すVM-Exit要因毎の処理(1)においても、ステップS100の「DMAR仮想化処理」を「DMAR仮想化処理B」と読み替える。
 図21に示すDMAR仮想化処理BのステップS110では、VM-Exitハンドラ10Bが、VM-Exit要因がゲストOS140によるvDMAR-HW221への設定、またはWR設定されたDMARテーブル520の更新か否かを判定する。肯定判定の場合は、ステップS121へ移行する。一方、VM-Exit要因がVMM120によるvDMAR-HW211への設定、またはWP設定されたDMARテーブル510の更新の場合、ステップS131へ移行する。
 ステップS121では、GPA2DMARテーブル取得部17が、ゲストOS140がアクセスしたアドレスに基づいて、ゲストOS140が作成したDMARテーブル520を取得する。DMARテーブル520は、GPA2基準で作成されている。そこで、次のステップS122で、DMARテーブル作成部15が、GPA2-HPA変換部18を利用して、GPA2基準のDMARテーブル520をHPA基準に変換したDMARテーブル502を作成する。
 次に、ステップS123で、ホストDMARテーブル更新部16が、DMARテーブル500のI/Oデバイス801に対する設定を、DMARテーブル502の内容で更新する。次に、ステップS124で、ゲストOS140によるDMARテーブル520の更新を検出できるように、WP設定部14が、DMARテーブル520が記憶されたメモリ領域のWP設定を、CPU400のGPA2-HPA変換を行うEPT902に反映する。
 一方、ステップS131へ移行した場合には、GPA1DMARテーブル取得部12が、VMM120がアクセスしたアドレスに基づいて、VMM120が作成したDMARテーブル510を取得する。DMARテーブル510は、GPA1基準で作成されている。そこで、次のステップS132で、DMARテーブル作成部15が、GPA1-HPA変換部13を利用して、GPA1基準のDMARテーブル510をHPA基準に変換したDMARテーブル501を作成する。
 次に、ステップS133で、ホストDMARテーブル更新部16が、DMARテーブル500のI/Oデバイス801に対する設定を、DMARテーブル501の内容で更新する。次に、ステップS134で、VMMによるDMARテーブル510の更新を検出できるように、WP設定部14が、DMARテーブル510が記憶されたメモリ領域のWP設定を、CPU400のGPA1-HPA変換を行うEPT901に反映する。設定が終了すると、図11に示すVM-Exit要因毎の処理(2B)へリターンする。
 図22に、本第1実施形態でのDMAR-HWの入れ子の仮想化処理における非特権モードと特権モードとの遷移を示す。なお、ここでは、ゲストOS140にI/Oデバイス801が割り当てられ、ゲストOS140が、vDMAR-HW221に、I/Oデバイス801に対する設定であるDMARテーブル520を設定する場合を示している。また、非特権モードから特権モードへのVM-Exitを一点鎖線の矢印、特権モードから非特権モードへのVM-Entryを二点鎖線の矢印で示している。また、図13に示す比較例でのDMAR-HWの入れ子の仮想化処理における非特権モードと特権モードとの遷移と同様の部分については、同一符号を付して、詳細な説明を省略する。
 図22のステップS500で、ゲストOS140が、vDMAR-HW221へのDMARテーブル520の設定を行うため、vDMAR-HW221のレジスタにアクセスすると、VMM110へVM-Exitする。次に、ステップS501で、VM-Exitハンドラ10Bが、VM-Exit要因を特定する。
 次に、ステップS521で、VM-Exitハンドラ10Bが、VM-Exit要因が、ゲストOS140によるvDMAR-HW221への設定か、またはWP設定されたDMARテーブル520の更新か否かを判定する。VM-Exit要因がいずれかである場合には、処理をVMM120へ移すことなく、次のステップS522へ移行する。
 ステップS522では、GPA2DMARテーブル取得部17が、DMARテーブル520を取得する。そして、DMARテーブル作成部15が、GPA2-HPA変換部18を利用して、GPA2基準のDMARテーブル520をHPA基準に変換したDMARテーブル502を作成する。
 次に、ステップS508で、ホストDMARテーブル更新部16が、DMARテーブル500を、DMARテーブル502の内容で更新する。次に、ステップS523で、WP設定部14が、DMARテーブル520が記憶されたメモリ領域のWP設定をEPT902へ反映する。次に、ステップS518で、ゲストOS140へ処理を移す。
 上記のステップS501→S521→S522→S508→S523→S518は、図20のS1→S2→S51(→S52)→S20B→図11のS31(→S32)→S100→図21のS121→S122→S123→S124→図20のS22に相当する。
 図23に、本第1実施形態でのDMAR-HWの入れ子の仮想化におけるDMARテーブルの関係の一例を示す。図14に示す比較例でのDMAR-HWの入れ子の仮想化におけるDMARテーブルの関係と、メモリ領域の割り当ては同様である。ただし、本第1実施形態においては、DMARテーブル520をGPA1上に変換したDMARテーブル512が作成されない点で相違する。
 以上説明したように、本第1実施形態の情報処理装置によれば、上位のゲストOSからのVM-Exitが、DMAR-HWへのDMARテーブルの設定または更新の場合には、第2層のVMMに処理を移すことなく、第1層のVMMで処理を行う。これにより、図22を見ても明らかなように、非特権モードと特権モードとの遷移を減らすことができる。このため、入れ子の仮想化環境におけるゲストOSに、DMAR-HWを提供する際の仮想化を高速化することができる。
<第2実施形態>
 次に、第2実施形態に係る情報処理装置について説明する。なお、第1実施形態に係る情報処理装置と同一の部分については、同一符号を付して、詳細な説明を省略する。
 図24に示すように、第2実施形態に係る情報処理装置101は、ハードウェアリソースであるCPU400、メモリ300、DMAR-HW200、及びI/Oデバイス801、802、803、804を備えている。CPU400は、8個のコア(コア401、402、・・・、408)を備えている。DMAR-HW200は、I/Oデバイス801、802、803、804からのDMAを制御する。
 VMM110Bは、VM111、112を構築し、情報処理装置101のハードウェアリソースをVM111とVM112とに分割して割り当て、その状態を監視及び制御する。
 VM111には、コア401、・・・、404が割り当てられ、VM111のvCPU411、・・・、414として動作させる。また、VM111には、メモリ300の一部が、vメモリ311として割り当てられる。また、VM111には、I/Oデバイス801、802も直接割り当てられる。また、VM111には、vDMAR-HW211が提供される。VM112には、コア405、・・・、408が割り当てられ、VM112のvCPU415、・・・、418として動作させる。また、VM112には、メモリ300の一部が、vメモリ312として割り当てられる。また、VM112には、I/Oデバイス803、804も直接割り当てられる。また、VM112には、vDMAR-HW212が提供される。vDMAR-HW211、212は、VMM110Bによりエミュレーションされており、vDMAR-HW211、212へのDMARテーブルの設定は、DMAR-HW200へ反映される。
 VM111の上では、第2層のVMM120が動作しており、VMM120は、VM111上で動作するVM121の状態を監視及び制御する。
 VM121には、vCPU411が割り当てられ、VM121のvCPU421として動作する。また、VM121には、vメモリ311の一部が、vメモリ321として割り当てられる。また、VM121には、I/Oデバイス801も直接割り当てられる。また、VM121には、vDMAR-HW221が提供される。なお、詳細は後述するが、vDMAR-HW221は、VMM110Bによりエミュレーションされており、vDMAR-HW221へのDMARテーブル520の設定は、DMAR-HW200へ反映される。さらに、VM121の上では、ゲストOS140が動作している。
 図25にVM111、112、121へのメモリの割り当てを示す。メモリ300のメモリ空間(HPA)の内、4GB~12GBの範囲をVM111へ割り当て、12GB~16GBの範囲をVM112へ割り当てる。VM111に割り当てられたメモリ空間をGPA11、VM112へ割り当てられたメモリ空間をGPA12とする。また、HPAの0GB~2GBの範囲は、VMM110Bが使用し、2GB~4GBの範囲は、ハードウェアのレジスタ等がマップされる領域とする。さらに、VM111のメモリ空間(GPA11)の内、4GB~8GBの範囲をVM121へ割り当てる。VM121へ割り当てられたメモリ空間をGPA21とする。
 初めに、VMM110BがVM111、112を構築する際のEPT及びDMARテーブルの設定について説明する。VMM110Bは、VM上で動作するvCPUがメモリへアクセスする際に必要なEPT、及びVMに割り当てられたI/Oデバイスがメモリへアクセスする際に必要なDMARテーブルをメモリ上に作成する。EPT及びDMARテーブルが記憶されるメモリ領域は、VMM110B用に割り当てられた0~2GBの範囲である。
 図26に、メモリ300に記憶されるEPT及びDMARテーブルを示す。なお、メモリ300には、上述したVMCS等も記憶されるが、ここでは記載を省略している。EPT901は、GPA11からHPAへの変換を行うEPTであり、VM111で動作するコア401、・・・、404のVMCSへ設定される。EPT920は、GPA12からHPAへの変換を行うEPTであり、VM112で動作するコア405、・・・、コア408のVMCSへ設定される。
 図27に、DMAR-HW200に設定されるDMARテーブル500を示す。ここでは、I/Oデバイス801を、バス番号10、デバイス番号1、及びファンクション番号0とする。この場合、I/Oデバイス801に対応するエントリは、ルートエントリテーブル500Aのバス番号10のRoot entry10を参照する。次に、Root entry10からコンテキストエントリトテーブル500B(Bus10)を参照する。コンテキストエントリトテーブル500B(Bus10)のデバイス番号1及びファンクション番号0はContext entry 8に対応する。そして、Context entry 8はアドレス変換テーブル500C1を参照している。アドレス変換テーブル500C1は、GPA11からHPAへ変換するテーブルである。
 同様に、I/Oデバイス802を、バス番号20、デバイス番号2、及びファンクション番号0とする。また、I/Oデバイス803を、バス番号30、デバイス番号3、及びファンクション番号0とする。また、I/Oデバイス804を、バス番号40、デバイス番号4、及びファンクション番号0とする。さらに、アドレス変換テーブル500C2を、GPA12からHPAへ変換するテーブルであるとする。図27の例では、VM111に割り当てられたI/Oデバイス801、802がアドレス変換テーブル500C1を参照し、VM112に割り当てられたI/Oデバイス803、804がアドレス変換テーブル500C2を参照していることが分かる。
 次に、VM111上で動作する第2層のVMM120が、VM121を構築する際に、EPT及びDMARテーブルの設定について説明する。具体的には、VMM120は、VM121上で動作するvCPU421によるvメモリ321へのアクセスがvメモリ311へのアクセスへ変換されるようにEPT912を作成する。EPT912はGPA21からGPA11への変換を行うテーブルであり、vメモリ311上に作成される。EPT912は、vCPU411のvVMCSへ設定される。このvVMCSへEPT912を設定するために、VMM120は特権命令であるVMWRITE命令を呼ぶ。しかし非特権モードで動作しているVMM120がVMWRITE命令を呼ぶと、VM-Exitが発生しVMM110Bへ処理が移る。
 VM110Bは、VM-Exit要因が、vVMCSへのEPT912の設定であることを特定すると、EPT902を作成する。EPT902はGPA21からHPAへの変換を行うテーブルである。EPT902はGPA21からGPA11への変換を行うEPT912とGPA11からHPAへの変換を行うEPT901とを利用して作成される。
 また、VMM120がvDMAR-HW211にDMARテーブル510を設定する。DMARテーブル510は、VM121へ割り当てたI/Oデバイス801によるDMAを、GPA21からGPA11へ変換するためのものである。VMM120が、DMARテーブル510を設定するために、vDMAR-HW211のレジスタへアクセスすると、VM-Exitが発生しVMM110Bへ処理が移る。
 VMM110Bは、VM-Exit要因が、vDMAR-HW211へのDMARテーブル510の設定であることを特定すると、DMARテーブル501を作成する。図28に、DMARテーブル501で更新したDMARテーブル500を示す。VMM120が作成したDMARテーブル510では、VM121へ割り当てられたI/Oデバイス801のDMAをGPA21からGPA11へ変換する。一方、I/Oデバイス802は、VM111から他のVMへ割り当てられていないため、DMARテーブル510内のI/Oデバイス802に対応するエントリはパススルー設定である(VM111のメモリ空間を向いている)。DMARテーブル501では、I/Oデバイス801のDMAをGPA21からHPAへ変換する。DMARテーブル501はGPA21からGPA11への変換を行うDMARテーブル510内のアドレス変換テーブル500C4とGPA11からHPAへの変換を行うEPT901とを利用して作成される。DMARテーブル500のうち、VM111へ割り当てられたI/Oデバイス801、802の設定をDMARテーブル501の内容で更新する。DMARテーブル500内のI/Oデバイス801に対応するエントリは、アドレス変換テーブル500C3を参照するように更新される。一方、DMARテーブル500内のI/Oデバイス802に対応するエントリは、DMARテーブル501内のI/Oデバイス802に対応するエントリがパススルー設定であるため、アドレス変換テーブル500C1を参照したままで、変更されない。
 DMARテーブル500の更新が終わると、VMM120によりDMARテーブル510が更新されたことを検出できるように、VM110Bは、DMARテーブル510の作成されたメモリ領域のWP設定をEPT901へ反映する。これらの設定が終わると、処理を戻すためにVMM120へVM-Entryする。
 VMM120では、vCPU421を動かすための設定をvCPU411のvVMCSへ行う。上述したように、vVMCSへの設定は特権命令であるVMREAD/VMWRITEの実行を伴うため、VM-ExitしてVMM110Bにより処理される。これらの設定が終了すると、ゲストOS140へ処理を移すために、VM-Entry命令を実行する。
 非特権モードで動作しているVMM120が特権命令であるVM-Entryを呼び出すと、VM-Exitし、処理がVMM110Bへ移る。VM110Bは、VM-Exit要因がVM-Entry命令の呼び出しであることを特定すると、コア401のVMCSへVM121を動作させるための設定を行い、ゲストOS140へVM-Entryする。
 VM121上で動作するゲストOS140は、I/Oデバイス801のDMAを制限するために、vDMAR-HW221へDMARテーブル520を設定する。例えば、図29を参照して、I/Oデバイス801にGPA21の0~2GBの領域のみへのアクセスを許可するとの制限を設定する場合について説明する。DMARテーブル520のアドレス変換テーブル500C6は、GPA21の0~2GB以外の範囲へのアクセスを拒絶する設定となる。
 ゲストOS140は、DMARテーブル520をvDMAR-HW520へ設定するために、vDMAR-HW221のレジスタへアクセスする。このアクセスで、VM-Exitが発生する。VMM110Bは、VM-Exit要因がvDMAR-HW221へのDMARテーブル520の設定であることを特定すると、VMM120へ処理を移すことなく、そのまま処理を進める。VMM110Bは、GPA21空間のDMARテーブル520をHPA空間へ変換したDMARテーブル502を作成する。DMARテーブル520のアドレス変換テーブル500C6は、GPA21からHPAへの変換を行うEPT902を利用して、アドレス変換テーブル500C5へ変換される。図25に示すように、GPA21の0~2GBの領域は、HPAの6GB~8GBの領域に変換される。従って、アドレス変換テーブル500C5は、GPA21の0~2GBの領域にアクセスされた場合は、HPAの6GB~8GBの領域へ変換し、それ以外の範囲へのアクセスを拒絶する設定となる。VMM110Bは、DMARテーブル500内のI/Oデバイス801に対応するエントリを、DMARテーブル502のアドレス変換テーブル500C5を参照するように変更する。
 DMARテーブル500の更新が終わると、ゲストOS140によりDMARテーブル520が更新されたことを検出できるように、VM110Bは、DMARテーブル520の作成されたメモリ領域のWP設定をEPT902へ反映する。
 VMM110Bは、処理をゲストOS140へ戻すために、VM-Entry命令を実行する。
 以上のように、VM121上のゲストOS140により、DMAR-HW200が初期設定される。
 次に、ゲストOS140によるDMAR-HW200に設定されているDMARテーブル500の更新について説明する。ここでは、図30に示すように、ゲストOS140が、I/Oデバイス801のアクセス可能なアドレス範囲をGPA21の0~2GBの範囲から、4GB~6GBの範囲へ変更する場合を例に説明する。DMARテーブル520内のアドレス変換テーブル500C8は、GPA21のアドレス範囲4GB~6GBのみアクセス可能であることを示す設定である。ゲストOS140は、アドレス変換テーブル500C8を作成し、DMARテーブル520内のI/Oデバイス801に対応するエントリに参照させるように更新する。このとき、更新前のDMARテーブル520の領域はWP設定されているため、この更新によりVM-Exitが発生する。
 処理が移ったVMM110Bでは、VM-Exit要因が、DMARテーブル520内のI/Oデバイス801に対応するエントリの更新であることを特定すると、VMM120へ処理を移すことなく、そのまま処理を進める。VMM110Bは、DMARテーブル520内のI/Oデバイス801に対応するエントリが新しいアドレス変換テーブル500C8を参照していることを特定する。そして、GPA21空間のアドレス変換テーブル500C8をHPA空間へ変換したアドレス変換テーブル500C7を作成し、DMARテーブル502内のI/Oデバイス801に対応するエントリに参照させる。また、DMARテーブル500内のI/Oデバイス801に対応するエントリからも、アドレス変換テーブル500C7を参照させる。アドレス変換テーブル500C5がどのエントリからも参照されなくなった場合には、削除してもよい。そして、アドレス変換テーブル500C6の使用していたメモリ領域のWP設定を解除し、新たにアドレス変換テーブル500C8の領域のWP設定をEPT902へ反映する。
 以上のように、VM121上のゲストOS140により、DMAR-HW200に設定されたDMARテーブル500が更新される。
 最後に、VMM120がVM121を削除する場合のDMAR-HW200へのDMARテーブル500の設定について説明する。VM121を削除する際には、VM121に割り当てていたリソースを開放する。VM121に割り当てていたI/Oデバイス801も開放し、VMM120の管理化へ置く。図31に示すように、VMM120の管理するDMARテーブル510内のI/Oデバイス801に対応するエントリは、アドレス変換テーブル500C4を参照している。そこで、この参照をパススルー設定に戻すために、DMARテーブル510内のI/Oデバイス801に対応するエントリを更新する。DMARテーブル510の領域はWPされているので、この更新によりVM-Exitが発生する。
 処理が移ったVMM110Bでは、VM-Exit要因がDMARテーブル510内のI/Oデバイス801に対応するエントリの更新であることを特定し、このエントリがパススルー設定であることを検出する。そこで、VMM110Bは、DMARテーブル500内のI/Oデバイス801に対応するエントリに、GPA11-HPA変換を行うアドレス変換テーブル500C1を再び参照させる。もしアドレス変換テーブル500C3がどのエントリからも参照されなくなった場合には、削除してもよい。そして、アドレス変換テーブル500C4の使用していたメモリ領域のWPを解除するようにEPT901へ反映する。また、DMARテーブル502も、DMARテーブル500から参照されなくなるため、削除してもよい。さらに、DMARテーブル520の使用していたメモリ領域のWP設定を解除するようにEPT902へ反映する。
 以上のように、VM121の削除に伴う、DMARテーブル500の更新が行われる。
<第3実施形態>
 次に、第3実施形態に係る情報処理装置について説明する。なお、第1実施形態及び第2実施形態に係る情報処理装置と同一の部分については、同一符号を付して、詳細な説明を省略する。
 図32に示すように、第3実施形態に係る情報処理装置102のハードウェアリソースは第2実施形態に係る情報処理装置101と同様である。第3実施形態では、3層の仮想化を構成している。図24に示す第2実施形態の構成と比較して、VM121上にVMM130が存在し、さらにVMM130上にVM131が構築され、VM131上でゲストOS140が動作している。VM131には、vCPU431及びvメモリ331が割り当てられており、また、I/Oデバイス801も直接割り当てられている。さらに、VM131には、vDMAR-HW231が提供されている。また、ゲストOS140が動作するメモリ空間をGPA3とする。
 図33に、図32の構成のおけるメモリ300に記憶されるDMARテーブル及びEPTを示す。なお、メモリ300には、上述のVMCSも記憶されるが、ここでは記載を省略している。メモリ300において、vメモリ321に割り当てられた領域の一部が、vメモリ331に割り当てられている点が、図17に示す第1実施形態におけるメモリ300構成と異なる。さらに、vメモリ331に割り当てられた領域には、ゲストOS140により作成されたGPA3基準のDMARテーブル530が記憶される。また、メモリ300には、DMARテーブル530をHPA基準に変換したDMARテーブル503が記憶される。また、メモリ300には、GPA3-HPA間の変換テーブルであるEPT903が記憶される。
 VMM110Cは、図34に示すように、VM-Exitハンドラ10C、及びDMAR仮想化部11Cを備えている。さらに、DMAR仮想化部11Cは、GPA#nDMARテーブル取得部17C、GPA#n-HPA変換部18C、WP設定部14、DMARテーブル作成部15、及びホストDMARテーブル更新部16を備えている。
 GPA#nDMARテーブル取得部17Cは、指定されたGPA#n(n=1,2,3)基準で作成されたDMARテーブル(DMARテーブル510、520、530)を取得する。GPA#n-HPA変換部18Cは、指定されたGPA#n(n=1,2,3)を、GPA#nに対応するEPT901、902、903を使用して、HPA基準のアドレスに変換する。
 次に、図35~図38を参照して、第3実施形態におけるDMAR-HWの入れ子の仮想化処理について説明する。図35は、VM-Exitハンドラ10Cによる処理フローを示す。図36は、VM-Exitハンドラ10Cによる処理フロー内のVMM120からのVM-Exit処理フローを示す。図37は、VM-Exitハンドラ10Cによる処理フロー内のVMM130からのVM-Exit処理フローを示す。図38は、DMAR仮想化部11CによるDMAR仮想化処理Cフローを示す。なお、図20及び図21に示す第1実施形態におけるDMAR-HWの入れ子の仮想化処理と同様の処理については、同一符号を付して、詳細な説明を省略する。
 図35に示すVM-Exitハンドラ10Cの処理フローのステップS1で、VM-Exitハンドラ10Cが、ゲストOS140、VMM120、またはVMM130からのVM-Exitを捕捉する。そして、VM-Exitハンドラ10Cが、捕捉したVM-ExitのVM-Exit要因を特定する。
 次に、ステップS2で、VM-Exitハンドラ10Cが、捕捉したVM-ExitがゲストOS140からのVM-Exitか否かを判定する。ゲストOS140からのVM-Exitの場合には、ステップS53へ移行し、VMM120またはVMM130からのVM-Exitの場合には、ステップS3へ移行する。
 ステップS53では、VM-Exitハンドラ10Cが、上記ステップS1で判定したVM-Exit要因が、ゲストOS140によるvDMAR-HW231への設定であるか否かを判定する。vDMAR-HW231への設定の場合には、VMM110Cで処理を続けるために、ステップS20Cへ移行し、vDMAR-HW231への設定ではない場合には、ステップS54へ移行する。
 ステップS54では、VM-Exitハンドラ10Cが、上記ステップS1で判定したVM-Exit要因が、ゲストOS140によるWP設定されたDMARテーブル530の更新か否かを判定する。DMARテーブル530の更新の場合には、VMM110Cで処理を続けるために、ステップS20Cへ移行し、DMARテーブル530の更新ではない場合には、ステップS55へ移行する。
 ステップS20Cでは、VM-Exitハンドラ10Cが、VM-Exit要因毎の処理(2C)を実行する。VM-Exit要因毎の処理(2C)は、図11に示すVM-Exit要因毎の処理(1)と同様である。ただし、ステップS31の「vDMAR-HW211への設定」を「vDMAR-HW231への設定」と読み替える。また、ステップS32の「WP設定されたDMARテーブル510の更新」を「WP設定されたDMARテーブル530の更新」と読み替える。また、ステップS100の「DMAR仮想化処理」を「DMAR仮想化処理C」と読み替える。
 一方、ステップS3では、VM-Exitハンドラ10Cが、トラップしたVM-ExitがVMM120からのVM-Exitか否かを判定する。VMM120からのVM-Exitの場合には、ステップS80へ移行し、図36に示すVMM120からのVM-Exit処理を実行する。VMM130からのVM-Exitの場合には、ステップS90へ移行し、図37に示すVMM130からのVM-Exit処理を実行する。
 図36に示すVMM120からのVM-Exit処理のステップS10では、VM-Exitハンドラ10Cが、ステップS1で特定したVM-Exit要因が、VM-Entry命令か否かを判定する。VM-Exit要因が、VM-Entry命令の場合には、ステップS41で、VM-Exitハンドラ10が、VMM130へ処理を移すための各種設定をVMCSへ行う。次に、ステップS42で、VM-Exitハンドラ10Cが、VMM130に処理を移すために、VMM130へVM-Entryし、図35に示すVM-Exitハンドラ10Cの処理にリターンする。
 一方、上記ステップS10で、VM-Exitハンドラ10Cが、VM-Exit要因がVM-Entry命令ではないと判定すると、ステップS30へ移行し、図11に示すVM-Exit要因毎の処理(1)を実行する。なお、ステップS100の「DMAR仮想化処理」を「DMAR仮想化処理C」と読み替える。
 次に、ステップS62で、VM-Exitハンドラ10Cが、VMM120に処理を移すために、VMM120へVM-Entryし、図35に示すVM-Exitハンドラ10Cの処理にリターンする。
 図37に示すVMM130からのVM-Exit処理のステップS10では、VM-Exitハンドラ10Cが、ステップS1で特定したVM-Exit要因が、VM-Entry命令か否かを判定する。VM-Exit要因が、VM-Entry命令の場合には、ステップS21で、VM-Exitハンドラ10Cが、ゲストOS140へ処理を移すための各種設定をVMCSへ行う。次に、ステップS22で、VM-Exitハンドラ10Cが、ゲストOS140に処理を移すために、ゲストOS140へVM-Entryし、図35に示すVM-Exitハンドラ10Cの処理にリターンする。
 一方、上記ステップS10で、VM-Exitハンドラ10Cが、VM-Exit要因がVM-Entry命令ではないと判定すると、ステップS55へ移行する。ステップS55では、VM-Exitハンドラ10Cが、VM-Exit要因に応じた処理を、そのままVMM110Cで行うか、またはVMM120へ任せるかを判定する。VMM110Cで処理する場合には、ステップS40へ移行し、VMM120で処理する場合には、ステップS61へ移行する。
 ステップS61では、VM-Exitハンドラ10Cが、VMM120へ処理を移すための各種設定をVMCSへ行う。次に、ステップS62で、VM-Exitハンドラ10Cが、VMM120に処理を移すために、VMM120へVM-Entryし、図35に示すVM-Exitハンドラ10Cの処理にリターンする。
 一方、ステップS40では、VM-Exitハンドラ10Cが、VM-Exit要因毎の処理(3)を実行する。VM-Exit要因毎の処理(3)は、図11に示すVM-Exit要因毎の処理(1)と同様である。ただし、ステップS31の「DMAR-HW211への設定」を「DMAR-HW221への設定」と読み替える。また、ステップS32の「WP設定されたDMARテーブル510の更新」を「WP設定されたDMARテーブル520の更新」と読み替える。また、ステップS100の「DMAR仮想化処理」を「DMAR仮想化処理C」と読み替える。
 次に、ステップS42で、VM-Exitハンドラ10Cが、VMM130に処理を移すために、VMM130へVM-Entryし、図35に示すVM-Exitハンドラ10Cの処理にリターンする。
 次に、図38に示すDMAR仮想化処理CのステップS110で、VM-Exitハンドラ10Cが、VM-Exit要因がゲストOS140によるvDMAR-HW231への設定、またはWR設定されたDMARテーブル530の更新か否かを判定する。肯定判定の場合は、ステップS141へ移行し、否定判定の場合は、ステップS120へ移行する。
 ステップS141では、GPA#nDMARテーブル取得部17Cが、ゲストOS140が作成したDMARテーブル530を取得する。DMARテーブル530は、GPA3基準で作成されている。そこで、次のステップS142で、DMARテーブル作成部15が、GPA#n-HPA変換部18Cを利用して、GPA3基準のDMARテーブル520をHPA基準に変換したDMARテーブル503を作成する。
 次に、ステップS143で、ホストDMARテーブル更新部16が、DMARテーブル500のI/Oデバイス801に対する設定を、DMARテーブル503の内容で更新する。次に、ステップS144で、ゲストOS140によるDMARテーブル530の更新を検出できるように、WP設定部14が、DMARテーブル530が記憶されたメモリ領域のWP設定を、CPU400のGPA3-HPA変換を行うEPT903に反映する。
 一方、ステップS120へ移行した場合には、VM-Exitハンドラ10Cが、VM-Exit要因がVMM130によるvDMAR-HW221への設定、またはWR設定されたDMARテーブル520の更新か否かを判定する。肯定判定の場合は、ステップS121へ移行し、VM-Exit要因がVMM120によるvDMAR-HW211への設定、またはWR設定されたDMARテーブル510の更新の場合には、否定されて、ステップS131へ移行する。
 以下、図21に示す第1実施形態におけるDMAR仮想化処理Bと同様に、ステップS121~124、及び131~134を実行し、図35に示すVM-Exitハンドラ10Cの処理へリターンする。
 図39に、第3実施形態でのDMAR-HWの入れ子の仮想化処理における非特権モードと特権モードとの遷移を示す。なお、ここでは、ゲストOS140にI/Oデバイス801が割り当てられ、ゲストOS140が、vDMAR-HW231に、I/Oデバイス801に対する設定を行う場合を示している。また、非特権モードから特権モードへのVM-Exitを一点鎖線の矢印、特権モードから非特権モードへのVM-Entryを二点鎖線の矢印で示している。また、図22に示す第1実施形態でのDMAR-HWの入れ子の仮想化処理における非特権モードと特権モードとの遷移と同様の部分については、同一符号を付して、詳細な説明を省略する。
 図39に示すように、第3実施形態における非特権モードと特権モードとの遷移は、図22に示す第1実施形態での非特権モードと特権モードとの遷移と同様である。4層以上の仮想化であっても、同様に開示の技術を適用することができる。4層以上の仮想化の場合も、上位のゲストOSによるGPA#n基準のDMARテーブルの設定または更新を検出する。これらが検出された場合には、処理を上位のVMMへ移すことなく、第1層のVMMで、GPA#n基準で作成されたDMARテーブルをHPA基準のDMARテーブルに変換すればよい。
 なお、上記では、CPUの仮想化支援機構及びDMAR-HWの仮想化支援機構の例として、インテル(登録商標)のVT-x及びVT-dを例に説明したがこれに限定されない。CPUの仮想化支援機構は、CPUが特権モードと非特権モードとで動作するものであればよい。また、DMAR-HWの仮想化支援機構は、変換表を用いてDMAを行う機構であればよい。
 また、上記では開示の技術における情報処理プログラムの一例である情報処理プログラム50が記憶部600に予め記憶(インストール)されている態様を説明した。しかし、開示の技術における情報処理プログラムは、CD-ROMやDVD-ROM等の記録媒体に記録されている形態で提供することも可能である。

Claims (10)

  1.  第1層の仮想マシンモニタにより構築された仮想マシン上で動作する上位仮想マシンモニタにより上位仮想マシンが構築され、前記第1層の仮想マシンモニタが特権モードで動作し、前記上位仮想マシンモニタ及び前記上位仮想マシン上のゲストプログラムが非特権モードで動作する入れ子の仮想化環境において、前記ゲストプログラムの処理で発生した非特権モードから特権モードへの遷移の要因を特定する特定部と、
     前記特定部により特定された要因が、前記上位仮想マシンに割り当てられた入出力装置によるDMAのアドレス変換を設定された変換テーブルを用いて行うハードウェアのアドレス変換機構を仮想化して前記ゲストプログラムに提供される仮想変換機構で用いる仮想変換テーブルの設定または更新の場合に、前記仮想変換テーブル、及び前記ゲストプログラムが動作するゲストメモリ空間と前記第1層の仮想マシンモニタが動作するホストメモリ空間との対応関係に基づいて、前記変換機構で用いる前記変換テーブルを設定する設定部と、
     を含む情報処理装置。
  2.  前記設定部は、前記ゲストプログラムの処理が、前記仮想変換テーブルの設定または更新の場合に、非特権モードから特権モードへの遷移が発生するように、前記仮想変換機構及び前記仮想変換テーブルに対する処理が例外処理となるように設定する請求項1記載の情報処理装置。
  3.  前記設定部は、前記ゲストメモリ空間のアドレスによる前記仮想変換テーブルを取得し、取得した前記仮想変換テーブルを、前記対応関係に基づいて、前記ホストメモリ空間のアドレスによる変換テーブルに変換して、前記変換機構で用いる前記変換テーブルとして設定する請求項1または請求項2記載の情報処理装置。
  4.  第1の仮想マシンを構築し、特権モードで動作する第1層の仮想マシンモニタと、前記第1の仮想マシン上で非特権モードで動作し、第2の仮想マシンを構築する第2層の仮想マシンモニタと、前記第2の仮想マシン上で非特権モードで動作するゲストプログラムと
    を含む仮想化環境を動作させる処理装置と、
     入出力装置と、
     前記第2の仮想マシンに割り当てられた入出力装置によるDMAのアドレス変換を設定された変換テーブルを用いて行うハードウェアのアドレス変換機構を仮想化して前記ゲストプログラムに提供される仮想変換機構で用いる仮想変換テーブルを格納する記憶装置とを備え、
     前記処理装置が、
     前記ゲストプログラムの処理で発生した非特権モードから特権モードへの遷移における前記仮想変換テーブルの設定または更新の処理を特定した場合に、前記仮想変換テーブル、及び前記ゲストプログラムが動作するゲストメモリ空間と前記第1層の仮想マシンモニタが動作するホストメモリ空間との対応関係に基づいて、前記変換機構で用いる前記変換テーブルを設定する
     ことを特徴とする情報処理装置。
  5.  コンピュータに、
     第1層の仮想マシンモニタにより構築された仮想マシン上で動作する上位仮想マシンモニタにより上位仮想マシンが構築され、前記第1層の仮想マシンモニタが特権モードで動作し、前記上位仮想マシンモニタ及び前記上位仮想マシン上のゲストプログラムが非特権モードで動作する入れ子の仮想化環境において、前記ゲストプログラムの処理で発生した非特権モードから特権モードへの遷移の要因を特定し、
     特定された要因が、前記上位仮想マシンに割り当てられた入出力装置によるDMAのアドレス変換を設定された変換テーブルを用いて行うハードウェアの変換機構を仮想化して前記ゲストプログラムに提供される仮想変換機構で用いる仮想変換テーブルの設定または更新の場合に、前記仮想変換テーブル、及び前記ゲストプログラムが動作するゲストメモリ空間と前記第1層の仮想マシンモニタが動作するホストメモリ空間との対応関係に基づいて、前記変換機構で用いる前記変換テーブルを設定する
     ことを含む処理を実行させる情報処理方法。
  6.  前記コンピュータに、前記ゲストプログラムの処理が、前記仮想変換テーブルの設定または更新の場合に、非特権モードから特権モードへの遷移が発生するように、前記仮想変換機構及び前記仮想変換テーブルに対する処理が例外処理となるように設定することを含む処理を実行させる請求項5記載の情報処理方法。
  7.  前記コンピュータに、前記ゲストメモリ空間のアドレスによる前記仮想変換テーブルを取得し、取得した前記仮想変換テーブルを、前記対応関係に基づいて、前記ホストメモリ空間のアドレスによる変換テーブルに変換して、前記変換機構で用いる前記変換テーブルとして設定することを含む処理を実行させる請求項5または請求項6記載の情報処理方法。
  8.  コンピュータに、
     第1層の仮想マシンモニタにより構築された仮想マシン上で動作する上位仮想マシンモニタにより上位仮想マシンが構築され、前記第1層の仮想マシンモニタが特権モードで動作し、前記上位仮想マシンモニタ及び前記上位仮想マシン上のゲストプログラムが非特権モードで動作する入れ子の仮想化環境において、前記ゲストプログラムの処理で発生した非特権モードから特権モードへの遷移の要因を特定し、
     特定された要因が、前記上位仮想マシンに割り当てられた入出力装置によるDMAのアドレス変換を設定された変換テーブルを用いて行うハードウェアの変換機構を仮想化して前記ゲストプログラムに提供される仮想変換機構で用いる仮想変換テーブルの設定または更新の場合に、前記仮想変換テーブル、及び前記ゲストプログラムが動作するゲストメモリ空間と前記第1層の仮想マシンモニタが動作するホストメモリ空間との対応関係に基づいて、前記変換機構で用いる前記変換テーブルを設定する
     ことを含む処理を実行させるための情報処理プログラム。
  9.  前記コンピュータに、前記ゲストプログラムの処理が、前記仮想変換テーブルの設定または更新の場合に、非特権モードから特権モードへの遷移が発生するように、前記仮想変換機構及び前記仮想変換テーブルに対する処理が例外処理となるように設定することを含む処理を実行させるための請求項8記載の情報処理プログラム。
  10.  前記コンピュータに、前記ゲストメモリ空間のアドレスによる前記仮想変換テーブルを取得し、取得した前記仮想変換テーブルを、前記対応関係に基づいて、前記ホストメモリ空間のアドレスによる変換テーブルに変換して、前記変換機構で用いる前記変換テーブルとして設定することを含む処理を実行させる請求項8または請求項9記載の情報処理プログラム。
PCT/JP2013/061805 2013-04-22 2013-04-22 情報処理装置、方法、及びプログラム WO2014174580A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2015513387A JP5962853B2 (ja) 2013-04-22 2013-04-22 情報処理装置、方法、及びプログラム
PCT/JP2013/061805 WO2014174580A1 (ja) 2013-04-22 2013-04-22 情報処理装置、方法、及びプログラム
US14/883,679 US10162657B2 (en) 2013-04-22 2015-10-15 Device and method for address translation setting in nested virtualization environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2013/061805 WO2014174580A1 (ja) 2013-04-22 2013-04-22 情報処理装置、方法、及びプログラム

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/883,679 Continuation US10162657B2 (en) 2013-04-22 2015-10-15 Device and method for address translation setting in nested virtualization environment

Publications (1)

Publication Number Publication Date
WO2014174580A1 true WO2014174580A1 (ja) 2014-10-30

Family

ID=51791191

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2013/061805 WO2014174580A1 (ja) 2013-04-22 2013-04-22 情報処理装置、方法、及びプログラム

Country Status (3)

Country Link
US (1) US10162657B2 (ja)
JP (1) JP5962853B2 (ja)
WO (1) WO2014174580A1 (ja)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10027535B1 (en) * 2013-09-27 2018-07-17 Juniper Networks, Inc. Systems and methods for managing device configurations at various levels of abstraction
WO2015095352A1 (en) * 2013-12-17 2015-06-25 Sequitur Labs, Inc. Method and system for dynamic runtime selection and modification of conditional expressions in computations
CN106020985B (zh) * 2016-05-23 2019-08-30 北京北信源软件股份有限公司 数据处理方法、装置及服务器
US10241947B2 (en) * 2017-02-03 2019-03-26 Intel Corporation Hardware-based virtual machine communication
CN108388527B (zh) * 2018-02-02 2021-01-26 上海兆芯集成电路有限公司 直接存储器存取引擎及其方法
GB201807589D0 (en) 2018-05-10 2018-06-27 Nordic Semiconductor Asa Memory access
US20190042295A1 (en) * 2018-06-29 2019-02-07 Intel Corporation Timing compensation for a timestamp counter
US11360824B2 (en) 2019-11-22 2022-06-14 Amazon Technologies, Inc. Customized partitioning of compute instances
US11558311B2 (en) 2020-01-08 2023-01-17 Amazon Technologies, Inc. Automated local scaling of compute instances
US12020059B2 (en) * 2021-08-30 2024-06-25 International Business Machines Corporation Inaccessible prefix pages during virtual machine execution

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008165789A (ja) * 2006-12-27 2008-07-17 Intel Corp パーティション分割されたシステムにおいて、デバイスがメモリにアクセスするための、ゲスト・アドレスからホスト・アドレスへの変換
JP2009003749A (ja) * 2007-06-22 2009-01-08 Hitachi Ltd 仮想化プログラム及び仮想計算機システム
WO2012164716A1 (ja) * 2011-06-02 2012-12-06 株式会社日立製作所 仮想計算機の制御方法及び仮想計算機システム
JP2013508845A (ja) * 2009-10-21 2013-03-07 アーム・リミテッド データ処理システム内のハードウェア資源管理

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7395405B2 (en) * 2005-01-28 2008-07-01 Intel Corporation Method and apparatus for supporting address translation in a virtual machine environment
JP5369356B2 (ja) 2011-11-09 2013-12-18 株式会社日立製作所 仮想化プログラム

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008165789A (ja) * 2006-12-27 2008-07-17 Intel Corp パーティション分割されたシステムにおいて、デバイスがメモリにアクセスするための、ゲスト・アドレスからホスト・アドレスへの変換
JP2009003749A (ja) * 2007-06-22 2009-01-08 Hitachi Ltd 仮想化プログラム及び仮想計算機システム
JP2013508845A (ja) * 2009-10-21 2013-03-07 アーム・リミテッド データ処理システム内のハードウェア資源管理
WO2012164716A1 (ja) * 2011-06-02 2012-12-06 株式会社日立製作所 仮想計算機の制御方法及び仮想計算機システム

Also Published As

Publication number Publication date
JP5962853B2 (ja) 2016-08-03
US10162657B2 (en) 2018-12-25
JPWO2014174580A1 (ja) 2017-02-23
US20160034300A1 (en) 2016-02-04

Similar Documents

Publication Publication Date Title
JP5962853B2 (ja) 情報処理装置、方法、及びプログラム
US20230161615A1 (en) Techniques for virtual machine transfer and resource management
JP5870206B2 (ja) 効率的なメモリ及びリソース管理
JP5571208B2 (ja) パフォーマンスカウンタの仮想化
JP5459006B2 (ja) メモリ管理装置、メモリ管理方法及びメモリ管理プログラム
TWI537822B (zh) 虛擬化中斷優先順序及遞送之技術
JP5607474B2 (ja) コンピュータ・システムにおける入れ子式仮想化の性能改善
JP5541036B2 (ja) メモリアクセス制御プログラム、メモリアクセス制御方法、及び情報処理装置
US7506121B2 (en) Method and apparatus for a guest to access a memory mapped device
US20140337585A1 (en) Page table management
US20110197190A1 (en) Virtualization method and virtual machine
US10430221B2 (en) Post-copy virtual machine migration with assigned devices
US10268595B1 (en) Emulating page modification logging for a nested hypervisor
JP2017227969A (ja) 制御プログラム、システム、及び方法
JP6198858B2 (ja) 計算機、及び、ハイパバイザによる資源スケジューリング方法
JP2011523741A (ja) ホストデータ処理装置内におけるデバイスエミュレーションのサポート
JP5819350B2 (ja) 計算機システム及び起動方法
KR20220017949A (ko) 입력-출력 메모리 관리 유닛에 의한 게스트 운영 체제 버퍼 및 로그 액세스
US10922149B2 (en) System comprising a plurality of virtualization systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13882897

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2015513387

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13882897

Country of ref document: EP

Kind code of ref document: A1