Specific embodiment
The embodiment of the present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this
Locate described specific embodiment and is used only for explaining the embodiment of the present invention, rather than the restriction to the embodiment of the present invention.In addition also
It should be noted that only parts related to embodiments of the present invention are shown rather than entire infrastructure for ease of description, in attached drawing.
Fig. 1 is a kind of flow chart of device virtualization method provided in an embodiment of the present invention, and the present embodiment is applicable to set
Standby virtualization, this method can be executed by equipment such as computer, be specifically comprised the following steps:
Step S101, computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster includes every
At least one resource instances of a resource type, each hardware resource cluster carry out task schedule by task scheduling modules.
Wherein, primary hardware resource mainly includes computing resource and memory source, and primary hardware refers to unmodified original
Hardware device.In one embodiment, computing resource is divided into multiple hardware resource clusters, is wrapped in each hardware resource cluster
At least one resource instances containing each resource type, hardware resource cluster each in this way can complete independently hardware can support
Task, wherein any one resource instances in each resource type can complete corresponding calculating task, such as simple four fundamental rules
Operation or the neural network algorithm of complexity etc..Each hardware resource cluster has independent hardware task scheduler module, that is, has independence
Ring buffer, therefore computing resource can be conceptualized as ring buffer interface.
Step S102, virtual unit is created in virtual unit layer, wherein each virtual unit binding has a hardware money
Source cluster and one group of memory source.
In virtualization technology, level of abstraction of the virtual unit layer between host and client computer, in computer technology,
Virtualization is a kind of resource management techniques, be by the various actual resources of computer, such as server, network, memory and storage,
Be abstracted, convert after show, break the not cleavable obstacle between entity structure, allow configuration of the user than script
Better way applies these resources.The new virtual part of these resources is the not erection mode by existing resource, region or
Configuration is limited.
The each virtual unit binding established in virtual level has a hardware resource cluster and one group of memory source, this is hard
The task that part resource cluster can be supported with complete independently hardware, memory source include device memory and Installed System Memory.
Step S103, it is managed by hardware resource cluster and memory source of the virtual unit to binding.
Realize that the hardware resource cluster bound to it and memory source are managed by the virtual unit of creation.
It wherein, include by virtual unit to the associated configuration register in ring buffer to the management of hardware resource cluster
Read write command intercepted and captured, by client computer configure ring buffer device address be configured to distributed task scheduling modules
In.
It wherein, mainly include the management of management and Installed System Memory to device memory to the management of memory source, for
For device memory, master is to solve client computer and is handed down to the device memory address valid interval phase quoted in the task of equipment
It is mutually independent.Management to Installed System Memory mainly includes the management to the Installed System Memory of equipment access client distribution.
By above scheme it is found that by the way that computing resource is divided into multiple hardware resource clusters, wherein each hardware resource
Cluster includes at least one resource instances of each resource type, and each hardware resource cluster is appointed by task scheduling modules
Business scheduling;Virtual unit is created in virtual unit layer, wherein each virtual unit binding has a hardware resource cluster and one
Group memory source;It is managed by hardware resource cluster and memory source of the virtual unit to binding, improves product
Flexibility and scalability during change.
Fig. 2 is that the flow chart of another device virtualization method provided in an embodiment of the present invention optionally passes through the void
Proposing standby be managed to the hardware resource cluster of binding includes: by the virtual unit to the associated configuration in ring buffer
The read write command of register is intercepted and captured, and the ring buffer device address that client computer configures is configured to distributed task tune
It spends in module.The read write command further includes the read-write pointer more new command of the ring buffer.As shown in Fig. 2, technical side
Case is specific as follows:
Step S201, computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster includes every
At least one resource instances of a resource type, each hardware resource cluster carry out task schedule by task scheduling modules.
Step S202, virtual unit is created in virtual unit layer, wherein each virtual unit binding has a hardware money
Source cluster and one group of memory source.
Step S203, it is cut by read write command of the virtual unit to the associated configuration register in ring buffer
It obtains, the ring buffer device address that client computer configures is configured in distributed task scheduling modules.
Wherein, ring buffer is a kind of for indicating the data structure an of fixed dimension, buffer area from beginning to end,
For data cached stream.Hardware resource cluster is conceptualized as ring buffer interface and is assigned to each virtual unit, and ring-type is slow
Area is rushed by client computer distribution in device memory, the related register of ring buffer includes buffer area base address register, is read
Write pointer register etc..Client computer will be intercepted and captured the access of ring buffer by virtual unit, be then converted into virtual unit
The access in the hardware resource cluster ring buffer configuration domain of binding, subsequent client computer can be directly slow to the ring-type oneself configured
Area's transmitting order to lower levels is rushed, write pointer register is updated.Wherein, in equipment storage, address is true for ring buffer distribution
The ring buffer device address that client computer configures directly can be configured to distributed task scheduling modules by device address
In.
By above scheme it is found that by the virtual unit to the read write command of the associated configuration register in ring buffer
It is intercepted and captured, the ring buffer device address that client computer configures is configured in distributed task scheduling modules, is realized
The isolation of computing resource improves flexibility and scalability during commercialization, while ring buffer is directly by client
Machine distributes in device memory, carries out address translation without host.
Fig. 3 is the flow chart of another device virtualization method provided in an embodiment of the present invention, optionally, described to pass through institute
Stating virtual unit and being managed to the memory source of binding includes: to carry out static division to device memory, by virtually setting
The division address of static division described in standby register pair is reported, and when Client Initialization, is passed through with reading divisions
Location determines the base address of corresponding device memory.When client computer accesses to the device memory, pass through two
Grade address virtual mode carries out address conversion;When equipment accesses to the device memory, to the division ground
Location is directly accessed.As shown in figure 3, technical solution is specific as follows:
Step S301, computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster includes every
At least one resource instances of a resource type, each hardware resource cluster carry out task schedule by task scheduling modules.
Step S302, virtual unit is created in virtual unit layer, wherein each virtual unit binding has a hardware money
Source cluster and one group of memory source.
Step S303, static division is carried out to device memory, static state described in the register pair by virtual unit is drawn
Point division address reported, when Client Initialization, determine corresponding equipment storage sky by reading the divisions address
Between base address.
In one embodiment, memory is divided into two classes, the first kind be by the addressable Installed System Memory of device map,
Second class is device memory.
Wherein, under non-virtualized environment, there are two address spaces: device address space and physical address space, and two
There are there is mapping area in two address spaces in class, CPU accesses two class memories by physical address space, and equipment is by setting
Standby two class memory of address space access.Equipment accesses Installed System Memory by device address space, can be by the mapping inside equipment
Table, abbreviation VM (Virtual Machine, virtual machine) module, translates into the corresponding bus address of Installed System Memory for device address,
The list item dynamic creation and destruction of mapping table.There are multiple examples, example, such as 4 examples for VM module.Under virtualized environment,
There are three address spaces: device address space, host physical address space, guest physical address space.Wherein, needle
To device memory, this virtualization scheme mainly solves client computer, and to be handed down to the device memory address quoted in the task of equipment effective
Section is mutually indepedent.
Specifically, static division is done in section of the device memory in device address space, each section after division by
Virtual device management.Its base address passes through virtual register, i.e. device memory base register and the deposit of device memory size
Device is exposed to client computer.Client computer driving is needed according to device memory base register and device memory sized registers come initial
Change device memory part in device address space.Device address used in the client computer directly can be handed down to equipment in this way
Task in be cited.
Wherein, it when client computer accesses to the device memory, is carried out by two-stage address virtual mode
Address conversion;When equipment accesses to the device memory, the division address is directly accessed.
In one embodiment, the firewall of device address bus can be set when virtual unit initializes, drawn according to static state
Point as a result, by the computing resource cluster for being tied to the virtual unit initiate access request and be not bound in the virtual unit
Deposit isolation.
By above scheme it is found that passing through the register pair of virtual unit by carrying out static division to device memory
The division address of the static division is reported, when Client Initialization, by read the division address determine it is corresponding
The base address of device memory improves flexibility and scalability during commercialization.
Fig. 4 is the flow chart of another device virtualization method provided in an embodiment of the present invention, optionally, in virtual machine
Safeguard a mapping table, the mapping table record has mapping relations of the device address to guest physical address, the mapping table by
Client computer is assigned in equipment storage, and the configuration process of the mapping table is intercepted and captured by host and carries out corresponding configuration, to described
The update of list item is executed by client computer in mapping table.It is described to be managed by memory source of the virtual unit to binding
It include: the access request to Installed System Memory that receiving device end is sent, the access request includes identification information, the mark letter
Breath is for distinguishing domain;It is accessed according to the access request to Installed System Memory.As shown in figure 4, technical solution is specific as follows:
Step S401, computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster includes every
At least one resource instances of a resource type, each hardware resource cluster carry out task schedule by task scheduling modules.
Step S402, virtual unit is created in virtual unit layer, wherein each virtual unit binding has a hardware money
Source cluster and one group of memory source.
Step S403, the access request to Installed System Memory that receiving device end is sent, the access request include mark letter
Breath, the identification information access to Installed System Memory according to the access request for distinguishing domain.
For Installed System Memory, this virtualization scheme master is to solve the Installed System Memory of equipment access client distribution
Problem.
Wherein, safeguard that a mapping table, the mapping table record have device address to guest physical address in virtual machine
Mapping relations, the mapping table is assigned in equipment storage by client computer, and the configuration process of the mapping table is cut by host
Corresponding configuration is obtained and carried out, the update of list item in the mapping table is executed by client computer.
Specifically, the example for distributing an independent VM module from hardware is bound with it in virtual unit.VM module
Associated configuration register, including mapping table base address register, page register etc. will be virtualized, client computer to they
Access will be trapped, and be converted into the access of correspondence register of distributed VM module.The mapping of the VM module of client computer
Table will be dispensed in device memory, so that the mapping table list item of client modification directly comes into force in hardware side, because of mapping table
The device address of the device memory at place is directly effective to equipment.It is achieved that the corresponding visitor of Installed System Memory in a client
Family machine physical address.The corresponding device address of available Installed System Memory, processing mode are corresponding with device memory in a device
Device address it is similar, carry out passing through virtual register after static division and being exposed to client computer in virtual unit.Client computer benefit
It establishes list item with guest physical address and device address to update to after the VM module instance of binding, the computing resource bound by it
The Installed System Memory access that cluster issues, guest physical address will be issued from equipment end and gives PCIE bus.In the case where virtualizing scene,
Guest physical address can be by IOMMU (input/output memory management unit, the input in PCIE bus
Export memory management unit) it translates as host physical address.The corresponding domain IOMMU of each virtual machine clients.From setting
The access request that standby end is sent needs to carry mark to distinguish domain, finds corresponding IOMMU mapping table.Since VM module instance is
Static division is to virtual unit, corresponding virtual machine clients, therefore the request that the VM module instance issues needs to carry domain identifier.
Increase the configuration method of mark, such as marker register on hardware, the identifiable domain identifier of bus is converted by hardware logic.
By above scheme it is found that the access request to Installed System Memory that receiving device end is sent, the access request include
Identification information, the identification information access to Installed System Memory according to the access request, improve product for distinguishing domain
Flexibility and scalability during change.
Fig. 5 is a kind of structural block diagram of device virtualization device provided in an embodiment of the present invention, and the device is for executing
The device virtualization method for stating embodiment offer, has the corresponding functional module of execution method and beneficial effect.As shown in figure 5,
The device specifically includes: resource division unit 101, resource binding unit 102 and instruction process unit 103, wherein
Resource division unit 101, for computing resource to be divided into multiple hardware resource clusters, wherein each hardware resource
Cluster includes at least one resource instances of each resource type, and each hardware resource cluster is appointed by task scheduling modules
Business scheduling;
Resource binding unit 102, for creating virtual unit in virtual unit layer, wherein each virtual unit binding
There are a hardware resource cluster and one group of memory source;
Instruction process unit 103 carries out pipe by hardware resource cluster and memory source of the virtual unit to binding
Reason.
By above scheme it is found that computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster
At least one resource instances including each resource type, each hardware resource cluster carry out task tune by task scheduling modules
Degree;Virtual unit is created in virtual unit layer, wherein each virtual unit binding has in a hardware resource cluster and one group
Deposit resource;It is managed by hardware resource cluster and memory source of the virtual unit to binding, improves commercialization
Flexibility and scalability in journey.
In a possible embodiment, described instruction processing unit 103 is specifically used for:
It is intercepted and captured by read write command of the virtual unit to the associated configuration register in ring buffer, by client
The ring buffer device address of machine configuration is configured in distributed task scheduling modules.
In a possible embodiment, the read write command further includes that the read-write pointer update of the ring buffer refers to
It enables.
In a possible embodiment, described instruction processing unit 103 is specifically used for:
To device memory progress static division, the division of static division described in the register pair by virtual unit
Location is reported, and when Client Initialization, is passed through and is read the base address for dividing address and determining corresponding device memory.
In a possible embodiment, when client computer accesses to the device memory, by two-stage
Location virtualization mode carries out address conversion;When equipment accesses to the device memory, to the division address into
Row directly accesses.
In a possible embodiment, safeguard that a mapping table, the mapping table record have device address in virtual machine
To the mapping relations of guest physical address, the mapping table is assigned in equipment storage by client computer, and the mapping table is matched
It sets process and intercepts and captures and carry out corresponding configuration by host, the update of list item in the mapping table is executed by client computer.
In a possible embodiment, described instruction processing unit 103 is specifically used for:
The access request to Installed System Memory that receiving device end is sent, the access request includes identification information, the mark
Information is known for distinguishing domain;
It is accessed according to the access request to Installed System Memory.
Fig. 6 is a kind of structural schematic diagram of equipment provided in an embodiment of the present invention, as shown in fig. 6, the equipment includes processing
Device 201, memory 202, input unit 203 and output device 204;The quantity of processor 201 can be one or more in equipment
It is a, in Fig. 6 by taking a processor 201 as an example;Processor 201, memory 202, input unit 203 and output device in equipment
204 can be connected by bus or other modes, in Fig. 6 for being connected by bus.
Memory 202 is used as a kind of computer readable storage medium, can be used for storing software program, journey can be performed in computer
Sequence and module, if the corresponding program instruction/module of device virtualization method in the embodiment of the present invention is (for example, equipment is virtual
Disguise dimension information determining module 101, storage position determination module 102 and the control instruction output module 103 in setting).Processing
Software program, instruction and the module that device 201 is stored in memory 202 by operation, thereby executing the various functions of equipment
Using and data processing, that is, realize above-mentioned device virtualization method.
Memory 202 can mainly include storing program area and storage data area, wherein storing program area can store operation system
Application program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.This
Outside, memory 202 may include high-speed random access memory, can also include nonvolatile memory, for example, at least one
Disk memory, flush memory device or other non-volatile solid state memory parts.In some instances, memory 202 can be into one
Step includes the memory remotely located relative to processor 201, these remote memories can pass through network connection to equipment.On
The example for stating network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Input unit 203 can be used for receiving the number or character information of input, and generate with the user setting of equipment with
And the related key signals input of function control.Output device 204 may include that display screen etc. shows equipment.
The embodiment of the present invention also provides a kind of storage medium comprising computer executable instructions, and the computer is executable
Instruction is used to execute a kind of device virtualization method when being executed by computer processor, this method comprises:
Computing resource is divided into multiple hardware resource clusters, wherein each hardware resource cluster includes each resource type
At least one resource instances, each hardware resource cluster carries out task schedule by task scheduling modules;
Create virtual unit in virtual unit layer, wherein the binding of each virtual unit have a hardware resource cluster and
One group of memory source;
It is managed by hardware resource cluster and memory source of the virtual unit to binding.
In a possible embodiment, packet is managed by hardware resource cluster of the virtual unit to binding
It includes:
It is intercepted and captured by read write command of the virtual unit to the associated configuration register in ring buffer, by client
The ring buffer device address of machine configuration is configured in distributed task scheduling modules.
In a possible embodiment, the read write command further includes that the read-write pointer update of the ring buffer refers to
It enables.
In a possible embodiment, described that packet is managed by memory source of the virtual unit to binding
It includes:
To device memory progress static division, the division of static division described in the register pair by virtual unit
Location is reported, and when Client Initialization, is passed through and is read the base address for dividing address and determining corresponding device memory.
In a possible embodiment, when client computer accesses to the device memory, by two-stage
Location virtualization mode carries out address conversion;When equipment accesses to the device memory, to the division address into
Row directly accesses.
In a possible embodiment, safeguard that a mapping table, the mapping table record have device address in virtual machine
To the mapping relations of guest physical address, the mapping table is assigned in equipment storage by client computer, and the mapping table is matched
It sets process and intercepts and captures and carry out corresponding configuration by host, the update of list item in the mapping table is executed by client computer.
In a possible embodiment, described that packet is managed by memory source of the virtual unit to binding
It includes:
The access request to Installed System Memory that receiving device end is sent, the access request includes identification information, the mark
Information is known for distinguishing domain;
It is accessed according to the access request to Installed System Memory.
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present invention
The method operation that executable instruction is not limited to the described above, can also be performed and set provided by any embodiment of the embodiment of the present invention
Relevant operation in standby virtual method.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present invention
Embodiment can be realized by software and required common hardware, naturally it is also possible to by hardware realization, but in many cases before
Person is more preferably embodiment.Based on this understanding, the technical solution of the embodiment of the present invention is substantially in other words to existing skill
The part that art contributes can be embodied in the form of software products, which can store in computer
Floppy disk, read-only memory (Read-Only Memory, ROM), random access memory in readable storage medium storing program for executing, such as computer
(Random Access Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are used so that one
Computer equipment (can be personal computer, server or the network equipment etc.) executes each embodiment of the embodiment of the present invention
The method.
It is worth noting that, in the embodiment of above equipment virtualization apparatus, included each unit and module are
It is divided according to the functional logic, but is not limited to the above division, as long as corresponding functions can be realized;Separately
Outside, the specific name of each functional unit is also only for convenience of distinguishing each other, and is not intended to restrict the invention the protection of embodiment
Range.
Note that above are only the preferred embodiment and institute's application technology principle of the embodiment of the present invention.Those skilled in the art
It will be appreciated that the embodiment of the present invention is not limited to specific embodiment described here, it is able to carry out for a person skilled in the art each
The apparent variation of kind, readjustment and the protection scope substituted without departing from the embodiment of the present invention.Therefore, although more than passing through
Embodiment is described in further detail the embodiment of the present invention, but the embodiment of the present invention is not limited only to the above implementation
Example can also include more other equivalent embodiments in the case where not departing from design of the embodiment of the present invention, and the present invention is implemented
The range of example is determined by the scope of the appended claims.