CN112099907B - Virtual machine operation method, device and server - Google Patents
Virtual machine operation method, device and server Download PDFInfo
- Publication number
- CN112099907B CN112099907B CN202010874312.0A CN202010874312A CN112099907B CN 112099907 B CN112099907 B CN 112099907B CN 202010874312 A CN202010874312 A CN 202010874312A CN 112099907 B CN112099907 B CN 112099907B
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- address
- virtual
- processor
- space identifier
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000013507 mapping Methods 0.000 claims abstract description 100
- 239000000872 buffer Substances 0.000 claims abstract description 54
- 238000013519 translation Methods 0.000 claims abstract description 54
- 238000010586 diagram Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011010 flushing procedure Methods 0.000 description 1
- 239000003999 initiator Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000010926 purge Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The embodiment of the invention discloses a virtual machine operation method, a virtual machine operation device and a virtual machine server. Relates to the technical field of computers. Comprising the following steps: starting a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier; clearing a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier; and after the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared, the first virtual machine is operated. Resource conflicts can be avoided when other virtual machines are addressed based on the address space identifier, so that the virtual machines can be ensured to normally operate under the condition of sharing the address space identifier.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a virtual machine operation method, device, and server.
Background
A processor (CPU, central processing unit) supporting hardware virtualization uses an address space identifier (ASID, address Space Identifier) to distinguish between different Virtual machines (Virtual machines), and different Virtual machines use different ASIDs to isolate CPU resources between Virtual machines. However, in the case of an insufficient number of ASIDs, the virtual machines must share the ASID, for example, the virtual machines of the same user may use the same ASID.
The inventor finds in the process of realizing the invention: sharing ASID by virtual machines may cause resource conflicts in translation lookaside buffers (TLB, translation Lookaside Buffer; chinese is also translated into a fast table or page table cache) within the CPU, which may cause the virtual machines to fail to operate properly.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method, an apparatus, and a server for operating a virtual machine, so as to ensure that the virtual machine can operate normally under the condition of sharing an address space identifier.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical scheme:
in one aspect, an embodiment of the present invention provides a method for operating a virtual machine, including: starting a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
clearing a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier;
and after the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared, the first virtual machine is operated.
Optionally, determining whether a virtual machine having a first address space identifier is running on the first processor;
if so, judging whether the virtual machine with the first address space identifier which is operated last time on the first processor and the first virtual machine are the same virtual machine or not;
if the virtual machine is not the same virtual machine, the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared.
Optionally, after determining whether the virtual machine with the first address space identifier last run on the first processor is the same virtual machine as the first virtual machine, the method further includes: and if the virtual machine with the first address space identifier and the first virtual machine which are operated on the first processor are the same virtual machine, directly operating the first virtual machine.
Optionally, the clearing the mapping relationship between the virtual address and the physical address cached in the translation look-aside buffer in the first processor includes:
the mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in a first processor having the first address space identifier is cleared.
Optionally, after running the first virtual machine, the method further comprises:
obtaining a mapping relation between a virtual address and a physical address from a page table;
constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table;
the mapping relationship between the virtual address and the physical address having the first address space identifier is stored in a translation look-aside buffer in the first processor.
The running method of the virtual machine provided by the embodiment of the invention is that after the first virtual machine is started; clearing a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier; and after the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared, the first virtual machine is operated. Therefore, by clearing the mapping relation between the virtual address with the address space identifier and the physical address cached in the translation look-aside buffer in the first processor after the first virtual machine is started, when other virtual machines with the same address space identifier are started to run on the first processor, resource conflict can be avoided when other virtual machines are addressed based on the address space identifier, so that the virtual machines can be ensured to run normally under the condition of sharing the address space identifier.
Further, the virtual machine running method solves the technical problem of resource conflict when a plurality of virtual machines share the address space identifier for addressing, so that more virtual machines can be run in a sharing mode under the condition that the number of the address space identifiers is limited, and the number of the virtual machines supported by a physical processor can be expanded.
In a second aspect, an embodiment of the present invention provides a virtual machine running apparatus, which is characterized in that the virtual machine running apparatus includes: starting a program module, clearing the program module and running the program module;
the starting program module is used for starting the first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
the clearing program module is used for clearing the mapping relation between the virtual address and the physical address cached in the translation backup buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier;
the running program module is configured to run the first virtual machine after clearing a mapping relationship between a virtual address and a physical address cached in a translation look-aside buffer in the first processor.
Optionally, the clearing program module includes:
a first judging unit for judging whether a virtual machine with a first address space identifier is run on the first processor;
the second judging unit is used for judging whether the virtual machine with the first address space identifier, which is operated last time on the first processor, and the first virtual machine are the same virtual machine or not if the virtual machine is operated last time;
and the clearing unit is used for clearing the mapping relation between the virtual address and the physical address cached in the translation backup buffer in the first processor if the virtual address and the physical address are not the same virtual machine.
Optionally, the second judging unit is further configured to directly run the first virtual machine if it is judged that the virtual machine with the first address space identifier that has been run last time on the first processor is the same virtual machine as the first virtual machine.
Optionally, the clearing program module is specifically configured to clear a mapping relationship between a virtual address having the first address space identifier and a physical address cached in a translation look-aside buffer in the first processor.
Optionally, the apparatus comprises: the address mapping construction program module is used for acquiring the mapping relation between the virtual address and the physical address from the page table after the first virtual machine is operated;
constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table;
and the cache program module is used for storing the mapping relation between the virtual address with the first address space identifier and the physical address in a translation backup buffer in the first processor.
In a third aspect, an embodiment of the present invention provides a server, where the server includes a processor, and a virtual machine manager is configured on the processor, and the virtual machine manager is configured to perform the method in any one of the first aspects.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium storing one or more programs executable by one or more processors to implement the method of operation of any of the first aspects.
The virtual machine running device, the server and the storage medium provided by the embodiment of the invention are used for starting the first virtual machine after the starting program module starts the first virtual machine; clearing a mapping relationship between a virtual address and a physical address cached in a translation look-aside buffer in a first processor by using an operating program module; the mapping relation between the virtual address and the physical address is provided with an address space identifier; the running program module runs the first virtual machine after clearing the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor. Therefore, by clearing the mapping relation between the virtual address with the address space identifier and the physical address cached in the translation look-aside buffer in the first processor after the first virtual machine is started, when other virtual machines with the same address space identifier are started to run on the first processor, resource conflict can be avoided when other virtual machines are addressed based on the address space identifier, so that the virtual machines can be ensured to run normally under the condition of sharing the address space identifier.
Further, the virtual machine running method solves the technical problem of resource conflict when a plurality of virtual machines share address space identifiers for addressing, so that more virtual machines can be run in a sharing mode under the condition that the ASID number is limited, and the number of virtual machines supported by a physical processor can be expanded.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram illustrating a TLB mapping conflict occurring in a virtual machine sharing ASID according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method for operating a virtual machine according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for operating a virtual machine according to another embodiment of the present invention;
FIG. 4 is a schematic flow chart of creating, running and destroying a virtual machine according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a virtual machine running apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an embodiment of the server of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The limited number of ASIDs supported by the CPU results in an inability to run a sufficient number of virtual machines. In the case where ASID is not sufficient, a virtual machine manager (VMM, virtual Machine Manager, chinese also referred to as a virtual machine monitor) schedules virtual machines, runs only virtual machines with high priority, or lets virtual machines use ASID in turn.
In order to expand the number of virtual machines operated by the CPU, based on the technical concept that multiple virtual machines share the ASID provided in the embodiments of the present application, for example, virtual machines of the same user may commonly use the same ASID, so that the number of virtual machines operated by the CPU can be expanded.
However, the inventors of the present application found in the process of inventing based on the technical idea that virtual machines share ASID: if two or more virtual machines run using the same ASID, because there is an overlap between the virtual machine address spaces of different virtual machines, a mapping relationship between one ASID and two physical addresses may be generated, as shown in fig. 1, which further causes a problem that TLB mapping conflicts occur when TLB addressing occurs, and the virtual machine cannot determine which mapping relationship should be based on which addressing, thereby possibly causing the virtual machine to fail to operate normally.
In order to solve the above problem, an embodiment of the present invention provides a method for operating a virtual machine, as shown in fig. 2, where the method includes:
step S101, starting a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier.
The first processor is a physical processor; before starting a virtual machine, a virtual machine manager is required to be used for creating the virtual machine, and operations such as naming, ASID allocation, memory allocation and the like can be performed on the virtual machine in the process of creating the virtual machine; the virtual machine manager may be, for example, virt-manager software.
Step S102, clearing a mapping relationship between Virtual Addresses (VA) and Physical Addresses (PA) cached in a translation lookaside buffer TLB of a first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier.
TLB, which is a separate cache in a block of memory management unit (MMU, memory Management Unit) for caching the mapping relationship between virtual addresses and physical addresses, the cached mapping relationship is generally called Page Table Entry (PTE); when the CPU addresses through the memory management unit, if the mapping relation between the corresponding virtual address and the physical address exists in the TLB, which is commonly called hit, the physical address is directly found according to the mapping relation; if the TLB does not exist, a first-level page table is needed to acquire the physical address, and the mapping relation between the virtual address and the physical address is cached in the TLB so as to quickly find the corresponding physical address at the next time. Where a page table (Pagetable) is used to store a set of mappings of virtual addresses and physical addresses.
Step S103, after clearing the mapping relationship between the virtual address and the physical address cached in the translation lookaside buffer TLB in the first processor, running the first virtual machine.
As described above, the virtual machine address spaces of different virtual machines overlap, that is, the same virtual address of different processes corresponds to different physical addresses, and those skilled in the art can distinguish between different ASIDs of virtual machines. Thus, the correct physical address can be found in the TLB by a different ASID and virtual address. However, this way of resolving TLB address conflicts (Flush) does not allow the CPU to run enough virtual machines due to the limited number of ASIDs.
Referring to fig. 4, in this embodiment, a first virtual machine is operated by clearing a mapping relationship between a virtual address with an ASID and a physical address cached in a translation lookaside buffer TLB in a first processor, and after the first virtual machine exits, destroying the virtual machine, and releasing the ASID of the first virtual machine and a memory of the TLB; when other virtual machines are operated, the virtual machine manager distributes the ASID to the other virtual machines, and as the page table entries of the mapping relation between the virtual address corresponding to the ASID and the physical address cached in the TLB in advance are cleared, the page table entries of the new mapping relation are cached in the TLB again for addressing, so that the problem of TLB mapping conflict when the same ASID is shared for addressing can be avoided. The running method of the virtual machine provided by the embodiment of the invention is that after the first virtual machine is started; clearing a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier; and after the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared, the first virtual machine is operated. Therefore, by clearing the mapping relation between the virtual address with the address space identifier and the physical address cached in the translation look-aside buffer in the first processor after the first virtual machine is started, when other virtual machines with the same address space identifier are started to run on the first processor, resource conflict can be avoided when other virtual machines are addressed based on the address space identifier, so that the virtual machines can be ensured to run normally under the condition of sharing the address space identifier.
Further, the virtual machine running method solves the technical problem of resource conflict when a plurality of virtual machines share the address space identifier for addressing, so that more virtual machines can be run in a sharing mode under the condition that the number of the address space identifiers is limited, and the number of the virtual machines supported by a physical processor can be expanded.
It will be appreciated that if the first virtual machine is running after each clearing of the page table entry of the mapping relationship in the TLB; one-level-one lookup from a set of mappings stored in a page table (the page table is hierarchical) is required to obtain a physical address, and a mapping relationship from a virtual address to the physical address is re-established in the TLB, which greatly reduces the virtual machine operation efficiency.
Therefore, in order to compromise virtual machine operation efficiency, it may be set to flush TLB when necessary to optimize operation performance.
Specifically, referring to fig. 3, after the first virtual machine is started in step S101, the method further includes the steps of:
it is determined whether a virtual machine having a first address space identifier is running on the first processor.
Determining whether the first processor has run a virtual machine having a first address space identifier may be determined by querying a virtual machine running log to determine whether a virtual machine having the same ASID has been run.
If so, judging whether the virtual machine with the first address space identifier which is operated last time on the first processor and the first virtual machine are the same virtual machine or not;
as described above, when creating a virtual machine, a virtual machine may be named, a virtual machine ID (VMID for short in english) may be created, and as some possible implementations, after determining that a virtual machine with the same ASID is running, whether the virtual machine is consistent or not may be determined by comparing the name or VMID of the current virtual machine with the name or VMID of the previously running virtual machine, and if the virtual machine is consistent, the virtual machine is the same virtual machine; if not, then the same virtual machine is not used.
If the virtual machine is judged not to be the same virtual machine, the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared.
By flushing the TLB page table entry on the first processor that includes this ASID, it is possible to prevent the page table entry cached in the TLB by the current virtual machine from colliding with the TLB page table entry cached by the virtual machine that has the same ASID previously running.
In addition, if the virtual machine with the same ASID that has been executed last time on the first processor is the same virtual machine as the first virtual machine that is currently executed, there is no problem of TLB addressing conflict, and it is unnecessary to purge the page table entry of the TLB cache. Thus, in some embodiments, if the virtual machine with the first address space identifier that was run on the first processor is the same virtual machine as the first virtual machine, then the first virtual machine is run directly.
With continued reference to fig. 3, after the first virtual machine is running, the first virtual machine is updated and stored to provide a basis for determining whether the page table entry cached in the address translation look-aside buffer needs to be cleared for the second virtual machine when running. The second virtual machine and the first virtual machine run on the same physical CPU.
The clearing of the mapping relationship between the virtual address and the physical address cached in the translation look-aside buffer in the first processor includes: the mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in a first processor having the first address space identifier is cleared.
In some embodiments, after running the first virtual machine, the method further comprises:
obtaining a mapping relation between a virtual address and a physical address from a page table; constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table; the mapping relationship between the virtual address and the physical address having the first address space identifier is stored in a translation look-aside buffer in the first processor. Therefore, when addressing is performed next time, the cached page table item can be directly hit in the TLB, so that quick addressing is realized, the problem of delay of first-level searching of the physical address through the page table is avoided, and the running performance is improved.
Example two
FIG. 5 is a schematic block diagram of a virtual machine running apparatus according to an embodiment of the present invention. Referring to fig. 5, the apparatus includes: a start-up program module 210, a purge program module 220, and an run program module 230;
the initiator module 210 is configured to initiate a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
the clearing program module 220 is configured to clear a mapping relationship between a virtual address and a physical address cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier;
the operation program module 230 is configured to operate the first virtual machine after clearing a mapping relationship between a virtual address and a physical address cached in a translation look-aside buffer in the first processor.
In the virtual machine running device provided by the embodiment of the present invention, after the starting program module 210 starts the first virtual machine; clearing, with the run program module 220, a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier; the run program module 230 runs the first virtual machine after clearing the mapping relationship between the virtual address and the physical address cached in the translation look-aside buffer in the first processor. Therefore, by clearing the mapping relation between the virtual address with the address space identifier and the physical address cached in the translation look-aside buffer in the first processor after the first virtual machine is started, when other virtual machines with the same address space identifier are started to run on the first processor, resource conflict can be avoided when other virtual machines are addressed based on the address space identifier, so that the virtual machines can be ensured to run normally under the condition of sharing the address space identifier.
Further, the virtual machine running method solves the technical problem of resource conflict when a plurality of virtual machines share address space identifiers for addressing, so that more virtual machines can be run in a sharing mode under the condition that the ASID number is limited, and the number of virtual machines supported by a physical processor can be expanded.
In one embodiment of the present invention, the purge program module 220 includes:
a first judging unit for judging whether a virtual machine with a first address space identifier is run on the first processor;
the second judging unit is used for judging whether the virtual machine with the first address space identifier, which is operated last time on the first processor, and the first virtual machine are the same virtual machine or not if the virtual machine is operated last time;
and the clearing unit is used for clearing the mapping relation between the virtual address and the physical address cached in the translation backup buffer in the first processor if the virtual address and the physical address are not the same virtual machine.
Specifically, the second determining unit is further configured to directly run the first virtual machine if it is determined that the virtual machine with the first address space identifier that has been run last time on the first processor is the same virtual machine as the first virtual machine.
The clearing program module is specifically configured to clear a mapping relationship between a virtual address having the first address space identifier and a physical address cached in a translation look-aside buffer in a first processor.
In still other embodiments of the present invention, the apparatus comprises: the address mapping construction program module is used for acquiring the mapping relation between the virtual address and the physical address from the page table after the first virtual machine is operated;
constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table;
and the cache program module is used for storing the mapping relation between the virtual address with the first address space identifier and the physical address in a translation backup buffer in the first processor.
The virtual machine operation device provided in the embodiment of the present invention is similar to the basic implementation principle and technical effects of the virtual machine operation method in the first embodiment, and the details of the virtual machine operation device are not described in detail herein.
According to the specific description, the virtual machine operation method and the device provided by the embodiment of the invention can ensure that the virtual machine has no TLB resource addressing conflict under the condition of sharing ASID, and can optimize the virtual machine operation performance; further, under the condition that the number of ASIDs is limited, more virtual machines can be operated in a sharing mode, so that the number of virtual machines supported by a physical processor to operate can be expanded.
The embodiment of the invention also provides a server, which comprises a processor, wherein a virtual machine manager is configured on the processor, and the virtual machine manager executes the method in any embodiment.
The virtual machine manager further includes means for performing any of the method embodiments described in any of the preceding embodiments.
Fig. 6 is a schematic structural diagram of an embodiment of a server according to the present invention, as shown in fig. 6, where the server may include: the processor 72 and the memory 73 are arranged on the circuit board 74, wherein the circuit board 74 is arranged in a space surrounded by the shell 71; a power supply circuit 75 for supplying power to the respective circuits or devices of the server; memory 73 is used to store executable program code; a virtual machine manager is configured on the processor, and runs a program corresponding to the executable program code by reading the executable program code stored in the memory 73, for executing the steps of: starting a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
clearing a mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier;
and after the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor is cleared, the first virtual machine is operated.
The specific execution process of the steps and the steps further executed by the virtual machine manager through the execution of the executable program code by the virtual machine manager can be referred to the description of any one embodiment of the embodiments of the present invention, and will not be repeated herein.
The server exists in a variety of forms including, but not limited to:
(1) A mobile communication device: such devices are characterized by mobile communication capabilities and are primarily aimed at providing voice, data communications. Such terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, etc.
(2) Ultra mobile personal computer device: such devices are in the category of personal computers, having computing and processing functions, and generally also having mobile internet access characteristics. Such terminals include: PDA, MID, and UMPC devices, etc., such as iPad.
(3) portable entertainment device: such devices may display and play multimedia content. The device comprises: audio, video players (e.g., iPod), palm game consoles, electronic books, and smart toys and portable car navigation devices.
(4) The configuration of the server includes a processor, a hard disk, a memory, a system bus, and the like, and the server is similar to a general computer architecture, but is required to provide highly reliable services, and thus has high requirements in terms of processing capacity, stability, reliability, security, scalability, manageability, and the like.
(5) Other servers with data interaction functions.
Still further embodiments of the present invention provide a computer-readable storage medium storing one or more programs executable by one or more processors to implement the virtual machine operation method according to any one of the embodiments
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.
Claims (8)
1. A method for operating a virtual machine, comprising:
starting a first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
judging whether a virtual machine with a first address space identifier runs on a first processor;
if so, judging whether the virtual machine with the first address space identifier which is operated last time on the first processor and the first virtual machine are the same virtual machine or not;
if the virtual machine is not the same virtual machine, clearing the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier;
after clearing the mapping relation between the virtual address and the physical address cached in the translation look-aside buffer in the first processor, running the first virtual machine;
after running the first virtual machine, the method further comprises:
obtaining a mapping relation between a virtual address and a physical address from a page table;
constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table;
storing a mapping relationship between a virtual address having a first address space identifier and a physical address in a translation look-aside buffer in a first processor;
after the operation of the first virtual machine is finished, updating and storing the first virtual machine so as to provide a judging basis for judging whether the mapping relation between the virtual address and the physical address cached by the translation backup buffer is required to be cleared or not for the operation of the second virtual machine; the second virtual machine runs on the first processor.
2. The method of operating a virtual machine of claim 1, further comprising:
and if the virtual machine with the first address space identifier, which is operated last time on the first processor, and the first virtual machine are the same virtual machine, directly operating the first virtual machine.
3. The method of claim 1, wherein the clearing the mapping between the virtual address and the physical address cached in the translation look-aside buffer in the first processor comprises:
the mapping relationship between virtual addresses and physical addresses cached in a translation look-aside buffer in a first processor having the first address space identifier is cleared.
4. A virtual machine operation device, comprising: starting a program module, clearing the program module and running the program module;
the starting program module is used for starting the first virtual machine; the first virtual machine is configured with a first processor, and the address space identifier of the first virtual machine is a first address space identifier;
the clearing program module is used for clearing the mapping relation between the virtual address and the physical address cached in the translation backup buffer in the first processor; the mapping relation between the virtual address and the physical address is provided with an address space identifier; the purge program module includes: a first judging unit for judging whether a virtual machine with a first address space identifier is run on the first processor; the second judging unit is used for judging whether the virtual machine with the first address space identifier, which is operated last time on the first processor, and the first virtual machine are the same virtual machine or not if the virtual machine is operated last time; the clearing unit is used for clearing the mapping relation between the virtual address and the physical address cached in the translation backup buffer in the first processor if the virtual address and the physical address are not the same virtual machine;
the running program module is configured to run the first virtual machine after clearing a mapping relationship between a virtual address and a physical address cached in a translation look-aside buffer in the first processor;
the device comprises: the address mapping construction program module is used for acquiring the mapping relation between the virtual address and the physical address from the page table after the first virtual machine is operated; constructing a mapping relation between the virtual address with the first address space identifier and the physical address according to the first address space identifier and the mapping relation between the virtual address and the physical address acquired from a page table;
a cache program module for storing the mapping relationship between the virtual address having the first address space identifier and the physical address in a translation look-aside buffer in the first processor;
the storage module is used for updating and storing the first virtual machine after the operation of the first virtual machine is finished, so as to provide a judging basis for judging whether the mapping relation between the virtual address and the physical address cached by the translation backup buffer is required to be cleared or not for the operation of the second virtual machine; the second virtual machine runs on the first processor.
5. The apparatus of claim 4, wherein the second determining unit is further configured to directly run the first virtual machine if it is determined that the virtual machine with the first address space identifier last run by the first processor is the same virtual machine as the first virtual machine.
6. The apparatus of claim 4, wherein the flushing program module is configured to flush a mapping relationship between virtual addresses and physical addresses having the first address space identifier cached in a translation look-aside buffer in the first processor.
7. A server comprising a processor on which a virtual machine manager is arranged, characterized in that the virtual machine manager performs the method of any of claims 1 to 3.
8. A computer readable storage medium storing one or more programs executable by one or more processors to implement the method of operation of any of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010874312.0A CN112099907B (en) | 2020-08-26 | 2020-08-26 | Virtual machine operation method, device and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010874312.0A CN112099907B (en) | 2020-08-26 | 2020-08-26 | Virtual machine operation method, device and server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112099907A CN112099907A (en) | 2020-12-18 |
CN112099907B true CN112099907B (en) | 2024-01-26 |
Family
ID=73757873
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010874312.0A Active CN112099907B (en) | 2020-08-26 | 2020-08-26 | Virtual machine operation method, device and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112099907B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7409487B1 (en) * | 2003-06-30 | 2008-08-05 | Vmware, Inc. | Virtualization system for computers that use address space indentifiers |
CN101421706A (en) * | 2006-04-19 | 2009-04-29 | 高通股份有限公司 | Virtually-tagged instruction cache with physically-tagged behavior |
CN101872316A (en) * | 2004-07-30 | 2010-10-27 | 英特尔公司 | Maintaining processor resources during architectural events |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5459006B2 (en) * | 2010-03-24 | 2014-04-02 | 富士通株式会社 | Memory management device, memory management method, and memory management program |
-
2020
- 2020-08-26 CN CN202010874312.0A patent/CN112099907B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7409487B1 (en) * | 2003-06-30 | 2008-08-05 | Vmware, Inc. | Virtualization system for computers that use address space indentifiers |
CN101872316A (en) * | 2004-07-30 | 2010-10-27 | 英特尔公司 | Maintaining processor resources during architectural events |
CN101421706A (en) * | 2006-04-19 | 2009-04-29 | 高通股份有限公司 | Virtually-tagged instruction cache with physically-tagged behavior |
Also Published As
Publication number | Publication date |
---|---|
CN112099907A (en) | 2020-12-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11531625B2 (en) | Memory management method and apparatus | |
CN109995881B (en) | Load balancing method and device of cache server | |
US9858192B2 (en) | Cross-page prefetching method, apparatus, and system | |
CN110196757B (en) | TLB filling method and device of virtual machine and storage medium | |
CN105677580A (en) | Method and device for accessing cache | |
US10108553B2 (en) | Memory management method and device and memory controller | |
CN109416664B (en) | Systems, devices, and methods for enhanced address space layout randomization | |
WO2020088170A1 (en) | Domain name system configuration method and related apparatus | |
CN115543532A (en) | Processing method and device for missing page exception, electronic equipment and storage medium | |
US8751724B2 (en) | Dynamic memory reconfiguration to delay performance overhead | |
CN115878502A (en) | Page table creating method, processor verification device and electronic equipment | |
CN112099907B (en) | Virtual machine operation method, device and server | |
WO2016206421A1 (en) | Memory access processing method and device, and storage medium | |
CN113885904A (en) | System upgrading method and device, electronic equipment and storage medium | |
US10817432B2 (en) | Memory address assignment method for virtual machine and apparatus | |
CN108037839B (en) | Character input method and related product | |
CN105183668B (en) | Cache flush method and device | |
CN107861890B (en) | Memory access processing method and device and electronic equipment | |
US9892055B2 (en) | Embedded device and memory management method thereof | |
CN115562871A (en) | Memory allocation management method and device | |
Desireddy et al. | Optimize In-kernel swap memory by avoiding duplicate swap out pages | |
CN108875363B (en) | Method and device for accelerating virtual execution, electronic equipment and storage medium | |
CN108171062B (en) | Positioning method and device for equipment and storage medium | |
CN117472806B (en) | Address translation method and device and computer storage medium | |
EP4418128A1 (en) | Memory processing system of enhanced efficiency and method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
CB02 | Change of applicant information |
Address after: 300 000 Tianjin Binhai New Area Tianjin Huayuan Industrial Zone No. 18 Haitai West Road North 2-204 industrial incubation-3-8 Applicant after: Haiguang Information Technology Co.,Ltd. Address before: 300 000 Tianjin Binhai New Area Tianjin Huayuan Industrial Zone No. 18 Haitai West Road North 2-204 industrial incubation-3-8 Applicant before: HAIGUANG INFORMATION TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |