CN104750623B - A kind of method and device of internal memory virtualization - Google Patents

A kind of method and device of internal memory virtualization Download PDF

Info

Publication number
CN104750623B
CN104750623B CN201310752024.8A CN201310752024A CN104750623B CN 104750623 B CN104750623 B CN 104750623B CN 201310752024 A CN201310752024 A CN 201310752024A CN 104750623 B CN104750623 B CN 104750623B
Authority
CN
China
Prior art keywords
layers
address
hva
mapping relations
gva
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201310752024.8A
Other languages
Chinese (zh)
Other versions
CN104750623A (en
Inventor
王振江
武成岗
李斌
杨东艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
Original Assignee
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
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 Huawei Technologies Co Ltd, Institute of Computing Technology of CAS filed Critical Huawei Technologies Co Ltd
Priority to CN201310752024.8A priority Critical patent/CN104750623B/en
Publication of CN104750623A publication Critical patent/CN104750623A/en
Application granted granted Critical
Publication of CN104750623B publication Critical patent/CN104750623B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the invention discloses a kind of method and device of internal memory virtualization, it is related to electronic information technical field, the kernel modifications mapping relations using host can be avoided when needing to change mapping relations.The method of the present invention includes:HVA layers are established to the mapping relations between the memory space of hard disk;Address space is distributed in HVA layers for the process of client computer, and the mapping relations established between the allocated address space in GVA layers to HVA layers;The address established on the allocated address space in the HVA layers of access instruction sensing is to the mapping relations between the memory space of hard disk;Target data is obtained from host.The present invention is suitable for by the scene of the internal memory virtualization of computing device.

Description

A kind of method and device of internal memory virtualization
Technical field
The present invention relates to electronic information technical field, more particularly to a kind of method and device of internal memory virtualization.
Background technology
At present, when using virtual machine, it would be desirable to be able to make memory headroom layout that Client OS sees with true Identical under physical machine environment, this just has to internally deposit into capable virtualization.After internal memory is virtualized, multistage ground can be typically included Location space reflection, and address of cache level is formed, including GVA(Guest Virtual Address, client virtual Location)Layer, GPA(Guest Physical Address, guest physical address)Layer, HVA(Host Virtual Address, Host virtual address)Layer, HPA(Host Physical Address, host physical address)Layer.Wherein, HVA layers are to HPA The mapping of layer is then safeguarded by host operating system, and is recorded in the Host page tables of host.It is and normal in the prior art The quick lookup of mapping relations is realized with shadow page table technology.Such as:When virtual machine runs guest codes, host hardware Page table base register points to a shadow page table, and direct mapping of the GVA layers to HPA layers is stored in shadow page table, for The maintenance of shadow page table is by Virtual Machine Manager software(Virtual Machine Monitor, VMM)Complete.
But need to be frequently changed described in shadow page table with the change of carrying out practically environment in many cases Address mapping relation, such as:Client computer changes the mapping relations between the address on the address to GPA layers on GVA layers.This is just Need, by the supporting kernel module of the system kernel or loading VMM of host, the modification for shadow page table can be realized. Therefore operation in the prior art for shadow page table belongs to the privileged operation for needing the system kernel for employing host, and by Different operating system or architecture are often used in different hosts, for different operating system or architecture The mode of privileged operation also differ, therefore the virtual machine based on shadow page table technology run on a host is difficult To run directly on another operating system or the different host of architecture, technical staff needs to spend time and efforts To reformulate the mode of the privileged operation for giving shadow page table technology for another operating system or architecture, ability Ensure that the virtual machine based on shadow page table technology can be run on the different host of another operating system, limit virtual Migration of the machine in different system platforms uses.
The content of the invention
Embodiments of the invention provide a kind of method and device of internal memory virtualization, can need to change mapping relations When, avoid the kernel modifications mapping relations using host.
To reach above-mentioned purpose, embodiments of the invention adopt the following technical scheme that:
In a first aspect, embodiments of the invention provide a kind of method of internal memory virtualization, it is described for a kind of computing device Computing device comprises at least internal memory and hard disk, and the address of cache level of the internal memory includes client virtual address(GVA)Layer, visitor Family machine physical address(GPA)Layer, host virtual address(HVA)Layer, host physical address(HPA)Layer, methods described include:
The HVA layers are established to the mapping relations between the memory space of hard disk;
Address space is distributed in the HVA layers for the process of the client computer, and establishes the GVA layers to the HVA The mapping relations between allocated address space in layer;
Address the depositing to the hard disk established on the allocated address space in the HVA layers of access instruction sensing Store up the mapping relations between space;
Target data is obtained from the host, the target data is to be obtained by the host according to the access instruction The data taken.
With reference in a first aspect, in the first possible implementation of first aspect, described is entering for the client computer Journey distributes address space in the HVA layers, and establishes the GVA layers between the allocated address space in the HVA layers Mapping relations, including:
It is a to determine the address on the GVA layers;
For the address space described in the course allocation of the client computer on HVA layers, address space on the HVA layers rises Beginning, address was b, and the mapping relations established between address b+a of the address a on the GVA layers to the HVA layers.
With reference to the possible implementation of the first of first aspect or first aspect, in second of possible implementation In, the initial address for the address space on the HVA layers of the course allocation of the client computer is b, and the access instruction refers to Address a+b on the HVA layers;
Address and the hard disk on allocated address space in the HVA layers for establishing access instruction sensing Memory space between mapping relations, including:
Determine the address a on the GVA layers that the access instruction is pointed to, and according to the GVA layers to the HVA layers it Between mapping relations, determine the address x on the HVA layers corresponding to the address a on the GVA layers;
According to the mapping relations between the memory space of the HVA layers to the hard disk, the address on the HVA layers is determined Address z corresponding to x on the memory space of the hard disk;
The ground established on the address a+b to the memory space of the hard disk on the HVA layers that the access instruction is pointed to Mapping relations between the z of location.
With reference to the first or the second possible implementation of first aspect or first aspect, in the third possible realization In mode, address on allocated address space in the HVA layers for establishing access instruction sensing with it is described hard Before mapping relations between the memory space of disk, in addition to:
Detect whether the mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer change;
If changing, the address space of the HVA layers for the course allocation of the client computer is arranged to inaccessible.
With reference to the first or the second possible implementation of first aspect or first aspect, in the 4th kind of possible realization In mode, address on allocated address space in the HVA layers for establishing access instruction sensing with it is described hard Before mapping relations between the memory space of disk, in addition to:
Detect whether the mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer change;
If change, it is determined that the address on the GVA layers in the mapping relations to change, and determine described change Target HVA layer address corresponding to the address of the GVA layers in the mapping relations of change, the target HVA layer address are for institute State the address on the address space of the HVA layers of the course allocation of client computer;
The target HVA layer address is arranged to inaccessible.
With reference to any one possible implementation in the first of first aspect or first aspect to the 4th kind, In five kinds of possible implementations, methods described also includes:
For the same sector address space described at least two course allocations of the client computer on HVA layers;
And/or be address space corresponding to one section described in the course allocation of the client computer on HVA layers, different is described Address space corresponding to the process of client computer on the HVA layers differs.
Second aspect, embodiments of the invention provide a kind of device of internal memory virtualization, and described device is used for a kind of calculate Equipment, the computing device include internal memory and hard disk, and the address of cache level of the internal memory includes client virtual address (GVA)Layer, guest physical address(GPA)Layer, host virtual address(HVA)Layer, host physical address(HPA)Layer, institute Stating device includes:
Module is established in first mapping, for establishing the HVA layers to the mapping relations between the memory space of hard disk;
Address assignment module, address space is distributed in the HVA layers for the process for the client computer, and establish institute GVA layers are stated to the mapping relations between the allocated address space in the HVA layers;
Module is established in second mapping, the allocated address in the HVA layers pointed to for establishing the access instruction Address spatially is to the mapping relations between the memory space of the hard disk;
Data acquisition module, for obtaining target data from the host, the target data is by the host The data obtained according to the access instruction.
With reference to second aspect, in the first possible implementation of second aspect, the address assignment module includes:
Address determination unit, the address for determining on the GVA layers are a;
Allocation unit, for the address space described in the course allocation for the client computer on HVA layers, the HVA The initial address of address space on layer is b, and establish address b+as of the address a on the GVA layers to the HVA layers it Between mapping relations.
With reference to the possible implementation of the first of second aspect or second aspect, in second of possible implementation In, the initial address for the address space on the HVA layers of the course allocation of the client computer is b, and the access instruction refers to Address a+b on the HVA layers;
Module is established in second mapping to be included:
Instruction analysis unit, the address a on the GVA layers pointed to for determining the access instruction, and according to described GVA layers determine the address on the HVA layers corresponding to the address a on the GVA layers to the mapping relations between the HVA layers x;And according to the mapping relations between the memory spaces of the HVA layers to the hard disk, determine x pairs of address on the HVA layers Address z on the memory space for the hard disk answered;
Address mapping unit, the address a+b on the HVA layers pointed to specifically for establishing the access instruction is described in The mapping relations between the z of address on the memory space of hard disk.
With reference to the first or the second possible implementation of second aspect or second aspect, in the third possible realization In mode, described device also includes:
First detection module, it is empty for the allocated address in the HVA layers for establishing the access instruction sensing Between on address and the hard disk memory space between mapping relations before, corresponding to the process that detects the client computer Whether changed by the mapping relations of the GVA layers to the GPA layers;
First disabled module, if for changing, the address for the HVA layers of the course allocation of the client computer is empty Between be arranged to inaccessible.
With reference to the first or the second possible implementation of second aspect or second aspect, in the 4th kind of possible realization In mode, described device also includes:
Second detection module, it is empty for the allocated address in the HVA layers for establishing the access instruction sensing Between on address and the hard disk memory space between mapping relations before, corresponding to the process that detects the client computer Whether changed by the mapping relations of the GVA layers to the GPA layers;
Second disabled module, if for changing, it is determined that the ground on the GVA layers in the mapping relations to change Location, and the target HVA layer address corresponding to the address of the GVA layers in the mapping relations to be changed described in determination, by institute State target HVA layer address and be arranged to inaccessible, the target HVA layer address is for described in the course allocation of the client computer Address on the address space of HVA layers.
With reference to any one possible implementation in the first of second aspect or second aspect to the 4th kind, In five kinds of possible implementations, the address assignment module, specifically at least two course allocations for the client computer Same sector address space on the HVA layers;And/or it is one section of correspondence described in the course allocation of the client computer on HVA layers Address space, the address space corresponding to the process of the different client computer on the HVA layers differs.
A kind of method and device of internal memory virtualization provided in an embodiment of the present invention, the HVA layers can be established to hard disk Memory space between mapping relations;Address space is distributed in HVA layers for the process of client computer, and establishes GVA layers to HVA The mapping relations between allocated address space in layer;The allocated address established in the HVA layers of access instruction sensing Address spatially is to the mapping relations between the memory space of hard disk;Target data is obtained from host.For prior art, The embodiment of the present invention make use of file on the hard disk of host to establish by GVA layers to HVA layers as intermediary, by HVA layers to Hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers to the mapping relations between HPA layers, avoid Directly HVA layers are established to the mapping relations between HPA layers.When client computer runs process and sends access instruction, can pass through This mapping relations, the access instruction data to be obtained are obtained from HPA layers according to the address on GVA layers, it is directly right to avoid HVA layers are operated to the mapping relations between HPA layers, are obtained without modification kernel can by host from HPA layers Access evidence, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to directly HVA layers are reflected to HPA layers The relation of penetrating is operated, the operating system without changing host, it becomes possible to realize virtual machine in different hosts It is upper to use and do not influenceed by the operating system of host so that migration of the virtual machine in different system platforms be not using It is restricted again.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, it will use below required in embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for ability For the those of ordinary skill of domain, on the premise of not paying creative work, it can also be obtained according to these accompanying drawings other attached Figure.
Fig. 1 is a kind of flow chart of the method for internal memory virtualization provided in an embodiment of the present invention;
Fig. 2 a are a kind of flow of a kind of specific implementation of the method for internal memory virtualization provided in an embodiment of the present invention Figure;
Fig. 2 b, Fig. 2 c are that the illustration of mapping relations to HVA layers provided in an embodiment of the present invention of establishing GVA layers is illustrated Figure;
Fig. 3 is a kind of flow of another specific implementation of the method for internal memory virtualization provided in an embodiment of the present invention Figure;
Fig. 4 is a kind of flow of another specific implementation of the method for internal memory virtualization provided in an embodiment of the present invention Figure;
Fig. 5 a, Fig. 5 b, Fig. 5 c are specific real for another of a kind of method of internal memory virtualization provided in an embodiment of the present invention The flow chart of existing mode;
Fig. 5 d, Fig. 5 e, Fig. 5 f, Fig. 5 g are the act in the course allocation HVA spaces provided in an embodiment of the present invention for being client computer Example explanation schematic diagram;
Fig. 6 a, Fig. 6 b, Fig. 6 c are specific real for another of a kind of method of internal memory virtualization provided in an embodiment of the present invention The flow chart of existing mode;
Fig. 7 is a kind of structural representation of the device of internal memory virtualization provided in an embodiment of the present invention;
Fig. 8 is that a kind of structure of a kind of specific implementation of the device of internal memory virtualization provided in an embodiment of the present invention is shown It is intended to;
Fig. 9 is a kind of structure of another specific implementation of the device of internal memory virtualization provided in an embodiment of the present invention Schematic diagram;
Figure 10 is a kind of structural representation of computing device provided in an embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained all other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
The term used in embodiments of the present invention is only merely for the purpose of description specific embodiment, and is not intended to be limiting The present invention." one kind ", " described " and "the" of singulative used in the embodiment of the present invention and appended claims It is also intended to including most forms, unless context clearly shows that other implications.It is also understood that term used herein "and/or" refers to and any or all may be combined comprising the associated list items purpose of one or more.
Technical scheme provided in an embodiment of the present invention can apply to a kind of technical equipment, and the technical equipment comprises at least interior Deposit and hard disk, wherein, the address of cache level of internal memory includes GVA(Guest Virtual Address, client virtual address) Layer, GPA(Guest Physical Address, guest physical address)Layer, HVA(Host Virtual Address, host Machine virtual address)Layer, HPA(Host Physical Address, host physical address)Layer, and client computer can establish GVA layers Mapping relations be present between HVA layers in the mapping relations between GPA layers, GPA layers, wherein, GVA layers to reflecting between GPA layers The relation of penetrating can change, and the mapping relations between GPA layers and HVA layers immobilize.
The embodiments of the invention provide a kind of method of internal memory virtualization, as shown in figure 1, including:
101, the HVA layers are established to the mapping relations between the memory space of hard disk.
Wherein, VMM(Virtual Machine Monitor, monitor of virtual machine)In HVA layers corresponding to GPA layers Address space is distributed, and establishes the mapping in HVA layers between the address space of the corresponding distribution of GPA layers and the memory space of hard disk Relation.
Wherein, VMM can utilize host operating system in system calling function so that the memory space of hard disk with Mapping relations be present in HPA layers, such as:Can be with a newly-built null file in the memory space of hard disk, and HPA layers are mapped to On newly-built null file.
102, address space is distributed in the HVA layers for the process of the client computer, and establish the GVA layers described in The mapping relations between allocated address space in HVA layers.
Wherein, VMM be client computer process in HVA Layer assignment address spaces, and establish GVA corresponding to the process of client computer The mapping relations between the address space for the course allocation of client computer in address space and HVA layers on layer.
103, the address established on the allocated address space in the HVA layers that the access instruction is pointed to is described in Mapping relations between the memory space of hard disk.
Wherein, access instruction is established to the mapping relations between the memory space of hard disk using the HVA layers established in 101 The address on allocated address space in the HVA layers pointed to is to the mapping relations between the memory space of hard disk.Than Such as:The access instruction of the process of client computer points to the address s on GVA layers, according to GVA layers to the mapping relations between GPA layers, obtains The address t on GPA layers corresponding with the address s on GVA layers is obtained, is closed according to changeless mapping between GPA layers and HVA layers System, obtains the address m on HVA layers corresponding with the address t on GPA layers, and the address m being had been set up in 101 on HVA layers is arrived The mapping relations between the p of address on the memory space of hard disk, using in address s to the HVA layers on the GVA layers established in 102 Allocated address space on address n between mapping relations, the ground established on the allocated address space in HVA layers The mapping relations between the p of address on location n to the memory space of hard disk.
Wherein, if the instruction of the process of client computer is not access instruction, VMM normally simulates the function of the instruction;Such as The instruction of the process of fruit client computer is access instruction, but VMM is not the address space of course allocation HVA layers, then VMM is normal Simulate the function of the instruction.
104, obtain target data from the host.
Wherein, target data is the data obtained by host according to the access instruction.When the visit of the process of client computer When depositing the address on instruction access GVA layers, the mapping between allocated address spaces of the VMM in GVA layers to HVA layers is closed System, when pointing to the address on the allocated address space in HVA layers, host machine system is empty according to the storage of HVA layers to hard disk Between between mapping relations and hard disk memory space to HPA layers mapping relations, according to access instruction point to HVA layers on Address, target data is obtained from HPA layers.
A kind of method of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, and establishes GVA layers into HVA layers Mapping relations between allocated address space;Establish on the allocated address space in the HVA layers of access instruction sensing Address to the mapping relations between the memory space of hard disk;Target data is obtained from host.For prior art, the present invention Embodiment make use of file on the hard disk of host to establish by GVA layers to HVA layers as intermediary, by HVA layers to hard disk, By hard disk to the mapping relations HPA layers, so as to establish GVA layers to the mapping relations between HPA layers, avoid and directly build HVA layers are found to the mapping relations between HPA layers.When client computer runs process and sends access instruction, can be reflected by this Relation is penetrated, the access instruction data to be obtained are obtained from HPA layers according to the address on GVA layers, avoids and directly HVA layers is arrived Mapping relations between HPA layers are operated, and data are obtained from HPA layers by host without modification kernel can, Therefore during the process of operation of embodiment of the present invention client computer, it is not necessary to directly the mapping relations of HVA layers to HPA layers are entered Row operation, the operating system without changing host, it becomes possible to realize virtual machine on different hosts using simultaneously And do not influenceed by the operating system of host so that migration use of the virtual machine in different system platforms is no longer influenced by limit System.
Further, on the basis of the scheme shown in Fig. 1, the embodiment of the present invention additionally provides a kind of internal memory virtualization The concrete scheme of method, 102 and 103 implementation procedure shown in Fig. 1 are further refined, wherein, 102 can be specifically real It is now 1021-1022,103 can be implemented as 1031-1033, as shown in Figure 2 a, including:
1021, it is a to determine the address on the GVA layers.
Wherein, VMM can determine an address a on GVA layers, and being divided in GVA layers to HVA layers is established by address a Mapping relations between the address space matched somebody with somebody.
1022, it is the address space described in the course allocation of the client computer on HVA layers, the address on the HVA layers is empty Between initial address be b, and mapping relations established between address b+a of the address a on the GVA layers to the HVA layers.
Wherein, VMM is the address space on the course allocation HVA layers of client computer, and determines entering for client computer on HVA layers The initial address of address space of journey distribution is b, further according to the address a on the GVA layers determined in 1021, is established on GVA layers The mapping relations between the b+a of address on a and the HVA layer of address.
Wherein, while mapping relations between the address b+a on address a to the HVA layers on establishing GVA layers, also build The mapping relations between the page where the address b+a on the page to HVA layers where the address a on GVA layers are found, page can be with Including multiple addresses.
1031, the address a on the GVA layers that the access instruction is pointed to is determined, and according to the GVA layers described in Mapping relations between HVA layers, determine the address x on the HVA layers corresponding to the address a on the GVA layers.
Wherein, as shown in Figure 2 b, be client computer course allocation HVA layers on the initial address of address space be b, visit Deposit the address a+b on instruction sensing HVA layers.VMM is determined corresponding to address a+b on the HVA layers that access instruction is pointed on GVA layers Address a, the control register of the process page table of query client and correlation, obtain access rights and with GVA layers The information such as the address corresponding to a of address on GPA layers, the address a ' on GPA layers corresponding to the address a on GVA layers is determined, further according to GPA layers determine the address x on HVA layers corresponding to the address a ' on GPA layers, that is, determine GVA to the mapping relations between HVA layers Address x corresponding to address a on layer on HVA layers.
1032, according to the mapping relations between the memory space of the HVA layers to the hard disk, determine on the HVA layers Address x corresponding to the hard disk memory space on address z.
Wherein, as shown in Figure 2 c, according to the HVA layers established in 101 to the mapping relations between the memory space of hard disk, really Determine the address z on the memory space of hard disk corresponding to the address x on HVA layers.
1033, the address a+b on the HVA layers that the access instruction is pointed to is established to the memory space of the hard disk Address z between mapping relations.
Wherein, the mapping relations between the address z on the address a+b to the memory space of hard disk on HVA layers are established, and The authority of address a+b on HVA layers can be set.
A kind of method of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, address space initial address is b, is built Found the mapping relations between the address b+a on the address a to the HVA layers on the GVA layers;Establish access instruction sensing The address on allocated address space in HVA layers is to the mapping relations between the memory space of hard disk;Obtained from host Target data.For prior art, the embodiment of the present invention make use of file on the hard disk of host as intermediary, establish by GVA layers are to HVA layers, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers to HPA layers Between mapping relations, avoid and directly establish HVA layers to the mapping relations between HPA layers.When client computer operation process is concurrent When going out access instruction, it can obtain access instruction from HPA layers to be obtained according to the address on GVA layers by this mapping relations The data taken, avoid and directly HVA layers are operated to the mapping relations between HPA layers, without modification kernel just Data can be obtained from HPA layers by host, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to it is straight Connect and the mapping relations of HVA layers to HPA layers are operated, the operating system without changing host, it becomes possible to realize Virtual machine is used on different hosts and not influenceed by the operating system of host so that virtual machine is in different Migration use on system platform is no longer influenced by limitation;Meanwhile for client computer process HVA Layer assignments address space starting Address is b, and during address a on the access instruction memory access GVA layers of the process of client computer, VMM can directly access the ground on HVA layers Location b+a, the step of inquiry GVA layers are to the mapping relations between GPA layers and GPA layers to the mapping relations of HVA layers are eliminated, are reduced Time required for access instruction reference address, improve the efficiency of access instruction execution.
In addition, on the basis of the scheme shown in Fig. 2 a, the embodiment of the present invention additionally provides a kind of side of internal memory virtualization The concrete scheme of method, 105 and 106 can be increased to handle the GVA layers corresponding to the process of client computer to the mapping relations of GPA layers Situation about changing, as shown in figure 3, including:
105, whether detect mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer Change.
Wherein, when the instruction modification guest page table base register of the process of client computer, GVA layers to GPA layers Mapping relations change, and VMM can capture the exception that the mapping relations of GVA layers to GPA layers change, so as to examine Whether the mapping relations for surveying GVA layers to GPA layers change.
106, if changing, the address space for the HVA layers of the course allocation of the client computer is arranged to can not Access.
Wherein, VMM have registered SIGSEGV signal process functions, will if the mapping relations of GVA layers to GPA layers largely change Address space for the HVA layers of the course allocation of client computer is arranged to inaccessible, when the access instruction of the process of client computer refers to During to the address space of HVA layers for being arranged to inaccessible, it is different that SIGSEGV can occur for the access instruction of the process of client computer Often, if the mapping relations of GVA layers to GPA layers are illegal, such as:Address corresponding to access instruction on GVA layers is on GPA layers Mapping relations between address are not present, or between the address on the address corresponding to access instruction on GVA layers to GPA layers Mapping relations are present, but the authority of access instruction then marks beyond the authority of the address on GVA layers in client environment It is abnormal, transfer to Client OS to be handled;If the mapping relations of GVA layers to GPA layers are legal, i.e., corresponding to access instruction Mapping relations between the address on address to GPA layers on GVA layers are present, and the authority of access instruction is without departing from GVA layers On address authority, then using 1031-1033, GVA layers the reflecting to GPA layers changed according to corresponding to the process of client computer Penetrate relation, establish access instruction sensing HVA layers in allocated address space on address and hard disk memory space it Between mapping relations, and according to the memory space of hard disk to the mapping relations between HPA layers, by the address on the GVA layers of foundation The mapping relations between address on to HPA layers are added to the SPT in host page table(Shadow Page Table, shadow page Table)In.
Such as:The instruction modification of the process of client computer guest page table base register, and be not client process is cut Change, then the address space of the HVA layers for the course allocation is arranged to inaccessible.For another example:The instruction of the process of client computer Have modified guest page table base register, and be client process switching, and the new process of client computer and client computer it is any its Its process shares the address space space of same section of HVA layer, then is arranged to the address space of the HVA layers for the course allocation Inaccessible.
Wherein, if the mapping relations by GVA layers to GPA layers corresponding to the process of client computer do not change, keep former Some mapping relations are constant.
A kind of method of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, and establishes GVA layers into HVA layers Mapping relations between allocated address space;The mapping by GVA layers to GPA layers corresponding to the process of client computer is detected to close Whether system changes, if changing, the address space of the HVA layers for the course allocation of client computer is arranged into inaccessible;And build Closed to the mapping between the memory space of hard disk the address on allocated address space in the HVA layers that vertical access instruction is pointed to System;Target data is obtained from host.For prior art, the embodiment of the present invention make use of the file on the hard disk of host to make For intermediary, establish by GVA layers to HVA layers, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, so as to build GVA layers have been found to the mapping relations between HPA layers, has avoided and directly establishes HVA layers to the mapping relations between HPA layers.Work as visitor When family machine runs process and sends access instruction, it can be obtained by this mapping relations according to the address on GVA layers from HPA layers The data that access instruction to be obtained are taken, avoids and directly HVA layers is operated to the mapping relations between HPA layers, so as to Kernel can need not be changed and obtain data, therefore the process of operation client computer of the embodiment of the present invention from HPA layers by host During, it is not necessary to directly the mapping relations of HVA layers to HPA layers are operated, the behaviour without changing host Make system, it becomes possible to realize that virtual machine is used on different hosts and do not influenceed by the operating system of host, make Obtain migration use of the virtual machine in different system platforms and be no longer influenced by limitation;Moreover, when GVA layers to reflecting between GPA layers When the relation of penetrating changes, the address space of the HVA layers of the course allocation of client computer that mapping relations change is arranged to not by VMM It may have access to, and the mapping relations after change are added in the SPT in host page table, avoid making a mistake during memory access data, Keep the uniformity of SPT and guest page table.
In addition, on the basis of the scheme shown in Fig. 2 a, the embodiment of the present invention additionally provides a kind of side of internal memory virtualization The concrete scheme of method, 107-109 can also be increased and closed to handle the mapping of the GVA layers corresponding to the process of client computer to GPA layers It is situation about changing, as shown in figure 4, including:
107, whether detect mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer Change.
Wherein, when the instruction modification guest page table base register of the process of client computer, GVA layers to GPA layers Mapping relations change, and VMM can capture the modification to guest page table base register, so as to detect GVA layers Whether the mapping relations to GPA layers change.
108, if changing, it is determined that the address on the GVA layers in the mapping relations to change, and determine the hair Target HVA layer address corresponding to the address of the GVA layers in the raw mapping relations changed.
Wherein, target HVA layer address is the address on the address space of the HVA layers of the course allocation for client computer.Such as: Content in any client process page table of the instruction modification of the process of client computer, so as to changing the GVA of client process The mapping relations or authority that layer is arrived between GPA layers, it is determined that the address of the GPA layers in the mapping relations to change, and determine The address of HVA layers corresponding to the address of GPA layers in the mapping relations to change.For another example:The finger of the process of client computer Order, which passes through, changes such as DACR registers, FCSE register control registers, changes the interpretive mode of guest page table content, Such as the interpretive mode of access limit, so as to change GVA layers to the mapping relations or authority between GPA layers, it is determined that change The address of GPA layers in the mapping relations of change, and determine corresponding to the address of the GPA layers in the mapping relations that change The address of HVA layers.
Wherein, if the mapping relations by GVA layers to GPA layers corresponding to the process of client computer do not change, keep former Some mapping relations are constant.
109, the target HVA layer address is arranged to inaccessible.
Wherein, VMM only needs the address of HVA layers corresponding to the address for the GPA layers that will be determined in 108 to be arranged to inaccessible .If the page authority of the instruction modification current process of the process of client computer or a Page swap-out by client computer, this kind of to repair Change the GVA layers of operation change current process to the mapping relations between GPA layers, and the HVA layers of the course allocation for client computer The initial address of address space be x, the address of the HVA layers corresponding to the address of the GPA layers in the mapping relations to change For y, the address space size of change is S, then is arranged to the address space for the HVA layers that the size that initial address is x+y is S not It may have access to.
Wherein, newly distribute a page if the instruction of the process of client computer is current process or change to a page, this Generic operation can change guest page table, but effective respective items are not present in the caching of client computer and cache, this kind of guest page table Renewal, because the corresponding list item in corresponding SPT is disarmed state, when client computer accesses the memory pages, can be triggered SIGSEGV is abnormal, and using 1031-1033, the mapping of the GVA layers changed according to corresponding to the process of client computer to GPA layers is closed System, establish between the address on the allocated address space in the HVA layers of access instruction sensing and the memory space of hard disk Mapping relations, and according to the memory space of hard disk to the mapping relations between HPA layers, by the address on the GVA layers of foundation to HPA The mapping relations between address on layer are added in the SPT in host page table.
Wherein, if the instruction modification of the process of client computer be sluggish process page table, for this kind of page table update Operation is, it is necessary to add the modification of an inactive process page table of module monitors, to safeguard inactive client process page table and SPT Between uniformity.
A kind of method of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, and establishes GVA layers into HVA layers Mapping relations between allocated address space;The mapping by GVA layers to GPA layers corresponding to the process of client computer is detected to close Whether system changes, if changing, it is determined that the address on GVA layers in the mapping relations to change, and determine what is changed Target HVA layer address corresponding to the address of GVA layers in mapping relations, and target HVA layer address is arranged to inaccessible; And the address established on the allocated address space in the HVA layers of access instruction sensing is to reflecting between the memory space of hard disk Penetrate relation;Target data is obtained from host.For prior art, the embodiment of the present invention make use of the text on the hard disk of host Part is established by GVA layers to HVA layers as intermediary, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, from And GVA layers are established to the mapping relations between HPA layers, avoid and directly establish HVA layers to the mapping relations between HPA layers. , can be by this mapping relations, according to the address on GVA layers from HPA when client computer runs process and when sending access instruction Layer obtains the access instruction data to be obtained, and avoids and directly HVA layers are operated to the mapping relations between HPA layers, Data are obtained from HPA layers by host without modification kernel can, therefore the embodiment of the present invention runs client computer During process, it is not necessary to directly the mapping relations of HVA layers to HPA layers are operated, without changing host Operating system, it becomes possible to realize virtual machine used on different hosts and not by host operating system shadow Ring so that migration use of the virtual machine in different system platforms is no longer influenced by limitation;Moreover, when GVA layers are between GPA layers Mapping relations when changing, the address space of the HVA layers of the course allocation for the client computer that VMM changes mapping relations is set For inaccessible, and the mapping relations after change are added in the SPT in host page table, avoid occurring during memory access data wrong By mistake, the uniformity of SPT and guest page table is kept.
In addition, on the basis of the scheme shown in Fig. 3 and Fig. 1, the embodiment of the present invention additionally provides a kind of internal memory virtualization Method concrete scheme, the address space that 110a or 110b or 110c come on the course allocation HVA for client computer can be increased, As shown in Fig. 5 a, Fig. 5 b, Fig. 5 c, including:
110a, it is the same sector address space described at least two course allocations of the client computer on HVA layers.
Such as:As fig 5d, VMM can be that client process A and client process B is distributed from address m on HVA layers To this sector address space of address n, that is to say, that client process A and client process B shares the same sector address on HVA layers Space.
110b, it is address space corresponding to one section described in the course allocation of the client computer on HVA layers.
Wherein, the address space corresponding to the process of different client computer on HVA layers differs.Such as:As depicted in fig. 5e, VMM can be the sector address space that the process of client computer is individually distributed on HVA layers, and VMM is that client process A is assigned with from ground This sector address space of location m to address n, being assigned with this sector address space, VMM from address p to address q for consumer process B is The different address space of the course allocation of different client computer.
110c, it is the same sector address space described at least two course allocations of the client computer on HVA layers, meanwhile, For address space corresponding to one section described in the course allocation of client computer other described on HVA layers.
Such as:As shown in figure 5f, VMM can be same section on client process B and client process C distribution HVA layers Can also be that client process A individually distributes one section from address m to address n simultaneously from address p to address q address space, VMM Address space.
Optionally, when the user's space of client computer and the identical user's space size of host, memory headroom is laid out such as Shown in Fig. 5 g, the address space of address 0 to address A uses for client computer, and address A to address B address space uses for VMM. When the access instruction of the process for client computer of serving as interpreter generates local access instruction, if the access instruction of the process of client computer be not by What VMM was introduced, then only allow access instruction reference address 0 to arrive address A address space;If the access instruction of the process of client computer It is to be introduced by VMM, then allows access instruction to access the address space that VMM is used.When host is x86-32 architectures, , can be by the address of the HVA layers distributed for client process in order to prevent access instruction reference address from exceeding address space range Space is arranged to a section, and it is 0 to set the segment base in segment descriptor, and section limit for length is A, and visit is performed in the process of simulation client computer When depositing instruction, some segment register is set to point to the segment descriptor set, segment register can be FS registers etc..Such as:It is right In not being by the execution of the VMM access instructions introduced, it can be handled, be visited by the way of FS segment registers add section bias internal The address deposited on the GVA layers that instruction is pointed to is used as a section bias internal;For the execution of the access instruction introduced by VMM, can use DS segment registers, DS sections include the entirely address space by address 0 to address B.
Optionally, the scheme with reference to shown in Fig. 1, Fig. 4 and Fig. 5 a, Fig. 5 b, Fig. 5 c, obtained such as Fig. 6 a, Fig. 6 b, Fig. 6 c institutes Show a kind of concrete scheme of the method for internal memory virtualization, specific implementation is identical with above-mentioned steps, will not be repeated here.
A kind of method of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;For the same sector address space at least two course allocation HVA layers of client computer;And/or it is Address space corresponding to one section on the course allocation HVA layers of client computer, and the allocated ground established in GVA layers to HVA layers Mapping relations between the space of location;When performing the access instruction of process of client computer, establish in the HVA layers of access instruction sensing Allocated address space on address to the mapping relations between the memory space of hard disk;Number of targets is obtained from host According to.For prior art, the embodiment of the present invention make use of the file on the hard disk of host to be established as intermediary by GVA layers To HVA layers, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers between HPA layers Mapping relations, avoid and directly establish HVA layers to the mapping relations between HPA layers.When client computer operation process is concurrently gone aboard for visit When depositing instruction, it can obtain what access instruction to be obtained from HPA layers according to the address on GVA layers by this mapping relations Data, avoid and directly HVA layers are operated to the mapping relations between HPA layers, without changing kernel can Data are obtained from HPA layers by host, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to it is directly right The mapping relations of HVA layers to HPA layers are operated, the operating system without changing host, it becomes possible to are realized virtual Machine is used on different hosts and not influenceed by the operating system of host so that virtual machine is put down in different systems Migration use on platform is no longer influenced by limitation;Moreover, for client computer multiple different processes can individually distribute on HVA layers one Address space corresponding to section, and/or the same sector address space that can distribute on HVA layers of multiple different processes of client computer, increase The flexibility for the address space that HVA layers are distributed for client computer is added.
The embodiment of the present invention provides a kind of device 20 of internal memory virtualization, and described device is used for a kind of computing device, described Computing device includes internal memory and hard disk, and the address of cache level of the internal memory includes client virtual address(GVA)Layer, client Machine physical address(GPA)Layer, host virtual address(HVA)Layer, host physical address(HPA)Layer, as shown in fig. 7, internal memory The device 20 of virtualization can include:
Module 21 is established in first mapping, for establishing the HVA layers to the mapping relations between the memory space of hard disk.
Address assignment module 22, address space is distributed in the HVA layers for the process for the client computer, and established The GVA layers are to the mapping relations between the allocated address space in the HVA layers.
Module 23 is established in second mapping, the allocated ground in the HVA layers pointed to for establishing the access instruction The address of location spatially is to the mapping relations between the memory space of the hard disk.
Data acquisition module 24, for obtaining target data from the host, the target data is by the host The data that machine obtains according to the access instruction.
A kind of device of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, and establishes GVA layers into HVA layers Mapping relations between allocated address space;Establish on the allocated address space in the HVA layers of access instruction sensing Address to the mapping relations between the memory space of hard disk;Target data is obtained from host.For prior art, the present invention Embodiment make use of file on the hard disk of host to establish by GVA layers to HVA layers as intermediary, by HVA layers to hard disk, By hard disk to the mapping relations HPA layers, so as to establish GVA layers to the mapping relations between HPA layers, avoid and directly build HVA layers are found to the mapping relations between HPA layers.When client computer runs process and sends access instruction, can be reflected by this Relation is penetrated, the access instruction data to be obtained are obtained from HPA layers according to the address on GVA layers, avoids and directly HVA layers is arrived Mapping relations between HPA layers are operated, and data are obtained from HPA layers by host without modification kernel can, Therefore during the process of operation of embodiment of the present invention client computer, it is not necessary to directly the mapping relations of HVA layers to HPA layers are entered Row operation, the operating system without changing host, it becomes possible to realize virtual machine on different hosts using simultaneously And do not influenceed by the operating system of host so that migration use of the virtual machine in different system platforms is no longer influenced by limit System.
Optionally, as shown in figure 8, the address assignment module 22 can include:
Address determination unit 221, the address for determining on the GVA layers are a.
Allocation unit 222, it is described for the address space described in the course allocation for the client computer on HVA layers The initial address of address space on HVA layers is b, and establishes address b+as of the address a on the GVA layers to the HVA layers Between mapping relations.
Module 23 is established in second mapping to be included:
Instruction analysis unit 231, the address a on the GVA layers pointed to for determining the access instruction, and according to institute GVA layers are stated to the mapping relations between the HVA layers, determine the ground on the HVA layers corresponding to the address a on the GVA layers Location x;And according to the HVA layers to the mapping relations between the memory space of hard disk, determine that the address x on the HVA layers is corresponding The hard disk memory space on address z.
Wherein, the access instruction points to the address a+b on the HVA layers;For the institute of the course allocation of the client computer The initial address for stating the address space on HVA layers is b.
Address mapping unit 232, the address a+b on the HVA layers pointed to specifically for establishing the access instruction are arrived The mapping relations between the z of address on the memory space of the hard disk.
A kind of device of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;Address space is distributed in HVA layers for the process of client computer, address space initial address is b, is built Found the mapping relations between the address b+a on the address a to the HVA layers on the GVA layers;Establish access instruction sensing The address on allocated address space in HVA layers is to the mapping relations between the memory space of hard disk;Obtained from host Target data.For prior art, the embodiment of the present invention make use of file on the hard disk of host as intermediary, establish by GVA layers are to HVA layers, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers to HPA layers Between mapping relations, avoid and directly establish HVA layers to the mapping relations between HPA layers.When client computer operation process is concurrent When going out access instruction, it can obtain access instruction from HPA layers to be obtained according to the address on GVA layers by this mapping relations The data taken, avoid and directly HVA layers are operated to the mapping relations between HPA layers, without modification kernel just Data can be obtained from HPA layers by host, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to it is straight Connect and the mapping relations of HVA layers to HPA layers are operated, the operating system without changing host, it becomes possible to realize Virtual machine is used on different hosts and not influenceed by the operating system of host so that virtual machine is in different Migration use on system platform is no longer influenced by limitation;Meanwhile for client computer process HVA Layer assignments address space starting Address is b, and during address a on the access instruction memory access GVA layers of the process of client computer, VMM can directly access the ground on HVA layers Location b+a, the step of inquiry GVA layers are to the mapping relations between GPA layers and GPA layers to the mapping relations of HVA layers are eliminated, are reduced Time required for access instruction reference address, improve the efficiency of access instruction execution.
Further, as shown in figure 9, the device 20 of internal memory virtualization can also include:
First detection module 25, for the allocated address in the HVA layers for establishing the access instruction sensing Before mapping relations between address spatially and the memory space of the hard disk, corresponding to the process that detects the client computer The mapping relations by the GVA layers to the GPA layers whether change.
First disabled module 26, if for changing, by for the address of the HVA layers of the course allocation of the client computer Space is arranged to inaccessible.
It is optional side by side, it can also include:
Second detection module 27, for the allocated address in the HVA layers for establishing the access instruction sensing Before mapping relations between address spatially and the memory space of the hard disk, corresponding to the process that detects the client computer The mapping relations by the GVA layers to the GPA layers whether change.
Second disabled module 28, if for changing, it is determined that the ground on the GVA layers in the mapping relations to change Location, and the target HVA layer address corresponding to the address of the GVA layers in the mapping relations to be changed described in determination, by institute State target HVA layer address and be arranged to inaccessible, the target HVA layer address is for described in the course allocation of the client computer Address on the address space of HVA layers.
Further, in the present embodiment, the address assignment module 22, specifically at least two for the client computer Same sector address space described in individual course allocation on HVA layers;And/or for described in the course allocation of the client computer on HVA layers One section corresponding to address space, the address space corresponding to the process of the different client computer on the HVA layers differs.
A kind of device of internal memory virtualization provided in an embodiment of the present invention, storage of the HVA layers to hard disk can be established Mapping relations between space;For the same sector address space at least two course allocation HVA layers of client computer;And/or it is Address space corresponding to one section on the course allocation HVA layers of client computer, and the allocated ground established in GVA layers to HVA layers Mapping relations between the space of location;When performing the access instruction of process of client computer, establish in the HVA layers of access instruction sensing Allocated address space on address to the mapping relations between the memory space of hard disk;Number of targets is obtained from host According to.For prior art, the embodiment of the present invention make use of the file on the hard disk of host to be established as intermediary by GVA layers To HVA layers, by HVA layers to hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers between HPA layers Mapping relations, avoid and directly establish HVA layers to the mapping relations between HPA layers.When client computer operation process is concurrently gone aboard for visit When depositing instruction, it can obtain what access instruction to be obtained from HPA layers according to the address on GVA layers by this mapping relations Data, avoid and directly HVA layers are operated to the mapping relations between HPA layers, without changing kernel can Data are obtained from HPA layers by host, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to it is directly right The mapping relations of HVA layers to HPA layers are operated, the operating system without changing host, it becomes possible to are realized virtual Machine is used on different hosts and not influenceed by the operating system of host so that virtual machine is put down in different systems Migration use on platform is no longer influenced by limitation;Moreover, when GVA layers change to the mapping relations between GPA layers, VMM will The address space of the HVA layers of the course allocation for the client computer that mapping relations change is arranged to inaccessible, and by reflecting after change The relation of penetrating is added in the SPT in host page table, avoids making a mistake during memory access data, keeps SPT and guest page table Uniformity;Moreover, be address space corresponding to multiple different processes can individually distribute on HVA layers one section of client computer, and/ Or the same sector address space that multiple different processes of client computer can be distributed on HVA layers, add and distribute HVA layers for client computer Address space flexibility.
The embodiment of the present invention additionally provides a kind of structure of computing device 300, and as shown in Figure 10, the computing device 300 wraps Include:At least one processor 301, such as CPU, at least one network interface 304 or other users interface 303, hard disk 305, Internal memory 306, at least one communication bus 302.Communication bus 302 is used to realize the connection communication between these components.Optionally, Also include user interface 303, including display, keyboard or pointing device(For example, mouse, trace ball(trackball), touch Feel plate or touch sensitive display screen).Hard disk 305 can optionally include at least one storage for being located remotely from aforementioned processor 301 Device.
In some embodiments, hard disk 305 stores following element, can perform module either data structure or Their subset, or their superset:
Operating system 3051, comprising various system programs, for realizing that various basic businesses and processing are hardware based Task.
Application program 3052, comprising various application programs, for realizing various applied business, especially include and be used to realize The VMM of the embodiment of the present invention.
Include but is not limited to the first mapping in application program 3052 and establish module 21, the mapping of address assignment module 22, second Establish module 23, data acquisition module 24, address determination unit 221, allocation unit 222, instruction analysis unit 231, Location map unit 232, first detection module 25, the first disabled module 26, the second detection module 27, the second disabled module 28.
The specific implementation of each module is referring to the corresponding module in Fig. 7-9 illustrated embodiments in application program 3052, herein not Repeat.Processor 301 can obtain the data such as operating system 3051 and application program 3052 from hard disk 305, and be loaded onto interior In depositing 306, in order to which processor 301 runs or performed the data such as operating system 3051 and application program 3052.
Specifically, processor 301 is used for:The HVA layers are established using VMM to close to the mapping between the memory space of hard disk System;And address space is distributed in the HVA layers for the process of the client computer, and the GVA layers are established into the HVA layers Allocated address space between mapping relations;And establish being allocated in the HVA layers that the access instruction is pointed to Address space on address to the mapping relations between the memory space of the hard disk;And obtain number of targets from the host According to the target data is the data obtained by the host according to the access instruction.
Optionally, processor 301 specifically can be used for, and it is a that the address on the GVA layers is determined using VMM;And it is described Address space described in the course allocation of client computer on HVA layers, the initial address of the address space on the HVA layers is b, and is built Found the mapping relations between the address b+a on the address a to the HVA layers on the GVA layers.
Processor 301 specifically can be also used for determining the address on the GVA layers of the access instruction sensing using VMM A, and according to the GVA layers to the mapping relations between the HVA layers, determine described corresponding to the address a on the GVA layers Address x on HVA layers;And according to the HVA layers to the mapping relations between the memory space of hard disk, determine on the HVA layers Address x corresponding to the hard disk memory space on address z;And establish on the HVA layers that the access instruction is pointed to Address a+b to the memory space of the hard disk on address z between mapping relations.
Wherein, the access instruction points to the address a+b on the HVA layers;For the institute of the course allocation of the client computer The initial address for stating the address space on HVA layers is b;
Further, processor 301 can be also used for establishing the HVA layers of the access instruction sensing using VMM In allocated address space on address and the hard disk memory space between mapping relations before, detect the visitor Whether the mapping relations by the GVA layers to the GPA layers corresponding to the process of family machine change;To be described if changing The address space of the HVA layers of the course allocation of client computer is arranged to inaccessible.
Or using VMM on the allocated address space in the HVA layers for establishing the access instruction sensing Before mapping relations between the memory space of address and the hard disk, detect corresponding to the process of the client computer by described Whether the mapping relations of GVA layers to the GPA layers change;If change, it is determined that the GVA in the mapping relations to change Address on layer, and the target HVA layers corresponding to the address of the GVA layers in the mapping relations to be changed described in determination Location, the target HVA layer address is arranged to inaccessible, the target HVA layer address is the process point for the client computer Address on the address space for the HVA layers matched somebody with somebody.
It is further optional, in the present embodiment, processor 301, specifically it is additionally operable to as at least the two of the client computer Same sector address space described in individual course allocation on HVA layers;And/or for described in the course allocation of the client computer on HVA layers One section corresponding to address space, the address space corresponding to the process of the different client computer on the HVA layers differs.
A kind of computing device provided in an embodiment of the present invention, the HVA layers can be established between the memory space of hard disk Mapping relations;For the same sector address space at least two course allocation HVA layers of client computer;And/or it is client computer Address space corresponding to one section on course allocation HVA layers, and the allocated address space established in GVA layers to HVA layers it Between mapping relations;When performing the access instruction of process of client computer, being allocated in the HVA layers of access instruction sensing is established Address space on address to the mapping relations between the memory space of hard disk;Target data is obtained from host.For existing There is a technology, the embodiment of the present invention make use of file on the hard disk of host to establish by GVA layers to HVA layers as intermediary, by HVA layers are to hard disk, by hard disk to the mapping relations HPA layers, so as to establish GVA layers to the mapping relations between HPA layers, Avoid and directly establish HVA layers to the mapping relations between HPA layers., can when client computer runs process and sends access instruction By this mapping relations, to obtain the access instruction data to be obtained from HPA layers according to the address on GVA layers, avoid Directly HVA layers are operated to the mapping relations between HPA layers, without modification kernel can by host from HPA layers obtain data, therefore during the process of operation client computer of the embodiment of the present invention, it is not necessary to directly to HVA layers to HPA The mapping relations of layer are operated, the operating system without changing host, it becomes possible to realize virtual machine different Use and do not influenceed by the operating system of host on host so that migration of the virtual machine in different system platforms Limited using being no longer influenced by;Meanwhile be that the process of client computer in the initial address of the address space of HVA Layer assignments is b, client computer Process access instruction memory access GVA layers on address a when, VMM can directly access the address b+a on HVA layers, eliminate and look into The step of GVA layers are to the mapping relations between GPA layers and GPA layers to the mapping relations of HVA layers are ask, reduce access instruction access Time required for address, improve the efficiency of access instruction execution;Moreover, when GVA layers to the mapping relations hair between GPA layers Raw when changing, the address space of the HVA layers of the course allocation of client computer that mapping relations change is arranged to inaccessible by VMM, And the mapping relations after change are added in the SPT in host page table, avoid making a mistake during memory access data, keep SPT With the uniformity of guest page table;Moreover, one section of correspondence can individually distributing on HVA layers of multiple different processes for client computer Address space, and/or the same sector address space that can distribute on HVA layers of multiple different processes of client computer, add for The flexibility of the address space of client computer distribution HVA layers.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for equipment For applying example, because it is substantially similar to embodiment of the method, so describing fairly simple, related part is referring to embodiment of the method Part explanation.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory(Read-Only Memory, ROM)Or random access memory(Random Access Memory, RAM)Deng.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, the change or replacement that can readily occur in, all should It is included within the scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (12)

  1. A kind of 1. method of internal memory virtualization, it is characterised in that for a kind of computing device, the computing device comprises at least interior Deposit and hard disk, the address of cache level of the internal memory include client virtual address GVA layers, guest physical address GPA layers, place Main frame virtual address HVA layers, host physical address HPA layers, methods described include:
    The HVA layers are established to the mapping relations between the memory space of hard disk;
    Address space is distributed in the HVA layers for the process of the client computer, and establishes the GVA layers into the HVA layers Allocated address space between mapping relations;
    The storage of the address established on the allocated address space in the HVA layers of access instruction sensing to the hard disk is empty Between between mapping relations;
    Target data is obtained from the host, the target data is to be obtained by the host according to the access instruction Data.
  2. 2. the method for internal memory virtualization according to claim 1, it is characterised in that the process for the client computer exists Address space is distributed in the HVA layers, and establishes the GVA layers to reflecting between the allocated address space in the HVA layers Relation is penetrated, including:
    It is a to determine the address on the GVA layers;
    For the address space described in the course allocation of the client computer on HVA layers, the starting point of the address space on the HVA layers Location is b, and the mapping relations established between address b+a of the address a on the GVA layers to the HVA layers.
  3. 3. the method for internal memory virtualization according to claim 2, it is characterised in that be the course allocation of the client computer The initial address of address space on the HVA layers is b, and the access instruction points to the address a+b on the HVA layers;
    Address and the hard disk on allocated address space in the HVA layers for establishing access instruction sensing is deposited The mapping relations between space are stored up, including:
    The address a on the GVA layers that the access instruction is pointed to is determined, and according to the GVA layers between the HVA layers Mapping relations, determine the address x on the HVA layers corresponding to the address a on the GVA layers;
    According to the mapping relations between the memory space of the HVA layers to the hard disk, x pairs of address on the HVA layers is determined Address z on the memory space for the hard disk answered;
    The address z established on the address a+b to the memory space of the hard disk on the HVA layers that the access instruction is pointed to it Between mapping relations.
  4. 4. the method for internal memory virtualization according to claim 3, it is characterised in that establish what access instruction was pointed to described Before address on allocated address space in the HVA layers and the mapping relations between the memory space of the hard disk, Also include:
    Detect whether the mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer change;
    If changing, the address space of the HVA layers for the course allocation of the client computer is arranged to inaccessible.
  5. 5. the method for internal memory virtualization according to claim 3, it is characterised in that establish what access instruction was pointed to described Before address on allocated address space in the HVA layers and the mapping relations between the memory space of the hard disk, Also include:
    Detect whether the mapping relations by the GVA layers to the GPA layers corresponding to the process of the client computer change;
    If change, it is determined that the address on the GVA layers in the mapping relations to change, and changed described in determination Target HVA layer address corresponding to the address of the GVA layers in mapping relations, the target HVA layer address are for the visitor Address on the address space of the HVA layers of the course allocation of family machine;
    The target HVA layer address is arranged to inaccessible.
  6. 6. the method for the internal memory virtualization according to any one in claim 1-5, it is characterised in that also include:
    For the same sector address space described at least two course allocations of the client computer on HVA layers;
    Or, be each self-corresponding address space described in the course allocation of the client computer on HVA layers, wherein, different clients Address space corresponding to the process of machine on HVA layers differs;
    Or, be the same sector address space described at least two course allocations of the client computer on HVA layers, meanwhile, it is described Mutually different address space described in other course allocations of client computer on HVA layers, wherein, the mutually different address is empty Between in each address space it is different from the same sector address space.
  7. 7. a kind of device of internal memory virtualization, it is characterised in that described device is used for a kind of computing device, the computing device bag Internal memory and hard disk are included, the address of cache level of the internal memory includes client virtual address GVA layers, guest physical address GPA layers, host virtual address HVA layers, host physical address HPA layers, described device include:
    Module is established in first mapping, for establishing the HVA layers to the mapping relations between the memory space of hard disk;
    Address assignment module, address space is distributed in the HVA layers for the process for the client computer, and described in foundation GVA layers are to the mapping relations between the allocated address space in the HVA layers;
    Module is established in second mapping, on the allocated address space in the HVA layers for establishing access instruction sensing Address is to the mapping relations between the memory space of the hard disk;
    Data acquisition module, for from the host obtain target data, the target data be by the host according to The data that the access instruction obtains.
  8. 8. device according to claim 7, it is characterised in that the address assignment module includes:
    Address determination unit, the address for determining on the GVA layers are a;
    Allocation unit, for the address space described in the course allocation for the client computer on HVA layers, on the HVA layers The initial address of address space be b, and establish between address b+a of the address a on the GVA layers to the HVA layers Mapping relations.
  9. 9. device according to claim 8, it is characterised in that on the HVA layers for the course allocation of the client computer The initial address of address space be b, the access instruction points to the address a+b on the HVA layers;
    Module is established in second mapping to be included:
    Instruction analysis unit, the address a on the GVA layers pointed to for determining the access instruction, and according to the GVA layers Mapping relations between the HVA layers, determine the address x on the HVA layers corresponding to the address a on the GVA layers;And root According to the mapping relations between the memory space of the HVA layers to the hard disk, institute corresponding to the address x on the HVA layers is determined State the address z on the memory space of hard disk;
    Address mapping unit, the address a+b on the HVA layers pointed to specifically for establishing the access instruction to the hard disk Memory space on address z between mapping relations.
  10. 10. device according to claim 9, it is characterised in that also include:
    First detection module, for the allocated address space in the HVA layers for establishing the access instruction sensing Address and the hard disk memory space between mapping relations before, detect corresponding to the process of the client computer by institute Whether the mapping relations for stating GVA layers to the GPA layers change;
    First disabled module, if for changing, the address space of the HVA layers for the course allocation of the client computer is set It is set to inaccessible.
  11. 11. device according to claim 9, it is characterised in that also include:
    Second detection module, for the allocated address space in the HVA layers for establishing the access instruction sensing Address and the hard disk memory space between mapping relations before, detect corresponding to the process of the client computer by institute Whether the mapping relations for stating GVA layers to the GPA layers change;
    Second disabled module, if for changing, it is determined that the address on the GVA layers in the mapping relations to change, and It is determined that the target HVA layer address corresponding to the address of GVA layers in the mapping relations to change, by the target HVA layer address is arranged to inaccessible, and the target HVA layer address is the HVA layers of the course allocation for the client computer Address space on address.
  12. 12. according to the device described in any one in claim 7-11, it is characterised in that the address assignment module, specifically For the same sector address space described at least two course allocations for the client computer on HVA layers;Or, it is the client computer Course allocation described in each self-corresponding address space on HVA layers, wherein, HVA layers corresponding to the process of different client computer On address space differ;It is or, empty for the same sector address described at least two course allocations of the client computer on HVA layers Between, meanwhile, it is the mutually different address space described in other course allocations of the client computer on HVA layers, wherein, it is described mutual Each address space is different from the same sector address space in the address space differed.
CN201310752024.8A 2013-12-31 2013-12-31 A kind of method and device of internal memory virtualization Active CN104750623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310752024.8A CN104750623B (en) 2013-12-31 2013-12-31 A kind of method and device of internal memory virtualization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310752024.8A CN104750623B (en) 2013-12-31 2013-12-31 A kind of method and device of internal memory virtualization

Publications (2)

Publication Number Publication Date
CN104750623A CN104750623A (en) 2015-07-01
CN104750623B true CN104750623B (en) 2017-11-24

Family

ID=53590348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310752024.8A Active CN104750623B (en) 2013-12-31 2013-12-31 A kind of method and device of internal memory virtualization

Country Status (1)

Country Link
CN (1) CN104750623B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159742A (en) * 2015-07-06 2015-12-16 北京星网锐捷网络技术有限公司 Unvarnished transmission method and system for PCI device of virtual machine
CN107038121B (en) 2016-02-03 2020-11-17 华为技术有限公司 Memory address allocation method and device for virtual machine
WO2018103022A1 (en) * 2016-12-07 2018-06-14 深圳前海达闼云端智能科技有限公司 Method and apparatus for achieving frame buffering, electronic device and computer program product
CN107193759A (en) * 2017-04-18 2017-09-22 上海交通大学 The virtual method of device memory administrative unit
US10387325B2 (en) * 2017-11-28 2019-08-20 International Business Machines Corporation Dynamic address translation for a virtual machine
CN112540828A (en) * 2020-12-11 2021-03-23 成都云铀子网络科技有限公司 Virtual machine implementation method for general CPU self-interpreting instruction execution

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473139A (en) * 2009-07-24 2012-05-23 超威半导体公司 I/O memory management unit including multilevel address translation for I/O and computation offload
CN102567217A (en) * 2012-01-04 2012-07-11 北京航空航天大学 MIPS platform-oriented memory virtualization method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8275971B2 (en) * 2008-08-27 2012-09-25 International Business Machines Corporation Method and apparatus for managing software controlled cache of translating the physical memory access of a virtual machine between different levels of translation entities

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473139A (en) * 2009-07-24 2012-05-23 超威半导体公司 I/O memory management unit including multilevel address translation for I/O and computation offload
CN102567217A (en) * 2012-01-04 2012-07-11 北京航空航天大学 MIPS platform-oriented memory virtualization method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
虚拟机Xen及其内存管理研究;郭晓琼;《中国优秀硕士学位论文全文数据库 信息科技辑》;20080715;第2008年卷(第7期);全文 *

Also Published As

Publication number Publication date
CN104750623A (en) 2015-07-01

Similar Documents

Publication Publication Date Title
CN104750623B (en) A kind of method and device of internal memory virtualization
US10365938B2 (en) Systems and methods for managing data input/output operations in a virtual computing environment
CN104239238B (en) Method and apparatus for managing translation lookaside buffering
US9699251B2 (en) Mechanism for providing load balancing to an external node utilizing a clustered environment for storage management
US7549022B2 (en) Avoiding cache line sharing in virtual machines
CN102968331B (en) A kind of virtual machine management system and file access method thereof
US20180046581A1 (en) Page-Fault Latency Directed Virtual Machine Performance Monitoring
US20120023300A1 (en) Memory page management in a tiered memory system
US20030110173A1 (en) Methods and apparatus for managing multiple user systems
US11119942B2 (en) Facilitating access to memory locality domain information
CN103065084B (en) In the windows hidden process detection method that external machine of virtual machine is carried out
US11132290B2 (en) Locality domain-based memory pools for virtualized computing environment
CN103389884A (en) Method for processing input/output request, host, server and virtual machine
CN107633171A (en) Device customizes white list
US9176889B1 (en) Virtual machine memory management
CN107977573A (en) The disk access control of safety
US9766913B2 (en) Method and system for managing peripheral devices for virtual desktops
US9753833B2 (en) Workload selection and cache capacity planning for a virtual storage area network
CN110442537A (en) Independent branch target buffer for different grades of calling
US20160357593A1 (en) Methods and apparatus for providing hypervisor level data services for server virtualization
CN103262034B (en) By data partition to virtual machine
US8255431B2 (en) Managing memory
CN106354543B (en) A kind of NUMA memory converted based on virtual machine and host memory address moves a page method
CN109074321A (en) For protecting the technology of the memory page of virtual computing example
US20190370079A1 (en) Hypervisor attached volume group load balancing

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant