CN104123173B - A kind of method and device for realizing inter-virtual machine communication - Google Patents
A kind of method and device for realizing inter-virtual machine communication Download PDFInfo
- Publication number
- CN104123173B CN104123173B CN201410351456.2A CN201410351456A CN104123173B CN 104123173 B CN104123173 B CN 104123173B CN 201410351456 A CN201410351456 A CN 201410351456A CN 104123173 B CN104123173 B CN 104123173B
- Authority
- CN
- China
- Prior art keywords
- processor
- data
- manager
- dma engine
- instruction
- 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
Landscapes
- Multi Processors (AREA)
Abstract
Description
技术领域technical field
本发明涉及通信技术领域,具体涉及一种实现虚拟机间通信的方法及装置。The present invention relates to the field of communication technology, in particular to a method and device for realizing communication between virtual machines.
背景技术Background technique
在物理机,通常是中央处理单元(Central Processing Unit,简称CPU)上通过虚拟机监控器(Virtual Machine Manager,简称VMM)生成多个虚拟机(Virtual Machine,简称VM),每个VM运行在一个完全隔离的环境中,可以理解为在物理机上模拟出多个虚拟的计算机,虚拟机如同虚拟的计算机,可以像真正的计算机那样进行工作。On a physical machine, usually a central processing unit (Central Processing Unit, referred to as CPU), multiple virtual machines (Virtual Machine, referred to as VM) are generated through a virtual machine monitor (Virtual Machine Manager, referred to as VMM), and each VM runs on a In a completely isolated environment, it can be understood as simulating multiple virtual computers on a physical machine. The virtual machine is like a virtual computer and can work like a real computer.
PCIe(也可以叫做PCI-Express,全称是Peripheral Component InterfaceExpress)是最新的总线和接口标准,主要优势是数据传输速率高,而且它新增了单根节点的输入/输出虚拟化规范(Single Root I/O Virtualization,简称SR-IOV)技术,可以实现多个如VM共享网卡等PCIe设备与CPU的连接。PCIe设备是CPU的外围设备,SR-IOV规范允许一个PCIe设备通过虚拟化技术,将PCIe设备划分得到一个具备其所有物理功能的PCIe子设备,称之为物理功能(Physical Function,简称PF),通过虚拟化技术生成多个虚拟功能(Virtual Function,简称VF),每个VF可以看作一个虚拟的PCIe设备,其中,PF除了具备PCIe设备的所有功能,还具备SR-IOV扩展的配置和管理功能;VF依赖于某一个PF,具备PCIe设备的轻量级功能,包括数据传输所必要的资源和少量的配置资源。可以将一个或多个VF分配给一个VM,进而每个VM都可以看到一个独立的虚拟的PCIe设备,即VF。也就是说CPU上运行的一个VM可以对应PCIe设备中的一个VF。PCIe (also called PCI-Express, the full name is Peripheral Component Interface Express) is the latest bus and interface standard, the main advantage is the high data transmission rate, and it has added a single-root node input/output virtualization specification (Single Root I /O Virtualization (SR-IOV for short) technology, which can realize the connection between multiple PCIe devices such as VM shared network cards and CPUs. The PCIe device is a peripheral device of the CPU. The SR-IOV specification allows a PCIe device to be divided into a PCIe sub-device with all its physical functions through virtualization technology, which is called a physical function (Physical Function, PF for short). Multiple virtual functions (Virtual Function, VF for short) are generated through virtualization technology, and each VF can be regarded as a virtual PCIe device. Among them, PF not only has all the functions of PCIe devices, but also has the configuration and management of SR-IOV extension Function; VF depends on a certain PF and has the lightweight functions of PCIe devices, including the resources necessary for data transmission and a small amount of configuration resources. One or more VFs can be assigned to a VM, and each VM can see an independent virtual PCIe device, that is, a VF. That is to say, one VM running on the CPU can correspond to one VF in the PCIe device.
例如,通过PCIe总线连接CPU与PCIe设备,将PCIe设备中的一个或多个VF分配给CPU中的一个VM,此时多个VM可以共享PCIe设备。当多个VM之间需要数据交互时,需要通过VF之间通信实现,即一个VM的数据从CPU经由PCIe接口发送至PCIe设备中与该VM对应的VF,并由VF发给目的VF,再由目的VF经由PCIe接口发送至CPU中的目的VM。由于VF只具备数据传输所必要的资源和少量的配置资源,因此,VF的通信需要通过PF进行总体管理,比如,判断两个VF之间需要具有通信的能力或者进行全局性的调节等等。现有SR-IOV规范并没有给出PF与VF通信的具体实现机制。如图1所示,在物理机中通过VMM生成N个VM,以及包括一个PCIe管理器和PCIe复合接口,VMM分别与VM和PCIe管理器连接,且该VMM连接到PCIe复合接口上;网卡中包括一个PF、N个VF以及PCIe终端接口,PCIe总线分别与PF和VF连接,且CPU的PCIe复合接口通过PCIe总线连接到PCIe终端接口上。为每个VF分配一套硬件实现的Mailbox(邮箱)缓存和Door Bell(门铃)寄存器来实现PF和VF之间的通信,即在网卡中为每个VF配置一个Mailbox缓存和一个Door Bell寄存器,实现一种类似“敲门铃”的机制。若VF有数据需要发送,那么将数据直接发送给PF,那么PF与VF之间再通过“敲门铃”的机制,将数据转发给目的VF。For example, the CPU and the PCIe device are connected through the PCIe bus, and one or more VFs in the PCIe device are assigned to a VM in the CPU, and multiple VMs can share the PCIe device. When multiple VMs need to exchange data, it needs to be realized through communication between VFs, that is, the data of a VM is sent from the CPU to the VF corresponding to the VM in the PCIe device through the PCIe interface, and the VF sends it to the destination VF, and then The target VF sends it to the target VM in the CPU through the PCIe interface. Since the VF only has the necessary resources for data transmission and a small amount of configuration resources, the communication of the VF needs to be managed overall by the PF, for example, to determine whether two VFs need to have communication capabilities or to perform global adjustments, etc. The existing SR-IOV specification does not provide a specific implementation mechanism for the communication between the PF and the VF. As shown in Figure 1, N VMs are generated by the VMM in the physical machine, and include a PCIe manager and a PCIe composite interface, the VMM is connected to the VM and the PCIe manager respectively, and the VMM is connected to the PCIe composite interface; in the network card It includes a PF, N VFs, and PCIe terminal interfaces. The PCIe bus is connected to the PF and the VFs respectively, and the PCIe composite interface of the CPU is connected to the PCIe terminal interface through the PCIe bus. Assign a set of hardware-implemented Mailbox (mailbox) cache and Door Bell (doorbell) register to each VF to realize the communication between PF and VF, that is, configure a Mailbox cache and a Door Bell register for each VF in the network card, Implement a mechanism similar to "knock the doorbell". If the VF has data to send, it sends the data directly to the PF, and then the PF and the VF forward the data to the destination VF through the "doorbell" mechanism.
在上述图1所示实施例中,一个PF对应着N个VF,在VF需要发送数据时,就直接给PF发送数据,可能造成同时有多个VF给PF发送数据,而PF内存有限,可能造成数据丢失,另外,由于Mailbox缓存的内存大小受限于网卡内存大小,如果PF与VF之间通信的长度大于64bytes,而网卡内存小于64bytes,需要将数据拆分成多次,降低系统性能。In the embodiment shown in Figure 1 above, one PF corresponds to N VFs. When a VF needs to send data, it directly sends data to the PF. In addition, because the memory size of the Mailbox cache is limited by the memory size of the network card, if the length of the communication between the PF and the VF is greater than 64 bytes, but the memory of the network card is less than 64 bytes, the data needs to be split into multiple times to reduce system performance.
发明内容Contents of the invention
针对上述缺陷,本发明实施例提供了一种实现虚拟机间通信的方法及装置,能够减少PCIe设备的硬件资源消耗,支持VM间大数据的传输,提高VM间通信的效率和可靠性。In view of the above defects, the embodiments of the present invention provide a method and device for realizing communication between virtual machines, which can reduce the consumption of hardware resources of PCIe devices, support the transmission of large data between VMs, and improve the efficiency and reliability of communication between VMs.
本发明第一方面提供了一种实现虚拟机间通信的方法,应用于总线和接口标准PCIe设备中,所述PCIe设备与物理机通过PCIe总线连接,所述物理机中包括多个虚拟机VM和一个管理器,多个所述VM和管理器通过虚拟化技术实现在所述物理机中;所述PCIe设备中包括直接存储器存取DMA引擎、一物理功能PF处理器和多个虚拟功能VF处理器,所述PF处理器和多个VF处理器通过虚拟化技术实现在所述PCIe设备中;其中,一个所述VM关联一个或多个所述VF处理器,所述管理器关联所述PF处理器;所述方法包括:The first aspect of the present invention provides a method for realizing communication between virtual machines, which is applied to a bus and interface standard PCIe device, and the PCIe device is connected to a physical machine through a PCIe bus, and the physical machine includes a plurality of virtual machines VM And a manager, multiple VMs and managers are implemented in the physical machine through virtualization technology; the PCIe device includes a direct memory access DMA engine, a physical function PF processor and a plurality of virtual function VFs The processor, the PF processor and multiple VF processors are implemented in the PCIe device through virtualization technology; wherein, one VM is associated with one or more VF processors, and the manager is associated with the PF processor; the method comprising:
所述DMA引擎在收到所述PF处理器的接收指令后,从所述接收指令对应的VM上读取数据并将所述数据存储到所述管理器中;After the DMA engine receives the receiving instruction from the PF processor, it reads data from the VM corresponding to the receiving instruction and stores the data in the manager;
所述DMA引擎在收到所述PF处理器的发送指令后,从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中。After receiving the sending instruction from the PF processor, the DMA engine reads data from the manager and stores the data in the VM corresponding to the sending instruction.
结合第一方面,在第一种可能的实现方式中,所述DMA引擎在收到所述PF处理器的接收指令之前包括:所述PF处理器接收所述DMA引擎发送的第一通知信息,所述第一通知信息为所述DMA引擎用于通知所述PF处理器有VM需要发送数据;所述PF处理器检测所述管理器是否准备好接收所述VF处理器对应的VM发送的数据;若是,所述PF处理器向所述DMA引擎发送接收指令,所述接收指令包括需要发送数据的VM。With reference to the first aspect, in a first possible implementation manner, before the DMA engine receives the receiving instruction from the PF processor, the method includes: the PF processor receives the first notification information sent by the DMA engine, The first notification information is used by the DMA engine to notify the PF processor that a VM needs to send data; the PF processor detects whether the manager is ready to receive data sent by the VM corresponding to the VF processor ; If yes, the PF processor sends a receiving instruction to the DMA engine, and the receiving instruction includes a VM that needs to send data.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述PF处理器检测所述管理器是否准备好接收所述VF处理器对应的VM发送的数据包括:所述PF处理器检测所述管理器中已分配的接收缓存是否空闲以确定所述管理器是否准备好接收所述VF处理器对应的VM发送的数据,所述管理器中已分配的接收缓存用于存储数据。With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the PF processor detecting whether the manager is ready to receive data sent by the VM corresponding to the VF processor includes: The PF processor detects whether the allocated receiving buffer in the manager is free to determine whether the manager is ready to receive the data sent by the VM corresponding to the VF processor, and the allocated receiving buffer in the manager Used to store data.
结合第一方面,或第一方面的第一种可能的实现方式,或第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述从所述管理器的发送缓存读取数据并将所述数据存储到所述发送指令对应的VM的接收缓存中之后包括:所述DMA引擎向所述PF处理器发送第一响应信息,所述第一响应信息用于通知所述PF处理器,已成功将所述接收指令对应的VM发送的数据存储到所述管理器中。With reference to the first aspect, or the first possible implementation of the first aspect, or the second possible implementation of the first aspect, in a third possible implementation, the sending from the manager After the cache reads the data and stores the data in the receiving cache of the VM corresponding to the sending instruction, it includes: the DMA engine sends first response information to the PF processor, and the first response information is used to notify The PF processor has successfully stored the data sent by the VM corresponding to the received instruction into the manager.
结合第一方面,或第一方面的第一种可能的实现方式,或第一方面的第二种可能的实现方式,或第三种可能的实现方式,在第四种可能的实现方式中,所述DMA引擎在收到所述PF处理器的发送指令之后包括:所述DMA引擎检测所述发送指令对应的VM是否准备好接收所述数据;若是,执行从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中的步骤。In combination with the first aspect, or the first possible implementation of the first aspect, or the second possible implementation of the first aspect, or the third possible implementation, in the fourth possible implementation, After receiving the sending instruction from the PF processor, the DMA engine includes: the DMA engine detects whether the VM corresponding to the sending instruction is ready to receive the data; if so, executes reading data from the manager and A step of storing the data in the VM corresponding to the sending instruction.
结合第四种可能的实现方式,在第五种可能的实现方式中,所述DMA引擎检测所述发送指令对应的VM是否准备好接收所述数据包括:所述DMA引擎检测所述发送指令对应的VM中已分配的接收缓存是否空闲以确定所述发送指令对应的VM是否准备好接收所述数据,所述发送指令对应的VM中已分配的接收缓存用于存储数据。With reference to the fourth possible implementation manner, in a fifth possible implementation manner, the DMA engine detecting whether the VM corresponding to the sending instruction is ready to receive the data includes: the DMA engine detecting that the VM corresponding to the sending instruction Whether the allocated receive buffer in the VM of the said sending instruction is free to determine whether the VM corresponding to the sending instruction is ready to receive the data, and the allocated receiving buffer in the VM corresponding to the sending instruction is used to store data.
结合第四种可能的实现方式,或第五种可能的实现方式,在第六种可能的实现方式中,在所述从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中之后包括:所述DMA引擎向所述PF处理器发送第二响应信息,所述第二响应信息用于通知所述PF处理器已成功从所述管理器中读取数据并存储到所述发送指令对应的VM中;所述DMA引擎向所述发送指令对应的VM相关联的VF处理器发送第二通知信息,所述第二通知信息用于通知所述发送指令对应的VM相关联的VF处理器,已成功将所述管理器的数据存储到所述发送指令对应的VM中。With reference to the fourth possible implementation manner, or the fifth possible implementation manner, in a sixth possible implementation manner, in the reading data from the manager and storing the data in the sending instruction Afterwards, the corresponding VM includes: the DMA engine sends second response information to the PF processor, and the second response information is used to notify the PF processor that the data has been successfully read from the manager and stored to the VM corresponding to the sending instruction; the DMA engine sends second notification information to the VF processor associated with the VM corresponding to the sending instruction, and the second notification information is used to notify the VM corresponding to the sending instruction The associated VF processor has successfully stored the data of the manager into the VM corresponding to the sending instruction.
本发明实施例第二方面提供了一种直接存储器存取DMA引擎,应用于总线和接口标准PCIe设备中,所述PCIe设备与物理机通过PCIe总线连接,所述物理机中包括多个虚拟机VM和一个管理器,多个所述VM和管理器通过虚拟化技术实现在所述物理机中;在所述PCIe设备中包括所述DMA引擎、一物理功能PF处理器和多个虚拟功能VF处理器,所述PF处理器和多个VF处理器通过虚拟化技术实现在所述PCIe设备中,其中,一个所述VM关联一个或多个所述VF处理器,所述管理器关联所述PF处理器,所述DMA引擎包括:The second aspect of the embodiment of the present invention provides a direct memory access DMA engine, which is applied to a bus and interface standard PCIe device, and the PCIe device is connected to a physical machine through a PCIe bus, and the physical machine includes a plurality of virtual machines VM and a manager, multiple VMs and managers are implemented in the physical machine through virtualization technology; the DMA engine, a physical function PF processor and a plurality of virtual function VFs are included in the PCIe device processor, the PF processor and multiple VF processors are implemented in the PCIe device through virtualization technology, wherein one VM is associated with one or more VF processors, and the manager is associated with the PF processor, the DMA engine includes:
第一处理模块,用于在收到所述PF处理器的接收指令后,从所述接收指令对应的VM上读取数据并将所述数据存储到所述管理器中;The first processing module is configured to read data from the VM corresponding to the received instruction and store the data in the manager after receiving the received instruction from the PF processor;
第二处理模块,用于在收到所述PF处理器的发送指令后,从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中。The second processing module is configured to read data from the manager and store the data in the VM corresponding to the sending instruction after receiving the sending instruction from the PF processor.
结合第二方面,在第一种可能的实现方式中,所述DMA引擎还包括:第一响应模块,用于向所述PF处理器发送第一响应信息,所述第一响应信息用于通知所述PF处理器,已成功将所述接收指令对应的VM发送的数据存储到所述管理器中。With reference to the second aspect, in a first possible implementation manner, the DMA engine further includes: a first response module, configured to send first response information to the PF processor, and the first response information is used to notify The PF processor has successfully stored the data sent by the VM corresponding to the received instruction into the manager.
结合第二方面,或第二方面的第一种可能的实现方式,在第二种可能的实现方式中,所述DMA引擎还包括:检测模块,用于检测所述发送指令对应的VM是否准备好接收所述数据。With reference to the second aspect, or the first possible implementation of the second aspect, in the second possible implementation, the DMA engine further includes: a detection module, configured to detect whether the VM corresponding to the sending instruction is ready Good to receive the data.
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述DMA引擎还包括:第二响应模块,用于向所述PF处理器发送第二响应信息,所述第二响应信息用于通知所述PF处理器已成功从所述管理器中读取数据存储到所述发送指令对应的VM中;和,向所述发送指令对应的VM相关联的VF处理器发送第二通知信息,所述第二通知信息用于通知所述发送指令对应的VM相关联的VF处理器,已成功将所述管理器的数据存储到所述发送指令对应的VM中。With reference to the second possible implementation of the second aspect, in a third possible implementation, the DMA engine further includes: a second response module, configured to send second response information to the PF processor, the The second response information is used to notify the PF processor that it has successfully read data from the manager and stored it in the VM corresponding to the sending instruction; and, processing the VF associated with the VM corresponding to the sending instruction The manager sends second notification information, where the second notification information is used to notify the VF processor associated with the VM corresponding to the sending instruction that the data of the manager has been successfully stored in the VM corresponding to the sending instruction.
本发明实施例第三方面还提供了一种实现虚拟机间通信的系统,可包括:总线和接口标准PCIe设备和物理机,所述PCIe设备与物理机通过PCIe总线连接,所述物理机中包括多个虚拟机VM和一个管理器,所述多个VM和管理器通过虚拟化技术实现在所述物理机中;所述PCIe设备中包括一物理功能PF处理器、多个虚拟功能VF处理器和直接存储器存取DMA引擎,所述PF处理器和多个VF处理器通过虚拟化技术实现在所述PCIe设备中;其中,一个所述VM关联一个或多个所述VF处理器,所述管理器关联所述PF处理器;The third aspect of the embodiment of the present invention also provides a system for realizing communication between virtual machines, which may include: a bus and interface standard PCIe device and a physical machine, the PCIe device and the physical machine are connected through the PCIe bus, and in the physical machine Including a plurality of virtual machine VMs and a manager, the plurality of VMs and managers are implemented in the physical machine through virtualization technology; the PCIe device includes a physical function PF processor, a plurality of virtual function VF processing and a direct memory access DMA engine, the PF processor and multiple VF processors are implemented in the PCIe device through virtualization technology; wherein, one VM is associated with one or more VF processors, so The manager is associated with the PF processor;
所述DMA引擎包括:The DMA engine includes:
第一处理模块,用于在收到所述PF处理器的接收指令后,从所述接收指令对应的VM上读取数据并将所述数据存储到所述管理器中;The first processing module is configured to read data from the VM corresponding to the received instruction and store the data in the manager after receiving the received instruction from the PF processor;
第二处理模块,用于在收到所述PF处理器的发送指令后,从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中;The second processing module is configured to, after receiving the sending instruction from the PF processor, read data from the manager and store the data in the VM corresponding to the sending instruction;
所述PF处理器用于向所述DMA引擎发送所述接收指令和所述发送指令。The PF processor is configured to send the receiving instruction and the sending instruction to the DMA engine.
结合第三方面,在第一种可能的实现方式中,所述PF处理器还用于:接收所述DMA引擎发送的第一通知信息,所述第一通知信息为所述DMA引擎用于通知所述PF处理器有VM需要发送数据;检测所述管理器是否准备好接收所述VF处理器对应的VM发送的数据;若是,则执行向所述DMA引擎发送所述接收指令和所述发送指令的步骤,所述接收指令包括需要发送数据的VM。With reference to the third aspect, in a first possible implementation manner, the PF processor is further configured to: receive first notification information sent by the DMA engine, where the first notification information is used by the DMA engine to notify The PF processor has a VM that needs to send data; detect whether the manager is ready to receive the data sent by the VM corresponding to the VF processor; if so, execute sending the receiving instruction and the sending instruction to the DMA engine. In the step of instructing, the receiving instruction includes a VM that needs to send data.
结合第三方面,或第三方面的第一种可能的实现方式,在第二种可能的实现方式中,所述PF处理器还用于:检测所述管理器中已分配的接收缓存是否空闲以确定所述管理器是否准备好接收所述VF处理器对应的VM发送的数据,所述发送指令对应的VM中已分配的接收缓存用于存储数据。With reference to the third aspect, or the first possible implementation of the third aspect, in a second possible implementation, the PF processor is further configured to: detect whether the allocated receive buffer in the manager is free To determine whether the manager is ready to receive data sent by the VM corresponding to the VF processor, the allocated receive buffer in the VM corresponding to the sending instruction is used to store data.
结合第三方面的第二种可能的实现方式,在第三种可能的实现方式中,所述DMA引擎还包括:第一响应模块,用于向所述PF处理器发送第一响应信息,所述第一响应信息用于通知所述PF处理器,已成功将所述接收指令对应的VM发送的数据存储到所述管理器中。With reference to the second possible implementation manner of the third aspect, in a third possible implementation manner, the DMA engine further includes: a first response module, configured to send first response information to the PF processor, the The first response information is used to notify the PF processor that the data sent by the VM corresponding to the received instruction has been successfully stored in the manager.
结合第三方面,在第四种可能的实现方式中,所述DMA引擎还包括:检测模块,用于检测所述发送指令对应的VM是否准备好接收所述数据。With reference to the third aspect, in a fourth possible implementation manner, the DMA engine further includes: a detection module, configured to detect whether the VM corresponding to the sending instruction is ready to receive the data.
结合第三方面的第四种可能的实现方式,在第五种可能的实现方式中,所述DMA引擎还包括:第二响应模块,用于向所述PF处理器发送第二响应信息,所述第二响应信息用于通知所述PF处理器已成功从所述管理器中读取数据存储到所述发送指令对应的VM中;和,向所述发送指令对应的VM相关联的VF处理器发送第二通知信息,所述第二通知信息用于通知所述发送指令对应的VM相关联的VF处理器,已成功将所述管理器的数据存储到所述发送指令对应的VM中。With reference to the fourth possible implementation of the third aspect, in a fifth possible implementation, the DMA engine further includes: a second response module, configured to send second response information to the PF processor, the The second response information is used to notify the PF processor that it has successfully read data from the manager and stored it in the VM corresponding to the sending instruction; and, processing the VF associated with the VM corresponding to the sending instruction The manager sends second notification information, where the second notification information is used to notify the VF processor associated with the VM corresponding to the sending instruction that the data of the manager has been successfully stored in the VM corresponding to the sending instruction.
从以上技术方案可以看出,本发明实施例提供的一种实现虚拟机间通信的方法及装置具有以下优点:通过直接存储器存取(Direct Memory Access,简称DMA)引擎在PF处理器关联的管理器与VF处理器关联的VM之间实现数据的直接读取与存储,从而实现VM之间的通信,与现有技术相比,无需在PCIe设备中给PF处理器和VF处理器分配相应的缓存,能够减少PCIe设备硬件资源的消耗,且可以直接传输大数据,有效提高VM之间通信的效率。From the above technical solutions, it can be seen that the method and device for realizing communication between virtual machines provided by the embodiments of the present invention have the following advantages: through the direct memory access (Direct Memory Access, referred to as DMA) engine in the management associated with the PF processor The data can be read and stored directly between the VM associated with the processor and the VF processor, so as to realize the communication between VMs. Compared with the existing technology, there is no need to allocate corresponding Cache can reduce the consumption of hardware resources of PCIe devices, and can directly transmit large data, effectively improving the efficiency of communication between VMs.
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required in the embodiments of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1为本发明现有技术提供的虚拟机通信应用示意图;FIG. 1 is a schematic diagram of a virtual machine communication application provided by the prior art of the present invention;
图2a为本发明实施例提供的实现虚拟机间通信的方法流程示意图;FIG. 2a is a schematic flowchart of a method for implementing communication between virtual machines provided by an embodiment of the present invention;
图2b为本发明实施例提供的实现虚拟机间通信的方法的实现示意图;FIG. 2b is a schematic diagram of an implementation of a method for implementing communication between virtual machines provided by an embodiment of the present invention;
图3为本发明实施例提供的虚拟机通信应用示意图;FIG. 3 is a schematic diagram of a virtual machine communication application provided by an embodiment of the present invention;
图4为本发明另一实施例提供的实现虚拟机间通信的方法流程示意图;FIG. 4 is a schematic flowchart of a method for implementing communication between virtual machines provided by another embodiment of the present invention;
图5为本发明另一实施例提供的实现虚拟机间通信的方法流程示意图;FIG. 5 is a schematic flowchart of a method for implementing communication between virtual machines provided by another embodiment of the present invention;
图6为本发明实施例提供的DMA引擎结构示意图;FIG. 6 is a schematic structural diagram of a DMA engine provided by an embodiment of the present invention;
图7a为本发明实施例提供的实现虚拟机间通信的系统的结构示意图;FIG. 7a is a schematic structural diagram of a system for implementing communication between virtual machines provided by an embodiment of the present invention;
图7b为本发明实施例提供的实现虚拟机间通信的系统的应用示意图。Fig. 7b is an application schematic diagram of a system for implementing communication between virtual machines provided by an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种实现虚拟机间通信的方法及装置,用于减少PCIe设备的硬件资源消耗,提高VM间的通信效率。Embodiments of the present invention provide a method and device for realizing communication between virtual machines, which are used to reduce hardware resource consumption of PCIe devices and improve communication efficiency between VMs.
下面将结合本发明实施例的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例例如能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, not to Describe a specific order or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of practice in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
下面将以具体实施例,对本发明进行详细介绍:Below with specific embodiment, the present invention is described in detail:
请参阅图2a,图2a为本发明实施例提供的实现虚拟机间通信的方法流程示意图;并结合图2b,图2b为本发明实施例提供的实现虚拟机间通信的方法的实现示意图;如图2a所示,一种实现虚拟机间通信的方法,应用于如图2b所示的总线和接口标准PCIe设备中,所述PCIe设备与物理机通过PCIe总线连接,所述物理机中包括N个VM和一个管理器,N个VM和管理器通过虚拟化技术实现在物理机中;所述PCIe设备中包括DMA引擎,并在所述PCIe设备中配置一物理功能PF处理器和M个虚拟功能VF处理器,PF处理器和VF处理器通过虚拟化技术实现在PCIe设备中,其中,N和M均为大于或等于1的正整数;一个所述VM关联一个或多个VF处理器,所述管理器关联所述PF处理器。Please refer to FIG. 2a. FIG. 2a is a schematic flowchart of a method for implementing communication between virtual machines provided by an embodiment of the present invention; and in combination with FIG. 2b, FIG. 2b is a schematic diagram of an implementation of a method for implementing communication between virtual machines provided by an embodiment of the present invention; As shown in Figure 2a, a method for realizing communication between virtual machines is applied to a bus and interface standard PCIe device as shown in Figure 2b, the PCIe device is connected to a physical machine through a PCIe bus, and the physical machine includes N VMs and a manager, N VMs and managers are implemented in the physical machine through virtualization technology; the PCIe device includes a DMA engine, and a physical function PF processor and M virtual machines are configured in the PCIe device Function VF processors, PF processors and VF processors are implemented in PCIe devices through virtualization technology, wherein, N and M are both positive integers greater than or equal to 1; one VM is associated with one or more VF processors, The manager is associated with the PF processor.
如图2a所示,一种实现虚拟机间通信的方法具体可包括:As shown in Figure 2a, a method for implementing communication between virtual machines may specifically include:
S201、所述DMA引擎在收到所述PF处理器的接收指令后,从所述接收指令对应的VM上读取数据并将所述数据存储到所述管理器中;S201. After receiving the receiving instruction from the PF processor, the DMA engine reads data from the VM corresponding to the receiving instruction and stores the data in the manager;
PCIe设备与物理机之间通过PCIe总线连接,DMA引擎与PF处理器和VF处理器相连接,通过DMA引擎控制进行VM之间数据的直接存取。The PCIe device is connected to the physical machine through the PCIe bus, the DMA engine is connected to the PF processor and the VF processor, and the direct access of data between VMs is controlled by the DMA engine.
接收指令中至少包括需要发送数据的VM,说明该VM已经准备好了需要发送的数据,同时管理器已经做好接收数据的准备,DMA引擎可以从接收指令对应的VM读取数据存储到管理器中。The receiving instruction includes at least the VM that needs to send data, indicating that the VM is ready to send the data, and the manager is ready to receive the data. The DMA engine can read the data from the VM corresponding to the receiving instruction and store it in the manager. middle.
因此,在步骤S201之前,PF处理器作出如下处理:Therefore, before step S201, the PF processor performs the following processing:
A1、所述PF处理器接收所述DMA引擎发送的第一通知信息,所述第一通知信息为所述DMA引擎用于通知所述PF处理器有VM需要发送数据;A1. The PF processor receives first notification information sent by the DMA engine, where the first notification information is used by the DMA engine to notify the PF processor that a VM needs to send data;
A2、所述PF处理器检测所述管理器是否准备好接收所述VF处理器对应的VM发送的数据;A2. The PF processor detects whether the manager is ready to receive data sent by the VM corresponding to the VF processor;
A3、若是,所述PF处理器向所述DMA引擎发送接收指令,所述接收指令包括需要发送数据的VM。A3. If yes, the PF processor sends a receiving instruction to the DMA engine, and the receiving instruction includes a VM that needs to send data.
在成功读取接收指令对应的VM上的数据,并存储到管理器之后,DMA引擎向PF处理器发送第一响应信息,该第一响应信息用于通知PF处理器,其成功将所述接收指令对应的VM发送的数据存储到管理器中。After successfully reading the data on the VM corresponding to the received instruction and storing it in the manager, the DMA engine sends the first response information to the PF processor, and the first response information is used to notify the PF processor that it has successfully translated the received The data sent by the VM corresponding to the instruction is stored in the manager.
S202、所述DMA引擎在收到所述PF处理器的发送指令后,从所述管理器读取所述数据并将所述数据存储到所述发送指令对应的VM中。S202. After receiving the sending instruction from the PF processor, the DMA engine reads the data from the manager and stores the data in a VM corresponding to the sending instruction.
本发明实施例的执行主体是DMA引擎,DMA引擎将从接收指令对应的VM中读取数据,并将数据存储到管理器中;如果DMA引擎接收到PF处理器发送的发送指令,那么将从管理器中读取数据,并将数据存储到发送指令对应的VM中。本发明实施例以管理器作为中转点,通过DMA引擎在VM与管理器之间进行直接存取,进而实现了VM之间的通信,且不会受限于PCIe设备的硬件资源,支持大数据的处理,传输效率较高。The execution subject of the embodiment of the present invention is the DMA engine, and the DMA engine will read data from the VM corresponding to the received instruction, and store the data in the manager; if the DMA engine receives the sending instruction sent by the PF processor, it will read the data from the The manager reads the data and stores the data in the VM corresponding to the sending instruction. In the embodiment of the present invention, the manager is used as a transfer point, and the direct access between the VM and the manager is performed through the DMA engine, thereby realizing the communication between the VMs, without being limited by the hardware resources of the PCIe device, and supporting large data Processing, transmission efficiency is higher.
在DMA引擎收到所述PF处理器的发送指令之后,DMA引擎还将检测该发送指令对应的VM是否准备好接收数据,若是,则从管理器读取数据并将所述数据存储到发送指令对应的VM中。After the DMA engine receives the sending instruction of the PF processor, the DMA engine will also detect whether the VM corresponding to the sending instruction is ready to receive data, if so, read the data from the manager and store the data in the sending instruction in the corresponding VM.
在成功读取管理器中的数据,并存储到发送指令对应的VM后,DMA引擎还将给PF处理器发送第二响应信息,用于通知PF处理器其已成功从管理器中读取数据并存储到发送指令对应的VM中;再向接收数据的VM相关联的VF处理器发送第二通知信息,用于通知接收数据的VM相关联的VF处理器,其已成功将管理器的数据存储到其相关联的VM中。After successfully reading the data in the manager and storing it in the VM corresponding to the sending command, the DMA engine will also send a second response message to the PF processor to notify the PF processor that it has successfully read data from the manager And store it in the VM corresponding to the sending instruction; then send the second notification information to the VF processor associated with the VM receiving the data, for notifying the VF processor associated with the VM receiving the data that it has successfully transferred the data of the manager Stored into its associated VM.
在本发明优选的实施例中,每个VM在其内存中分配两块地址连续的内存空间作为VF缓存,例如接收缓存和发送缓存。其中,接收缓存用于接收来自管理器的数据,发送缓存用于存储发送到管理器的数据。相应地,在管理器中也分配两块地址连续的内存空间作为PF缓存,同样分别命名为接收缓存和发送缓存。VM的接收缓存和发送缓存的大小可以大于64Bytes,相应地,管理器中的接收缓存和发送缓存的大小也大于64Bytes,实际应用中接收缓存和发送缓存的大小取决于物理机内存的大小。由于管理器作为VM通信之间通信的中转点,因此,可以先分配管理器的接收缓存和发送缓存,之后根据管理器中接收缓存和发送缓存的大小来分配所有VM中的接收缓存和发送缓存。In a preferred embodiment of the present invention, each VM allocates two memory spaces with continuous addresses in its memory as VF buffers, such as a receive buffer and a send buffer. Among them, the receiving buffer is used to receive data from the manager, and the sending buffer is used to store data sent to the manager. Correspondingly, two memory spaces with continuous addresses are also allocated in the manager as PF caches, which are also named receive cache and send cache respectively. The size of the receiving buffer and sending buffer of the VM can be greater than 64Bytes. Correspondingly, the size of the receiving buffer and sending buffer in the manager is also larger than 64Bytes. The size of the receiving buffer and sending buffer in practical applications depends on the size of the physical machine memory. Since the manager is used as a transit point for communication between VMs, the receiving buffer and sending buffer of the manager can be allocated first, and then the receiving buffer and sending buffer in all VMs can be allocated according to the size of the receiving buffer and sending buffer in the manager .
同时,为PF处理器和每一个VF处理器配置相关的寄存器组。其中,PF处理器配置的寄存器组及其基本功能如下:At the same time, configure related register groups for the PF processor and each VF processor. Among them, the register group configured by the PF processor and its basic functions are as follows:
A1、PF_Mailbox_Size:PF处理器可进行读写操作,由PF处理器写入能够支持的最大缓存大小。A1. PF_Mailbox_Size: The PF processor can perform read and write operations, and the PF processor writes the maximum cache size that can be supported.
A2、PF_RxMailbox_Addr:PF处理器可进行读写操作,是PF处理器在其内存中分配用于存储来自VF的数据的起始地址(即管理器中接收缓存中存储数据的起始地址)。A2. PF_RxMailbox_Addr: The PF processor can perform read and write operations. It is the starting address allocated by the PF processor in its memory for storing data from the VF (that is, the starting address of storing data in the receive buffer in the manager).
A3、PF_TxMailbox_Addr:PF处理器可进行读写操作,是PF处理器在其内存中分配,用于存储发送到VF的数据的起始地址(即管理器中发送缓存的起始地址)。A3. PF_TxMailbox_Addr: The PF processor can perform read and write operations. It is allocated by the PF processor in its memory to store the start address of the data sent to the VF (that is, the start address of the send buffer in the manager).
A4、PF_TxLength:PF处理器可进行读写操作,是PF处理器放入到发送缓存中数据的有效长度值。A4. PF_TxLength: The PF processor can perform read and write operations, which is the effective length value of the data put into the transmit buffer by the PF processor.
A5、Dest_VF:PF处理器可进行读写操作,由PF处理器写入,是发送缓存中的数据发往的目标VF。A5. Dest_VF: The PF processor can perform read and write operations, and is written by the PF processor. It is the destination VF to which the data in the sending buffer is sent.
A6、VF_Req_Sts:PF可进行读取操作,还可以写0清零,是一个多位的状态寄存器,每一位对应一个VF处理器。当VF处理器把VF请求寄存器中对应的VF处理器的某个寄存器设置为1后,会触发一个中断发给PF。PF处理器通过读此寄存器可以知道哪些VF处理器准备发送数据给自己。A6. VF_Req_Sts: PF can be read, and can also be cleared by writing 0. It is a multi-bit status register, and each bit corresponds to a VF processor. When the VF processor sets a register of the corresponding VF processor in the VF request register to 1, an interrupt is triggered and sent to the PF. The PF processor can know which VF processors are ready to send data to itself by reading this register.
A7、PF_Rx_En:PF可进行读取操作和写1置位操作,是一个多位的控制寄存器,每一位对应一个VF处理器。当PF处理器确定管理器的接收缓存是空闲时,确定从某个VF处理器接收数据,就需要把对应的某位寄存器设置为1(可以同时也把PF_Rx_Done寄存器中对应寄存器清零),以通知DMA引擎开始从VF处理器关联的VM的发送缓存中开始读取数据到PF处理器关联的管理器的接收缓存中。一旦DMA引擎读取完成,DMA引擎需要把此寄存器的对应位清零,同时把下面的PF接收完成寄存器PF_Rx_Done对应的某位设置为1(表明已经放入了数据需要PF处理器来进行处理)。A7. PF_Rx_En: PF can perform read operation and write 1 set operation. It is a multi-bit control register, and each bit corresponds to a VF processor. When the PF processor determines that the receive buffer of the manager is idle, and determines to receive data from a VF processor, it needs to set the corresponding bit register to 1 (the corresponding register in the PF_Rx_Done register can also be cleared at the same time) to Notify the DMA engine to start reading data from the send buffer of the VM associated with the VF processor to the receive buffer of the manager associated with the PF processor. Once the DMA engine reading is completed, the DMA engine needs to clear the corresponding bit of this register, and at the same time set a certain bit corresponding to the following PF reception completion register PF_Rx_Done to 1 (indicating that the data has been placed and needs to be processed by the PF processor) .
值得注意的是,PF处理器一次只能把PF_Rx_En中的一位设置为1,即DMA引擎一次只能从一个VF处理器读取数据。It is worth noting that the PF processor can only set one bit of PF_Rx_En to 1 at a time, that is, the DMA engine can only read data from one VF processor at a time.
A8、PF_Rx_Done:PF处理器可进行读取操作和可以写0清零操作,是一个多位的状态寄存器,每一位对应一个VF处理器。当DMA引擎把来自某个VF处理器关联的发送缓存的数据读取完毕了后,会发送一个中断给PF处理器,同时把此寄存器的相应位设置为1。PF处理器可以读此寄存器来知道其接收缓存中的数据是否有效。PF处理器把接收缓存中的数据取走或使用完毕后,可以把此寄存器的相应位设置为0,以便可以准备接收新的数据。A8. PF_Rx_Done: The PF processor can read and write 0 to clear. It is a multi-bit status register, and each bit corresponds to a VF processor. When the DMA engine has finished reading the data from the transmit buffer associated with a certain VF processor, it will send an interrupt to the PF processor, and set the corresponding bit of this register to 1 at the same time. The PF processor can read this register to know whether the data in its receive buffer is valid. After the PF processor has taken or used up the data in the receiving buffer, it can set the corresponding bit of this register to 0, so that it can be ready to receive new data.
A9、PF_Rx_Length:PF处理器可进行读取操作,当DMA引擎把存储到管理器的接收缓存中的数据的有效长度值写入到其中,此寄存器中的值只有在PF_Rx_Done为1时有效。A9. PF_Rx_Length: The PF processor can perform read operations. When the DMA engine writes the effective length value of the data stored in the receive buffer of the manager into it, the value in this register is only valid when PF_Rx_Done is 1.
A10、PF_Req:PF处理器可进行读取操作和可写入1置位,但不能清零。一旦PF处理器把待发送的数据完整地放入到了发送缓存后,把目标VF写入到Dest_VF中,把发送数据的长度写入到PF_TxLength后,可以把此寄存器设置为1,通知DMA引擎PF处理器有数据需要发送。当DMA引擎发现对应的目标VF的PF_Done寄存器为0,可以开始进行数据的读取。一旦读取完成,DMA引擎把PF_Req清零、同时把对应VF处理器的PF_Done置为1,VF处理器的PF_TxLength写入实际读取的数据长度值。PF处理器发现此PF_Req寄存器被清零后,可以向接收缓存中放入新的数据。A10, PF_Req: The PF processor can read and write 1 to set, but it cannot be cleared. Once the PF processor has completely put the data to be sent into the send buffer, write the target VF into Dest_VF, and write the length of the send data into PF_TxLength, you can set this register to 1 and notify the DMA engine PF The processor has data to send. When the DMA engine finds that the PF_Done register of the corresponding target VF is 0, it can start reading data. Once the reading is completed, the DMA engine clears PF_Req, and at the same time sets PF_Done of the corresponding VF processor to 1, and PF_TxLength of the VF processor writes the actual read data length value. After the PF processor finds that the PF_Req register is cleared, it can put new data into the receive buffer.
相应地,为VF配置的寄存器组及其基本功能如下:Correspondingly, the register set configured for VF and its basic functions are as follows:
B1、PF_Mailbox_Size:VF处理器可以进行读取操作,是PF处理器中的PF_Mailbox_Size的镜像,只是一个只读的寄存器,用于告知VF处理器PF处理器支持的缓存大小;B1. PF_Mailbox_Size: The VF processor can perform read operations. It is the mirror image of PF_Mailbox_Size in the PF processor. It is just a read-only register used to inform the VF processor of the cache size supported by the PF processor;
在PF处理器关联的管理器分配好缓存大小后,把其大小值写入到PF_Mailbox_Size中,各个VM通过读去各自关联的VF处理器中的镜像PF_Mailbox_Size获得管理器设置的缓存大小,以便正确设置VM发送到PF的数据大小,避免超过PF处理器分配的缓存大小而出现数据丢失。After the manager associated with the PF processor allocates the cache size, write its size value into PF_Mailbox_Size, and each VM obtains the cache size set by the manager by reading the image PF_Mailbox_Size in its associated VF processor, so as to set it correctly The size of the data sent by the VM to the PF to avoid data loss due to exceeding the cache size allocated by the PF processor.
B2、VF_RxMailbox_Addr:VF处理器可进行读写操作,是VF处理器在其内存中分配,存储来自PF处理器数据的缓存起始地址(即接收缓存的起始地址)。B2. VF_RxMailbox_Addr: The VF processor can perform read and write operations. It is allocated by the VF processor in its memory to store the buffer start address of the data from the PF processor (that is, the start address of the receive buffer).
B3、VF_TxMailbox_Addr:VF处理器可进行读写操作,是VF处理器在其内存中分配,用于存放发送到PF处理器数据的缓存起始地址(即发送缓存的起始地址)。B3. VF_TxMailbox_Addr: The VF processor can perform read and write operations. It is allocated by the VF processor in its memory to store the buffer start address of the data sent to the PF processor (that is, the start address of the send buffer).
B4、VF_TxLength:VF处理器可以进行读写操作,是VF处理器放入到发送缓存中的数据的有效长度值。B4. VF_TxLength: The VF processor can perform read and write operations, which is the effective length value of the data put into the transmit buffer by the VF processor.
B5、VF_Req:VF处理器可以进行读取操作和可写1置位,但不能清零。一旦VF处理器把待发送的数据完整地放入到了发送缓存后,可以把此寄存器设置为1,来触发一个中断发送到PF处理器,以通知PF处理器来接收数据。此寄存器将会在PF处理器接收完数据,对其PF_Rx_Done寄存器清零后清除。VF处理器发现此寄存器被清零后,表明发送缓存可以放入新的数据。B5. VF_Req: The VF processor can read and write 1 to set, but it cannot be cleared. Once the VF processor has completely put the data to be sent into the send buffer, this register can be set to 1 to trigger an interrupt to be sent to the PF processor to notify the PF processor to receive the data. This register will be cleared after the PF processor has received data and cleared its PF_Rx_Done register. After the VF processor finds that this register is cleared, it indicates that the sending buffer can put new data.
B6、PF_Done:VF处理器可进行读取操作和可写0清零,但VF处理器不能写1置位。当DMA引擎把来自PF处理器关联的管理器中的发送缓存中的数据读取到该VF的接收缓存中后,会把此寄存器置1,来触发一个中断发送到VF处理器,以通知VF处理器来接收数据;或者VF处理器通过定时查询此寄存器是否为1来判断是否需要来接收数据。在VF处理器把接收缓存中的数据使用完后,可以向此寄存器写0清零,以便可以接收新的数据。B6. PF_Done: The VF processor can perform read operations and write 0 to clear, but the VF processor cannot write 1 to set. When the DMA engine reads the data from the send buffer in the manager associated with the PF processor into the receive buffer of the VF, it will set this register to 1 to trigger an interrupt to be sent to the VF processor to notify the VF The processor receives data; or the VF processor judges whether it needs to receive data by regularly checking whether this register is 1. After the VF processor has used up the data in the receiving buffer, it can write 0 to this register to clear it, so that new data can be received.
B7、PF_TxLength:VF处理器只能读取不能写入,当DMA引擎把来管理器的发送缓存中的数据读取到该VF的接收缓存中后,会把具体写入的长度值写入到此寄存器中,以便VF处理器取用。B7. PF_TxLength: The VF processor can only read but not write. When the DMA engine reads the data from the send buffer of the manager into the receive buffer of the VF, it will write the specific written length value into In this register, so that the VF processor can access it.
值得注意的是,PF_TxLength寄存器中的值只是在PF_Done为1时有效。It is worth noting that the value in the PF_TxLength register is only valid when PF_Done is 1.
下面以X86平台为例,对本发明进行进一步介绍。具体如图3所示,X86平台中CPU通过PCIe总线与PCIe设备连接,CPU中通过VMM生成N个VM,并配置管理器,分别为每个VM和管理器分配连续的两块内存,分别为接收缓存和发送缓存,每一个VM与PCIe设备中的一个或多个VF处理器进行关联,管理器与PF进行关联,具体地,每个VM中有其操作系统,对应地,还安装与该VM相关联的VF处理器的VF驱动。同样地,管理器中除了安装其操作系统,还相应安装有与该管理器相关联的PF处理器的PF驱动。The following takes the X86 platform as an example to further introduce the present invention. Specifically, as shown in Figure 3, the CPU in the X86 platform is connected to the PCIe device through the PCIe bus. The CPU generates N VMs through the VMM, and configures the manager to allocate two consecutive blocks of memory for each VM and the manager, respectively. Receive cache and send cache, each VM is associated with one or more VF processors in the PCIe device, the manager is associated with PF, specifically, each VM has its operating system, and correspondingly, it is also installed with the The VF driver of the VF processor associated with the VM. Similarly, in addition to the operating system installed in the manager, the PF driver of the PF processor associated with the manager is also correspondingly installed.
其中,物理机中还包括有PCIe协议规定的PCIe根节点(英文:PCIe Root Complex,可以简称RC),该PCIe根节点通过PCIe协议规定的根端口(英文:Root Port,可以简称为RP)连接到PCIe总线上。而在PCIe设备中还包括PCIe协议规定的PCIe终节点(英文:PCIeEndpoint),该PCIe终节点连接到PCIe总线上,并与PF处理器、每一个VF处理器连接。Among them, the physical machine also includes a PCIe root node (English: PCIe Root Complex, which may be referred to as RC) specified by the PCIe protocol, and the PCIe root node is connected to to the PCIe bus. The PCIe device also includes a PCIe end point (English: PCIe Endpoint) stipulated in the PCIe protocol. The PCIe end point is connected to the PCIe bus and connected to the PF processor and each VF processor.
在PF处理器还包括寄存器组,其中,寄存器组中包括上述介绍的寄存器;同样,在每一个VF处理器包括有一个寄存器组,其寄存器组中包括上述介绍的VF处理器的寄存器。The PF processor also includes a register set, wherein the register set includes the above-mentioned registers; similarly, each VF processor includes a register set, and the register set includes the above-mentioned registers of the VF processor.
基于上述架构,可以理解的是,可以将原来的VF处理器与PF处理器之间通信通过VM与VM之间通信来实现。下面将介绍将VF处理器相关联的VM的数据存储到PF处理器相关联的管理器中的实现流程,具体请参阅图4,图4为本发明另一实施例提供的实现虚拟机间通信的方法的流程示意图,可包括:Based on the above architecture, it can be understood that the original communication between the VF processor and the PF processor can be realized through the communication between VMs. The following will introduce the implementation process of storing the data of the VM associated with the VF processor to the manager associated with the PF processor. Please refer to Figure 4 for details. Figure 4 is another embodiment of the present invention for implementing communication between virtual machines A schematic flow chart of the method, which may include:
S401、VF处理器确定寄存器VF_Req的值是否被清除;S401. The VF processor determines whether the value of the register VF_Req is cleared;
其中,寄存器VF_Req的值是否被清除,也就是寄存器VF_Req的值是否等于1’b0。在VF处理器相关联的VM的发送缓存被放入数据时,寄存器VF_Req写1置位,在VM的发送缓存中的数据被读取之后,被清除。在没有被清除时,发送执行步骤S401;在被清除时,执行步骤S402。Among them, whether the value of the register VF_Req is cleared, that is, whether the value of the register VF_Req is equal to 1’b0. When the sending buffer of the VM associated with the VF processor is put into data, the register VF_Req writes 1 to set, and after the data in the sending buffer of the VM is read, it is cleared. When it is not cleared, send and execute step S401; when it is cleared, execute step S402.
S402、VF处理器将待发送的数据写入发送缓存,并将数据长度写入寄存器VF_TxLength,并对寄存器VF_Req写1置位;S402, the VF processor writes the data to be sent into the sending buffer, and writes the data length into the register VF_TxLength, and writes 1 to the register VF_Req to set;
其中,VF处理器可以对VF_Req写1置位,但不能清零。VF_Req写1置位,就是对寄存器VF_Req写入1’b1,说明VF处理器已经把待发送的数据放入发送缓存,可以通知PF处理器来接收数据。Among them, the VF processor can write 1 to VF_Req, but it cannot be cleared. Writing 1 to VF_Req is to write 1’b1 to the register VF_Req, indicating that the VF processor has put the data to be sent into the sending buffer, and can notify the PF processor to receive the data.
S403、DMA引擎检测到寄存器VF_Req置位后,将PF处理器的寄存器VF_Req_Sts对应的VF处理器的状态寄存器置位,并向PF处理器发送第一通知信息;S403. After the DMA engine detects that the register VF_Req is set, it sets the status register of the VF processor corresponding to the register VF_Req_Sts of the PF processor, and sends the first notification information to the PF processor;
DMA引擎将PF处理器中的多位的状态寄存器中对应该VF处理器的寄存器置位,然后向PF处理器发送第一通知信息,以便PF处理器知道哪个VF处理器相关联的VM需要发送数据。The DMA engine sets the register corresponding to the VF processor in the multi-bit status register in the PF processor, and then sends the first notification message to the PF processor, so that the PF processor knows which VM associated with the VF processor needs to send data.
具体地,第一通知信息是DMA引擎在将寄存器VF_Req_Sts对应的VF处理器的状态寄存器置位后,产生的一个中断信号。Specifically, the first notification information is an interrupt signal generated by the DMA engine after setting the status register of the VF processor corresponding to the register VF_Req_Sts.
S404、PF处理器检测管理器中的接收缓存是否空闲;S404, the PF processor detects whether the receive buffer in the manager is idle;
在管理器的接收缓存空闲时,可以用来接收来自VM的数据;管理器的接收缓存不空闲时,则继续等待,直到管理器的接收缓存空闲。因此,在管理器接收缓存空闲时,转向步骤S405。When the receiving buffer of the manager is free, it can be used to receive data from the VM; when the receiving buffer of the manager is not free, it continues to wait until the receiving buffer of the manager is free. Therefore, when the manager's reception buffer is free, go to step S405.
S405、PF处理器根据寄存器VF_Req_Sts的值,将寄存器PF_Rx_En相应的位置1,然后向DMA引擎发送接收指令;S405. The PF processor sets the corresponding position of the register PF_Rx_En to 1 according to the value of the register VF_Req_Sts, and then sends a receiving instruction to the DMA engine;
PF处理器通过VF_Req_Sts中被置1的位,知道是哪个VF相关联的VM发送数据,进而将PF_Rx_En相应的位也置1,说明PF处理器相关联的管理器中接收缓存已做好接收数据的准备,DMA引擎可以去读取数据。The PF processor knows which VM associated with the VF sends data through the bit set to 1 in VF_Req_Sts, and then sets the corresponding bit of PF_Rx_En to 1, indicating that the receiving buffer in the manager associated with the PF processor is ready to receive data ready, the DMA engine can read data.
S406、DMA引擎从接收指令对应的VM的发送缓存中读取数据,并将读取到的数据存储到管理器的接收缓存中;S406. The DMA engine reads data from the sending buffer of the VM corresponding to the receiving instruction, and stores the read data in the receiving buffer of the manager;
S407、DMA引擎将寄存器PF_Rx_Done置位,并将数据长度写入寄存器PF_Rx_Length,对寄存器PF_Rx_En清零。S407. The DMA engine sets the register PF_Rx_Done, writes the data length into the register PF_Rx_Length, and clears the register PF_Rx_En.
在DMA引擎成功读取数据,并将数据存储到管理器的接收缓存中后,将寄存器PF_Rx_Done写1置位,PF处理器通过读取寄存器PF_Rx_Done的值,知道管理器接收缓存中的数据有效。同时,DMA引擎还向PF处理器发送第一响应信息,也就是发送一个中断信号,通知PF处理器已成功将数据读取并存储。After the DMA engine successfully reads the data and stores the data in the receive buffer of the manager, write 1 to the register PF_Rx_Done, and the PF processor knows that the data in the receive buffer of the manager is valid by reading the value of the register PF_Rx_Done. At the same time, the DMA engine also sends the first response information to the PF processor, that is, sends an interrupt signal, notifying the PF processor that the data has been successfully read and stored.
而读取的数据的长度已将写入寄存器PF_Rx_Length,以便PF处理器通过读取寄存器PF_Rx_Length的值知道数据的长度。The length of the read data has been written into the register PF_Rx_Length, so that the PF processor can know the length of the data by reading the value of the register PF_Rx_Length.
之后,PF处理器根据寄存器PF_Rx_Done的值知道管理器的接收缓存中的数据有效后,如果是VM之间的数据交互,需要将管理器接收缓存中的数据发送给目标VM,那么PF处理器将管理器接收缓存中的数据放入发送缓存中,准备发送。如果管理器接收缓存中的数据是VM相关联的VF处理器向PF处理器请求资源的信息,那么PF处理器根据管理器接收缓存的数据,将VF处理器请求的数据放入发送缓存,同时管理器接收缓存中的数据被使用完毕。Afterwards, after the PF processor knows that the data in the receive buffer of the manager is valid according to the value of the register PF_Rx_Done, if it is data interaction between VMs, the data in the receive buffer of the manager needs to be sent to the target VM, then the PF processor will The data in the manager's receiving buffer is put into the sending buffer, ready to be sent. If the data in the manager receiving buffer is the information that the VF processor associated with the VM requests resources from the PF processor, then the PF processor puts the data requested by the VF processor into the sending buffer according to the data received by the manager, and at the same time The data in the manager's receive buffer has been used up.
然后PF处理器将寄存器PF_Rx_Done值清除,说明管理器接收缓存中的数据被读取或使用完毕,可以准备接收新数据。将寄存器VF_Req_Sts相应的位写0清零,说明当前该位对应的VF处理器没有数据发送。Then the PF processor clears the value of the register PF_Rx_Done, indicating that the data in the manager's receiving buffer has been read or used up, and it is ready to receive new data. Write 0 to clear the corresponding bit of the register VF_Req_Sts, indicating that the current VF processor corresponding to this bit has no data to send.
另外,DMA引擎还将VF处理器的寄存器VF_Req的值清除,VF处理器通过读取寄存器VF_Req的值,在寄存器VF_Req的值被清除后,可以向相关联的VM的发送缓存放入新的数据。In addition, the DMA engine also clears the value of the register VF_Req of the VF processor. By reading the value of the register VF_Req, the VF processor can put new data into the sending buffer of the associated VM after the value of the register VF_Req is cleared. .
在另一个实施例中,本发明将介绍从管理器读取数据存储到VM的实现流程,与附图4流程相似,请参阅图5,图5为本发明另一实施例提供的实现虚拟机间通信的方法的流程示意图,可包括:In another embodiment, the present invention will introduce the implementation process of reading data from the manager and storing it into the VM, which is similar to the process of Figure 4, please refer to Figure 5, Figure 5 is the realization of the virtual machine provided by another embodiment of the present invention Schematic flow diagram of the method for inter-communication, which may include:
S501、PF处理器确定寄存器PF_Req的值是否被清除;S501. The PF processor determines whether the value of the register PF_Req is cleared;
其中,寄存器PF_Req的值是否被清除,也就是寄存器PF_Req的值是否等于1’b0。在寄存器PF_Req的值被清除后,可以往管理器的发送缓存中放入数据。因此,在没有被清除时,发送执行步骤S501,直至被清除,在被清除时,转向执行步骤S502。Among them, whether the value of the register PF_Req is cleared, that is, whether the value of the register PF_Req is equal to 1’b0. After the value of the register PF_Req is cleared, data can be put into the sending buffer of the manager. Therefore, when it is not cleared, the transmission executes step S501 until it is cleared, and when it is cleared, it turns to step S502.
S502、PF处理器将待发送的数据写入发送缓存,将目标VF处理器写入到寄存器Dest_VF和将数据的长度写入PF_Tx_Length;S502, the PF processor writes the data to be sent into the sending buffer, writes the target VF processor into the register Dest_VF and writes the length of the data into PF_Tx_Length;
发送缓存是指该PF处理器关联的管理器中所分配的发送缓存。The sending buffer refers to the sending buffer allocated in the manager associated with the PF processor.
PF处理器在寄存器Dest_VF写入需要发往的目标VF处理器的身份标识号。The PF processor writes the ID number of the target VF processor to be sent to the register Dest_VF.
S503、PF处理器对寄存器PF_Req置位,向DMA引擎发送发送指令;S503, the PF processor sets the register PF_Req, and sends a sending instruction to the DMA engine;
其中,PF处理器可以对寄存器PF_Req置位,但不能清零。PF_Req被置位,就是将1’b1写入寄存器PF_Req,说明PF处理器已经把待发送的数据放入管理器的发送缓存,然后通知DMA引擎来读取。Among them, the PF processor can set the register PF_Req, but cannot clear it. PF_Req is set, that is, 1’b1 is written into the register PF_Req, indicating that the PF processor has put the data to be sent into the send buffer of the manager, and then notifies the DMA engine to read it.
S504、DMA引擎检测目标VF处理器的PF_Done是否清零;S504, the DMA engine detects whether the PF_Done of the target VF processor is cleared;
其中,在寄存器PF_Done被清零时,说明VF处理器关联的VM中的接收缓存是空闲的,可以向接收缓存中放入数据。Wherein, when the register PF_Done is cleared, it indicates that the receiving buffer in the VM associated with the VF processor is idle, and data can be put into the receiving buffer.
在寄存器PF_Done还没有被清零时,继续等待;在寄存器PF_Done被清零后,转向执行步骤S505。When the register PF_Done has not been cleared, continue to wait; after the register PF_Done is cleared, turn to step S505.
S505、DMA引擎从管理器的发送缓存读取数据,并将读取到的数据存储到目标VF处理器关联的VM的接收缓存中;S505. The DMA engine reads data from the sending buffer of the manager, and stores the read data in the receiving buffer of the VM associated with the target VF processor;
DMA引擎在确定管理器的发送缓存具有待发送的数据,而且目标VF处理器关联的VM的接收缓存空闲时,将从管理器的发送缓存读取数据并存储到目标VF关联的VM的接收缓存中。When the DMA engine determines that the send buffer of the manager has data to be sent and the receive buffer of the VM associated with the target VF processor is free, it will read data from the send buffer of the manager and store it in the receive buffer of the VM associated with the target VF middle.
S506、DMA引擎对寄存器PF_Done置位,将数据的长度写入寄存器PF_TxLength和对寄存器PF_Req写入1’b0清除;S506, the DMA engine sets the register PF_Done, writes the length of the data into the register PF_TxLength and writes 1'b0 to the register PF_Req to clear;
在DMA引擎完成数据读取后,将目标VF处理器中的寄存器PF_Done写1置位,目标VF处理器通过读取寄存器PF_Done来判断VM接收缓存中的数据是否有效。After the DMA engine finishes reading the data, it writes 1 to the register PF_Done in the target VF processor, and the target VF processor reads the register PF_Done to determine whether the data in the VM receive buffer is valid.
S507、DMA引擎向目标VF处理器发送第二通知信息。S507. The DMA engine sends second notification information to the target VF processor.
第二通知信息用于通知所述目标VF处理器,已成功将所述管理器的数据存储到其对应的VM的接收缓存中。The second notification information is used to notify the target VF processor that the data of the manager has been successfully stored in the receive cache of its corresponding VM.
具体地,第二通知信息是DMA引擎产生的一个中断信号。Specifically, the second notification information is an interrupt signal generated by the DMA engine.
目标VF处理器在收到第二通知信息后,根据实际业务需要,对VM接收缓存中的数据作出相应处理。之后,将PF_Done写0清零,以便VM的接收缓存可以准备接收新的数据。After receiving the second notification information, the target VF processor performs corresponding processing on the data in the VM receiving buffer according to actual business needs. After that, write 0 to PF_Done to clear it, so that the receive buffer of the VM can be ready to receive new data.
请参阅图6,本发明实施例还提供了一种基于上述实现虚拟机间通信的方法的DMA引擎,该DMA引擎设置在附图3所示的PCIe设备中,与PF处理器和VF处理器分别连接;如图6所示,一种DMA引擎600可包括:Please refer to FIG. 6, the embodiment of the present invention also provides a DMA engine based on the above-mentioned method for realizing inter-virtual machine communication. The DMA engine is set in the PCIe device shown in FIG. 3 and communicates with the PF processor and the VF processor Connect respectively; As shown in Figure 6, a kind of DMA engine 600 can comprise:
第一处理模块610,用于在收到所述PF处理器的接收指令后,从所述接收指令对应的VM上读取数据并将所述数据存储到所述管理器中;The first processing module 610 is configured to, after receiving the receiving instruction from the PF processor, read data from the VM corresponding to the receiving instruction and store the data in the manager;
第二处理模块620,用于在收到所述PF处理器的发送指令后,从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中。The second processing module 620 is configured to read data from the manager and store the data in the VM corresponding to the sending instruction after receiving the sending instruction from the PF processor.
其中,DMA引擎中的第一处理模块在收到PF处理器的接收指令后,从所述接收指令对应的VF处理器关联的VM上读取数据存储到所述管理器中;而第二处理模块在收到所述PF处理器的发送指令后,从所述管理器读取所述数据存储到所述发送指令对应的VM中,无需在PCIe设备中另外分配内存,减少PCIe设备的资源消耗,通过DMA读取数据,有效提高了VM之间的通信效率。Wherein, after the first processing module in the DMA engine receives the receiving instruction from the PF processor, it reads data from the VM associated with the VF processor corresponding to the receiving instruction and stores it in the manager; and the second processing module After the module receives the sending instruction from the PF processor, it reads the data from the manager and stores it in the VM corresponding to the sending instruction, without additionally allocating memory in the PCIe device, reducing the resource consumption of the PCIe device , read data through DMA, which effectively improves the communication efficiency between VMs.
在本发明一个可实施方式中,上述DMA引擎600还包括:In a possible implementation manner of the present invention, the above-mentioned DMA engine 600 also includes:
第一响应模块,用于向所述PF处理器发送第一响应信息,所述第一响应信息用于通知所述PF处理器,已成功将所述接收指令对应的VM发送的数据存储到所述管理器中。The first response module is configured to send first response information to the PF processor, the first response information is used to notify the PF processor that the data sent by the VM corresponding to the received instruction has been successfully stored in the in the manager.
在本发明另一个可实施方式中,上述DMA引擎600还包括:In another possible implementation manner of the present invention, the above-mentioned DMA engine 600 also includes:
检测模块,用于检测所述发送指令对应的VM是否准备好接收所述数据;A detection module, configured to detect whether the VM corresponding to the sending instruction is ready to receive the data;
若是,则由上述第二处理模块执行从所述管理器读取数据并将所述数据存储到所述发送指令对应的VM中的步骤。If yes, the above-mentioned second processing module executes the step of reading data from the manager and storing the data in the VM corresponding to the sending instruction.
在本发明另一个可实施方式中,上述DMA引擎600还包括:In another possible implementation manner of the present invention, the above-mentioned DMA engine 600 also includes:
第二响应模块,用于向所述PF处理器发送第二响应信息,所述第二响应信息用于通知所述PF处理器已成功从所述管理器中读取数据存储到所述发送指令对应的VM中;和,向所述发送指令对应的VM相关联的VF处理器发送第二通知信息,所述第二通知信息用于通知所述发送指令对应的VM相关联的VF处理器,已成功将所述管理器的数据存储到所述发送指令对应的VM中。The second response module is configured to send second response information to the PF processor, and the second response information is used to notify the PF processor that the data has been successfully read from the manager and stored in the sending instruction In the corresponding VM; and, sending second notification information to the VF processor associated with the VM corresponding to the sending instruction, where the second notification information is used to notify the VF processor associated with the VM corresponding to the sending instruction, The data of the manager has been successfully stored in the VM corresponding to the sending instruction.
请参考图7a,图7a为本发明实施例提供的一种实现虚拟机间通信的系统的结构示意图;如图7a所示,在该系统中包括物理机和PCIe设备,所述PCIe设备与物理机通过PCIe总线连接,所述物理机中包括多个虚拟机VM和一个管理器,所述多个VM和管理器通过虚拟化技术实现在所述物理机中;所述PCIe设备中包括一物理功能PF处理器、多个虚拟功能VF处理器和直接存储器存取DMA引擎,所述PF处理器和多个VF处理器通过虚拟化技术实现在所述PCIe设备中;其中,一个所述VM关联一个或多个所述VF处理器,所述管理器关联所述PF处理器;Please refer to FIG. 7a. FIG. 7a is a schematic structural diagram of a system for realizing communication between virtual machines provided by an embodiment of the present invention; as shown in FIG. 7a, the system includes a physical machine and a PCIe device, and the PCIe device and the physical The machines are connected through the PCIe bus, and the physical machine includes a plurality of virtual machine VMs and a manager, and the plurality of VMs and the manager are implemented in the physical machine through virtualization technology; the PCIe device includes a physical A function PF processor, a plurality of virtual function VF processors and a direct memory access DMA engine, the PF processor and a plurality of VF processors are implemented in the PCIe device through virtualization technology; wherein, one VM is associated One or more of the VF processors, the manager is associated with the PF processors;
上述DMA引擎如附图6,可以参照上述详细介绍,在此不再赘述。The above-mentioned DMA engine is shown in FIG. 6 , and reference may be made to the above-mentioned detailed introduction, and details are not repeated here.
另外,上述PF处理器用于向所述DMA引擎发送所述接收指令和所述发送指令。In addition, the above-mentioned PF processor is configured to send the receiving instruction and the sending instruction to the DMA engine.
在一个可实施的方式中,所述PF处理器还用于:接收所述DMA引擎发送的第一通知信息,所述第一通知信息为所述DMA引擎用于通知所述PF处理器有VM需要发送数据;检测所述管理器是否准备好接收所述VF处理器对应的VM发送的数据;若是,则执行向所述DMA引擎发送所述接收指令和所述发送指令的步骤,所述接收指令包括需要发送数据的VM。In an implementable manner, the PF processor is further configured to: receive first notification information sent by the DMA engine, where the first notification information is used by the DMA engine to notify the PF processor that there is a VM Need to send data; detect whether the manager is ready to receive the data sent by the VM corresponding to the VF processor; if so, perform the steps of sending the receiving instruction and the sending instruction to the DMA engine, and the receiving Instructions include VMs that need to send data.
在一个可实施的方式中,所述PF处理器还用于:检测所述管理器中已分配的接收缓存是否空闲以确定所述管理器是否准备好接收所述VF处理器对应的VM发送的数据,所述发送指令对应的VM中已分配的接收缓存用于存储数据。In an implementable manner, the PF processor is further configured to: detect whether the allocated receive buffer in the manager is free to determine whether the manager is ready to receive the message sent by the VM corresponding to the VF processor For data, the allocated receiving buffer in the VM corresponding to the sending instruction is used to store data.
请参阅图7b,图7b为本发明另一实施例提供的实现虚拟机间通信的系统的应用示意图;在上述管理器和每一个VM中,分别分配一个发送缓存和接收缓存,同时,在PF处理器分配有一组寄存器,在每一个VF处理器中分配有一组寄存器,具体如上述介绍,在此不再赘述。Please refer to FIG. 7b. FIG. 7b is a schematic diagram of the application of a system for realizing communication between virtual machines provided by another embodiment of the present invention; in the above-mentioned manager and each VM, a sending cache and a receiving cache are allocated respectively, and at the same time, in the PF A set of registers is allocated to the processor, and a set of registers is allocated to each VF processor. The details are as described above and will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目标。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the goal of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and other media that can store program codes.
以上对本发明所提供的一种实现虚拟机间通信的方法及系统进行了详细介绍,对于本领域的一般技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。A method and system for realizing communication between virtual machines provided by the present invention has been introduced in detail above. For those skilled in the art, according to the idea of the embodiment of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as limiting the present invention.
Claims (17)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410351456.2A CN104123173B (en) | 2014-07-22 | 2014-07-22 | A kind of method and device for realizing inter-virtual machine communication |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410351456.2A CN104123173B (en) | 2014-07-22 | 2014-07-22 | A kind of method and device for realizing inter-virtual machine communication |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN104123173A CN104123173A (en) | 2014-10-29 |
| CN104123173B true CN104123173B (en) | 2017-08-25 |
Family
ID=51768597
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410351456.2A Active CN104123173B (en) | 2014-07-22 | 2014-07-22 | A kind of method and device for realizing inter-virtual machine communication |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN104123173B (en) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180181421A1 (en) * | 2016-12-27 | 2018-06-28 | Intel Corporation | Transferring packets between virtual machines via a direct memory access device |
| CN106897106B (en) * | 2017-01-12 | 2018-01-16 | 北京三未信安科技发展有限公司 | The concurrent DMA of multi-dummy machine sequential scheduling method and system under a kind of SR IOV environment |
| CN109656676B (en) * | 2017-10-11 | 2023-01-06 | 阿里巴巴集团控股有限公司 | Control method and device for sharing FPGA by multiple virtual machines and electronic equipment |
| CN110858164B (en) * | 2018-08-22 | 2022-09-09 | 成都华为技术有限公司 | Inter-process communication method, device and computer readable medium |
| CN111949371B (en) * | 2020-08-14 | 2022-07-22 | 苏州浪潮智能科技有限公司 | Command information transmission method, system and device and readable storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102591702A (en) * | 2011-12-31 | 2012-07-18 | 华为技术有限公司 | Virtualization processing method, related device and computer system |
| CN102650976A (en) * | 2012-04-01 | 2012-08-29 | 中国科学院计算技术研究所 | Control device and method supporting single IO (Input/Output) virtual user level interface |
| CN102707991A (en) * | 2012-05-17 | 2012-10-03 | 中国科学院计算技术研究所 | Multi-root I/O (Input/Output) virtualization sharing method and system |
| CN102722414A (en) * | 2012-05-22 | 2012-10-10 | 中国科学院计算技术研究所 | Input/output (I/O) resource management method for multi-root I/O virtualization sharing system |
-
2014
- 2014-07-22 CN CN201410351456.2A patent/CN104123173B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102591702A (en) * | 2011-12-31 | 2012-07-18 | 华为技术有限公司 | Virtualization processing method, related device and computer system |
| CN102650976A (en) * | 2012-04-01 | 2012-08-29 | 中国科学院计算技术研究所 | Control device and method supporting single IO (Input/Output) virtual user level interface |
| CN102707991A (en) * | 2012-05-17 | 2012-10-03 | 中国科学院计算技术研究所 | Multi-root I/O (Input/Output) virtualization sharing method and system |
| CN102722414A (en) * | 2012-05-22 | 2012-10-10 | 中国科学院计算技术研究所 | Input/output (I/O) resource management method for multi-root I/O virtualization sharing system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104123173A (en) | 2014-10-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11409465B2 (en) | Systems and methods for managing communication between NVMe-SSD storage device(s) and NVMe-of host unit | |
| CN108243118B (en) | Method and physical host for forwarding packets | |
| EP3033681B1 (en) | Method and apparatus for delivering msi-x interrupts through non-transparent bridges to computing resources in pci-express clusters | |
| CN107995129B (en) | NFV message forwarding method and device | |
| EP2927812B1 (en) | Method and apparatus for extending pcie bus domain | |
| US8645594B2 (en) | Driver-assisted base address register mapping | |
| CN109983449A (en) | Data processing method and storage system | |
| WO2021051919A1 (en) | Data forwarding chip and server | |
| US11741039B2 (en) | Peripheral component interconnect express device and method of operating the same | |
| CN100405303C (en) | Data processing system | |
| CN109983741B (en) | Transferring packets between virtual machines via direct memory access devices | |
| EP3163452B1 (en) | Efficient virtual i/o address translation | |
| US8996774B2 (en) | Performing emulated message signaled interrupt handling | |
| CN112306624A (en) | An information processing method, physical machine and PCIE device | |
| CN104123173B (en) | A kind of method and device for realizing inter-virtual machine communication | |
| EP3159802B1 (en) | Sharing method and device for pcie i/o device and interconnection system | |
| EP4421631A1 (en) | Data migration method and apparatus, and electronic device | |
| US9003077B2 (en) | Sharing IOMMU mappings across devices in a DMA group | |
| US20250274126A1 (en) | Interface device and method of operating the same | |
| CN114911411A (en) | Data storage method and device and network equipment | |
| Shim et al. | Design and implementation of initial OpenSHMEM on PCIe NTB based cloud computing | |
| CN106502721A (en) | A kind of order discharging method, device and physical machine | |
| JP4894963B2 (en) | Data processing system | |
| US12169465B2 (en) | Peripheral component interconnect express device and operating method thereof |
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 |