WO2017107816A1 - Method of processing data on virtualization platform and device - Google Patents

Method of processing data on virtualization platform and device Download PDF

Info

Publication number
WO2017107816A1
WO2017107816A1 PCT/CN2016/109747 CN2016109747W WO2017107816A1 WO 2017107816 A1 WO2017107816 A1 WO 2017107816A1 CN 2016109747 W CN2016109747 W CN 2016109747W WO 2017107816 A1 WO2017107816 A1 WO 2017107816A1
Authority
WO
WIPO (PCT)
Prior art keywords
mode
receiving thread
receiving
polling mode
polling
Prior art date
Application number
PCT/CN2016/109747
Other languages
French (fr)
Chinese (zh)
Inventor
张磊强
于洲
庄毓新
罗浩
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017107816A1 publication Critical patent/WO2017107816A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/301Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is a virtual computing platform, e.g. logically partitioned systems

Definitions

  • the front-end driver will apply for the memory space in advance, and place the memory address in the data request (English: request, referred to as: req) and place it on the IO ring.
  • the external data packet sent to the virtual machine (that is, the data packet sent to the DomU) first arrives at the physical network card (NIC) managed by the VMM, and the VMM sends an interrupt request to the Dom0 through the event channel. Dom0 will process this interrupt, encapsulate the corresponding data packet as a network socket packet cache (English: Socket Buffer, referred to as: skb), and place it in a skb queue (skb_list) through netback.
  • the front end driver generates a second data request to be placed in the shared memory between the front end driver and the back end driver of the Dom0;
  • the first notification unit when determining that the last read mode of the receiving thread needs to be in the non-polling mode, sending a mode for notifying the receiving thread to the front end driver of the DomU to change from the non-polling mode to Notification information for polling mode;
  • the processing unit is further configured to generate a second data request to be placed in a shared memory between the front end driver and the back end driver;
  • FIG. 6 is a schematic diagram of a data processing apparatus applied to a backend driving according to an embodiment of the present invention.
  • DomU's netfront pre-applies for memory space. This memory space is used to store packets destined for the DomU. For this memory space, where DomU can be accessed, and Dom0 can also be accessed.
  • the mode in which the receiving thread is located includes a polling mode and a non-polling mode.
  • the polling mode is used to identify that the receiving thread is in non-sleep mode.
  • the non-polling mode is used to identify that the receiving thread is in a sleep state when the skb queue is empty or when an I/O ring shared between the netfront of the DomU and the netback is full.
  • the non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the DomU and the backend driver is full.
  • a second notification unit 804 configured to: after the determining unit 801 determines that the skb queue is empty or determines that the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full, the reading unit 802 reads When the receiving thread needs to be in the non-polling mode and the determining unit 801 determines that the mode that the receiving thread needs to be in the polling mode last time, the sending to the front end driver is sent to notify the receiving thread. The mode is changed from polling mode to notification information in non-polling mode.

Abstract

A method of processing data on virtualization platform and device, resolving a problem of low performance of a frontend or a backend of a conventional network resulting from frequently waking up a netfront to receive a thread and frequently demounting a DomU. The method comprises: a netback of a Dom0 receives a first data packet transmitted over an event channel on a virtual machine monitor; and after processing the received first data packet and storing the same in a network socket packet buffering queue, if a mode of a thread received by the Dom0 is determined as a polling mode, the netback is not required to wake up the received thread, wherein the polling mode is used to indicate that the received thread is in a non-sleep mode.

Description

一种虚拟化平台中的数据处理方法及装置Data processing method and device in virtualization platform
本申请要求于2015年12月23日提交中国专利局、申请号为201510979888.2、发明名称为“一种虚拟化平台中的数据处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201510979888.2, entitled "Data Processing Method and Apparatus in a Virtualization Platform", filed on December 23, 2015, the entire contents of which are incorporated by reference. Combined in this application.
技术领域Technical field
本发明涉及通信技术领域,尤其涉及一种虚拟化平台中的数据处理方法及装置。The present invention relates to the field of communications technologies, and in particular, to a data processing method and apparatus in a virtualization platform.
背景技术Background technique
虚拟化技术是一种新型的计算模式,它支持在单一硬件平台上同时运行多个隔离的虚拟环境,通过将不同的服务部署在这些虚拟环境中,实现多个服务聚合在单一物理节点。Virtualization technology is a new computing model that supports running multiple isolated virtual environments on a single hardware platform. By deploying different services in these virtual environments, multiple services are aggregated on a single physical node.
以开放源代码虚拟化产品XEN为例,其包括一个虚拟机监控器(英文:Virtual Machine Monitor,简称:VMM)、一个特权虚拟机(Domain 0,简称:Dom0)和多个客户虚拟机(Domain U,简称:DomU)。Take the open source virtualization product XEN as an example. It includes a virtual machine monitor (English: Virtual Machine Monitor, VMM for short), a privileged virtual machine (Domain 0, Dom0 for short), and multiple guest virtual machines (Domain). U, referred to as: DomU).
VMM运行在客户虚拟机和硬件之间,Dom0与DomU都运行在VMM层之上。Dom0的特殊之处在于:其具有管理其他DomU的管理工具,以及与VMM通信的接口,从而达到对虚拟环境进行控制的目的。Dom0端还包括接收DomU硬件访问信息的接口,称为后端驱动(netback),后端驱动能够接收同一物理机上所有的DomU的硬件请求。DomU端还包括向Dom0发送硬件请求的接口,称为前端驱动(netfront)。The VMM runs between the guest virtual machine and the hardware, and both Dom0 and DomU run on top of the VMM layer. The special feature of Dom0 is that it has management tools for managing other DomUs and interfaces with VMMs to control the virtual environment. The Dom0 side also includes an interface for receiving DomU hardware access information, called a backend driver (netback), and the backend driver can receive hardware requests from all DomUs on the same physical machine. The DomU side also includes an interface to send hardware requests to Dom0, called front-end driver (netfront).
在Dom0与DomU之间存在一块固定的共享内存,即输入/输出端口(英文:input/output,简称:I/O)环,用于DomU与Dom0之间传递数据请求和响应。Dom0与DomU相互之间交互数据请求和响应需要通过设置于VMM上的事件通道(event channel),即Dom0与DomU相互之间交互数据请求和响应都会经过 Dom0<->VMM<->DomU。There is a fixed shared memory between Dom0 and DomU, that is, an input/output port (English: input/output, referred to as I/O) ring, which is used to transfer data requests and responses between DomU and Dom0. Dom0 and DomU exchange data requests and responses with each other through the event channel set on the VMM, that is, Dom0 and DomU exchange data requests and responses with each other. Dom0<->VMM<->DomU.
前端驱动会事先申请内存空间,将内存地址携带在数据请求(英文:request,简称:req)中放置到IO环上。发往虚拟机的外部数据包(即发往DomU的数据包)首先会到达由VMM管理的物理网卡(NIC),VMM会通过event channel方式发送一个中断请求到Dom0。Dom0会对此中断进行处理,封装相应的数据包为网络套接字包缓存(英文:Socket Buffer,简称:skb),并通过netback放置到一个skb队列中(skb_list)。The front-end driver will apply for the memory space in advance, and place the memory address in the data request (English: request, referred to as: req) and place it on the IO ring. The external data packet sent to the virtual machine (that is, the data packet sent to the DomU) first arrives at the physical network card (NIC) managed by the VMM, and the VMM sends an interrupt request to the Dom0 through the event channel. Dom0 will process this interrupt, encapsulate the corresponding data packet as a network socket packet cache (English: Socket Buffer, referred to as: skb), and place it in a skb queue (skb_list) through netback.
此后,运行于Dom0的一个独立的内核接收线程(vif-rx-qX)会从此skb队列中获取该数据包,并拷贝数据包中包括的数据到IO环上的数据请求(req)携带的内存地址对应的内存空间中,然后将拷贝数据对应的内存地址携带在数据响应中(英文:response,简称:rsp)放置到IO环上之前数据请求(req)所占用的位置,并通过event channel发送通知消息来通知DomU的netfront。netfront会从IO环上取出数据响应(rsp),获取数据响应对应的内存地址存储的数据包,并完成数据包的处理。然后,netfront会再次申请内存空间,携带内存空间的内存地址在数据请求(req)中并放置到IO环上,以供netback继续放置数据响应(req)。Thereafter, a separate kernel receive thread (vif-rx-qX) running on Dom0 will fetch the packet from the skb queue and copy the data included in the packet to the memory carried by the data request (req) on the IO ring. The memory space corresponding to the address, and then the memory address corresponding to the copy data is carried in the data response (English: response, referred to as: rsp) placed on the IO ring before the data request (req) occupied position, and sent through the event channel A notification message to inform DomU's netfront. Netfront will take the data response (rsp) from the IO ring, obtain the data packet stored in the corresponding memory address of the data response, and complete the processing of the data packet. Then, netfront will apply for the memory space again. The memory address carrying the memory space is placed in the data request (req) and placed on the IO ring for the netback to continue to place the data response (req).
需要注意的是,在此过程中,如果netfront处理速度较慢,导致IO环上被数据响应填满,导致接收线程无法生成新的数据响应放置到IO环,接收线程就会处于等待状态,即接收线程休眠,或者skb队列中没有数据时,接收线程也会休眠;接收线程休眠时即使skb队列中有数据时也不对数据做任何处理。因此,每次在有新数据包到达物理网卡并由Dom0处理放置到skb队列后,netback均会唤醒接收线程从而使得接收线程对skb队列中的数据进行处理。相应的,当DomU的netfront从IO环上读取并处理数据,并申请内存空间并生成新的数据请求放置到IO环上。由于netfront不确定接收线程是否处于休眠状态,因此netfront先需要通过event channel通知到Dom0来唤醒接收线程。而DomU的每次event channel操作,均会造成DomU的退出,而虚拟化环境下,DomU频繁的退出正是需要尽量避免的。后端驱动频繁唤醒接收线程以及DomU 频繁的退出均是造成现有网络前后端性能较低的一个重要因素。It should be noted that in this process, if the netfront processing speed is slow, the IO ring is filled with the data response, and the receiving thread cannot generate a new data response and put it into the IO ring, the receiving thread will be in a waiting state, that is, When the receiving thread sleeps, or there is no data in the skb queue, the receiving thread also sleeps; when the receiving thread sleeps, it does not process the data even if there is data in the skb queue. Therefore, each time a new packet arrives at the physical NIC and is placed by the Dom0 into the skb queue, the netback wakes up the receiving thread so that the receiving thread processes the data in the skb queue. Accordingly, when DomU's netfront reads and processes data from the IO ring, it applies for memory space and generates new data requests for placement on the IO ring. Since netfront is not sure whether the receiving thread is in a dormant state, netfront first needs to notify Dom0 through the event channel to wake up the receiving thread. DomU's every event channel operation will cause DomU to exit, and in the virtualized environment, DomU's frequent exit is exactly what needs to be avoided. Backend drivers frequently wake up the receiving thread and DomU Frequent exits are an important factor in the low performance of the front and back of existing networks.
发明内容Summary of the invention
本发明实施例提供一种虚拟化平台中的数据处理方法及装置,用于解决现有技术存在的后端驱动频繁唤醒接收线程以及DomU频繁的退出,从而造成现有网络前后端性能低下的问题。The embodiment of the invention provides a data processing method and device in a virtualization platform, which is used to solve the problem that the back-end driver frequently wakes up the receiving thread and the DomU frequently exits in the prior art, thereby causing low performance of the front and rear ends of the existing network. .
第一方面,本发明实施例提供了一种虚拟化平台中的数据处理方法,该方法包括:In a first aspect, an embodiment of the present invention provides a data processing method in a virtualization platform, where the method includes:
Dom0的后端驱动接收VMM发来的第一数据包;其中VMM通过VMM与后端驱动之间的事件通道向后端驱动发送第一数据包。The backend driver of the Dom0 receives the first data packet sent by the VMM; wherein the VMM sends the first data packet to the backend driver through an event channel between the VMM and the backend driver.
所述后端驱动将接收到的所述第一数据包处理后存储在skb队列后,在确定所述Dom0的接收线程所处的模式为轮询模式时,无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态。After the first-end data packet is processed and stored in the skb queue, the back-end driver does not need to wake up the receiving thread when determining that the mode in which the receiving thread of the Dom0 is in the polling mode. The polling mode is used to identify that the receiving thread is in a non-sleep state.
在现有技术中后端驱动不知道接收线程是否休眠,因此所述后端驱动将接收到的所述第一数据包处理后存储在skb队列之后,需要唤醒接收线程,但利用本发明实施例提供的方案,所述后端驱动在确定所述Dom0的接收线程所处的模式为轮询模式时,确定了接收线程目前处于非休眠状态,因此无需唤醒所述接收线程,从而避免了后端驱动频繁唤醒接收线程。In the prior art, the backend driver does not know whether the receiving thread is dormant. Therefore, the backend driver processes the received first data packet and stores it in the skb queue, and needs to wake up the receiving thread, but uses the embodiment of the present invention. The solution provides that when the mode in which the receiving thread of the Dom0 is determined to be in a polling mode, it is determined that the receiving thread is currently in a non-sleep state, so there is no need to wake up the receiving thread, thereby avoiding the back end. The driver frequently wakes up the receiving thread.
在其中一种可能的设计中,后端驱动确定所述接收线程所处的模式为轮询模式,可以通过如下方式实现:In one of the possible designs, the backend driver determines that the mode in which the receiving thread is located is a polling mode, which can be implemented as follows:
所述后端驱动在被允许读取所述接收线程所处的模式时,读取所述接收线程所处的模式为轮询模式;或者,The backend driver reads a mode in which the receiving thread is in a polling mode when being allowed to read a mode in which the receiving thread is located; or
所述后端驱动在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。The backend driver, when being prohibited from reading the mode in which the receiving thread is located, waits for a predetermined time and then attempts to read the mode in which the receiving thread is located until it is allowed and reads the receiving thread. The mode is in polling mode.
其中,所述接收线程所处的模式可以存储在所述后端驱动与所述接收线程之间的共享变量中。所述后端驱动尝试向所述共享内存读取所述接收线程所处 的模式时,在被允许时,读取到所述接收线程所处的模式。如果被禁止,则所述后端驱动等待预定时间后,再次尝试向所述共享内存读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式。The mode in which the receiving thread is located may be stored in a shared variable between the backend driver and the receiving thread. The backend driver attempts to read the receiving thread to the shared memory When the mode is enabled, the mode in which the receiving thread is located is read. If prohibited, the backend driver waits for a predetermined time and again attempts to read the mode in which the receiving thread is located to the shared memory until it is allowed and reads the mode in which the receiving thread is located.
由于所述接收线程可以被多个后端驱动使用。因此在其他后端驱动在对所述接收线程的所处的模式修改时,所述后端驱动被禁止读取所述接收线程所处的模式,因此,能够保证所述后端驱动不会读取到接收线程的错误模式而出现处理错误。Since the receiving thread can be used by multiple backend drivers. Therefore, when the other backend driver is in the mode modification of the receiving thread, the backend driver is prohibited from reading the mode in which the receiving thread is located, and therefore, the backend driver can be guaranteed not to read. A processing error occurred while fetching the error mode of the receiving thread.
在其中一种可能的设计中,所述后端驱动在确定所述Dom0的接收线程所处的模式为轮询模式之后,还包括:In one of the possible designs, after determining that the mode in which the receiving thread of the Dom0 is in the polling mode, the backend driver further includes:
在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When it is determined that the remaining memory space in the skb queue is not less than the second space threshold and determines that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is modified from the polling mode to In the non-polling mode, the non-polling mode is used to identify that the receiving thread is in the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full Sleep state.
上述设计中,在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值,也就是说skb队列中在这段时间内接收线程处理的数据包数量较小,因此可以将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,也就是在skb队列为空时允许接收线程休眠,从而能够使得接收线程不会长期处于工作状态而浪费资源。In the above design, after determining that the remaining memory space in the skb queue is not less than the second space threshold and determining that the receiving thread is in the polling mode, the time threshold is reached, that is, the skb queue receives the thread processing during this time. The number of data packets is small, so the mode in which the receiving thread is located can be modified from the polling mode to the non-polling mode, that is, the receiving thread is allowed to sleep when the skb queue is empty, thereby enabling the receiving thread to It will not waste resources when it is not working for a long time.
在其中一种可能的设计中,所述方法还可以包括:所述后端驱动接收VMM的事件通道发送的第二数据包;所述后端驱动将接收到的所述第二数据包处理后存储在skb队列中之后,在确定skb队列中的剩余内存空间小于第一空间阈值且确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态;所述后端驱动唤醒所述接收线程。In one possible design, the method may further include: the back end driving the second data packet sent by the event channel of the receiving VMM; the back end driving processing the received second data packet After being stored in the skb queue, when it is determined that the remaining memory space in the skb queue is smaller than the first space threshold and it is determined that the mode in which the receiving thread is in the non-polling mode, the mode in which the receiving thread is located is not round The polling mode is modified to a polling mode, and the non-polling mode is used to identify that the receiving thread is empty in the skb queue or the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full. While in a sleep state; the backend driver wakes up the receiving thread.
上述设计中,在确定skb队列中的剩余内存空间小于第二空间阈值且确定 接收线程处于所述非轮询模式,也就是说skb队列中在这段时间内接收线程处理的数据包数量较大,将所述接收线程所处的模式由所述非轮询模式修改为所述轮询模式,也就是强制在接收线程为轮询模式时不去休眠,从而使得后端驱动在知道接收线程为轮询模式时,不再需要唤醒接收线程,提高了后端的性能。In the above design, determining that the remaining memory space in the skb queue is smaller than the second space threshold and determining The receiving thread is in the non-polling mode, that is, the number of data packets processed by the receiving thread in the skb queue is large during the period, and the mode in which the receiving thread is located is modified from the non-polling mode to the The polling mode, that is, forcing the dormant when the receiving thread is in the polling mode, causes the backend driver to no longer need to wake up the receiving thread when it knows that the receiving thread is in the polling mode, improving the performance of the backend.
在其中一种可能的设计中,所述后端驱动在对所述接收线程所处的模式修改时,对所述接收线程所处的模式设置写锁,所述写锁用于禁止其他后端驱动以及所述接收线程读取所述接收线程所处的模式,并In one possible design, the backend driver sets a write lock on a mode in which the receiving thread is located when modifying a mode in which the receiving thread is located, the write lock is used to prohibit other backends. Driving and the receiving thread reading a mode in which the receiving thread is located, and
在对所述接收线程所处的模式修改完成后,解除所述写锁。After the mode modification of the receiving thread is completed, the write lock is released.
由于所述接收线程可以被多个后端驱动使用。因此在其他特权虚拟机的后端驱动对所述接收线程所处的模式进行修改时,可以对所述接收线程所处的模式设置写锁,所述写锁,用于禁止除所述对所述接收线程的模式进行修改的后端驱动以外的其他后端驱动以及所述接收线程读取所述接收线程所处的模式。那么在对所述接收线程所处的模式修改完成后,解除所述写锁。通过设置写锁可以保证在所述接收线程的模式被修改时,其他的后端驱动以及所述接收线程不会读取到错误的模式而出现错误。Since the receiving thread can be used by multiple backend drivers. Therefore, when the backend driver of the other privileged virtual machine modifies the mode in which the receiving thread is located, a write lock may be set to a mode in which the receiving thread is located, and the write lock is used to prohibit the Other backend drivers other than the backend driver that modify the mode of the receiving thread and the receiving thread read the mode in which the receiving thread is located. Then, after the mode modification of the receiving thread is completed, the write lock is released. By setting the write lock, it can be ensured that when the mode of the receiving thread is modified, other backend drivers and the receiving thread will not read the wrong mode and an error occurs.
第二方面,本发明实施例还提供了一种虚拟化平台中的数据处理方法,该方法包括:In a second aspect, the embodiment of the present invention further provides a data processing method in a virtualization platform, where the method includes:
Dom0的接收线程尝试对skb队列中的数据包进行处理时,确定skb队列为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存为满时,读取所述接收线程需处于的模式;When the receiving thread of the Dom0 attempts to process the data packet in the skb queue, it is determined that the skb queue is empty or it is determined that the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full, and the receiving thread is read. Mode to be in;
所述接收线程在读取到所述模式为轮询模式时,无需休眠;所述轮询模式用于标识接收线程处于非休眠状态。The receiving thread does not need to sleep when reading the mode to the polling mode; the polling mode is used to identify that the receiving thread is in a non-sleep state.
在现有技术中确定skb队列为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存为满,接收线程一定休眠,在本发明实施例提供的方案中,接收线程在确定模式为轮询模式时,不会去休眠,也就是接收线程在轮询模式时,无论是什么情况下均不会休眠。保证后端驱动和前端驱动在轮询模式时不去唤醒接收线程,提高了前后端驱动的接收性能。 In the prior art, it is determined that the skb queue is empty or that the shared memory between the front-end driver of the DomU and the back-end driver of the Dom0 is full, and the receiving thread must be dormant. In the solution provided by the embodiment of the present invention, the receiving thread is When the mode is determined to be polling mode, it will not go to sleep, that is, when the receiving thread is in polling mode, it will not sleep under any circumstances. Ensure that the back-end driver and front-end driver do not wake up the receiving thread in the polling mode, improving the receiving performance of the front and rear drivers.
在其中一种可能的设计中,所述接收线程在读取到所述模式为轮询模式后,还包括:In one of the possible designs, after the receiving thread reads the mode as the polling mode, the receiving thread further includes:
所述接收线程确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,所述接收线程向用户虚拟机DomU的前端驱动发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息;When the receiving thread determines that the mode in which the receiving thread that was last read needs to be in the non-polling mode, the receiving thread sends a mode for notifying the receiving thread to the front end driver of the user virtual machine DomU. The polling mode is changed to the notification information of the polling mode;
所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full.
在现有技术中,前端驱动在生成数据请求并放置在前端驱动与后端驱动之间的共享内存之后,都会尝试唤醒接收线程。而在本发明实施例中,由于接收线程,在确定自身所处的模式发生变化时,已经通知前端驱动所述接收线程是由非轮询模式变为轮询模式,因此,前端驱动可以将所述接收线程的模式存储下来。从而前端驱动生成第一数据请求放置在所述前端驱动与后端驱动之间的共享内存之后,读取自身存储的所述接收线程的模式,在确定读取到所述接收线程的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,提高了前后端驱动的接收性能。In the prior art, the front-end driver attempts to wake up the receiving thread after generating a data request and placing it in the shared memory between the front-end driver and the back-end driver. In the embodiment of the present invention, when the receiving thread determines that the mode in which it is located changes, the front end has been notified that the receiving thread is changed from the non-polling mode to the polling mode. Therefore, the front-end driver can The mode of the receiving thread is stored. Therefore, after the front-end driver generates the first data request and places the shared memory between the front-end driver and the back-end driver, reading the mode of the receiving thread stored by itself, determining that the mode of reading the receiving thread is a round In the inquiry mode, it is not necessary to send a wake-up request to the receiving thread of the Dom0, which improves the receiving performance of the front-end driver.
在其中一种可能的设计中,所述接收线程读取所述接收线程需处于的模式时,可以通过如下方式实现:In one of the possible designs, when the receiving thread reads the mode that the receiving thread needs to be in, it can be implemented as follows:
所述接收线程在被允许读取所述接收线程需处于的模式时,读取所述接收线程需处于的模式,或者,The receiving thread reads a mode in which the receiving thread needs to be in a mode that is allowed to read the receiving thread, or
所述接收线程在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When the receiving thread is prohibited from reading the mode that the receiving thread needs to be in, after waiting for a predetermined time, it tries again to read the mode that the receiving thread needs to be in, until it is allowed to read the receiving thread. mode.
通过上述方式能够避免接收线程读取错误的模式。In the above manner, it is possible to avoid the mode in which the receiving thread reads the error.
在其中一种可能的设计中,所述接收线程确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满之后,所述方法还可以包括:In one of the possible designs, the receiving thread determines that the skb queue is empty or determines that the shared memory between the front end driver of the user virtual machine DomU and the back end driver of the privileged virtual machine Dom0 is full, the method It can also include:
所述接收线程读取到所述接收线程需处于非轮询模式且确定上一次读取到 所述接收线程需处于的模式为轮询模式时,向所述前端驱动发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。The receiving thread reads that the receiving thread needs to be in a non-polling mode and determines that the last read is When the mode in which the receiving thread needs to be in the polling mode, the notification information for notifying that the mode of the receiving thread is changed from the polling mode to the non-polling mode is sent to the front end driver.
接收线程在读取到所述接收线程需处于非轮询模式且上一次读取到所述接收线程需处于的模式为轮询模式,也就是说接收线程在满足条件时要休眠,因此将该修改通知给前端驱动,从而使得前端驱动能够在得知接收线程为非轮询模式时唤醒接收线程。The receiving thread needs to be in the non-polling mode when reading the receiving thread and the mode in which the receiving thread is last read to be in the polling mode, that is, the receiving thread sleeps when the condition is met, so The notification is modified to the front-end driver so that the front-end driver can wake up the receiving thread when it knows that the receiving thread is in the non-polling mode.
第三方面,本发明实施例提供了一种虚拟化平台中的数据处理方法,该方法包括:In a third aspect, an embodiment of the present invention provides a data processing method in a virtualization platform, where the method includes:
DomU的前端驱动生成第一数据请求放置在所述前端驱动与Dom0的后端驱动之间的共享内存;The front end driver of the DomU generates a first data request to be placed in the shared memory between the front end driver and the back end driver of Dom0;
前端驱动确定Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,所述轮询模式用于标识接收线程处于非休眠状态。When the front-end driver determines that the mode in which the receiving thread of Dom0 is in the polling mode, it is not necessary to send a wake-up request to the receiving thread of the Dom0, and the polling mode is used to identify that the receiving thread is in a non-sleep state.
通过上述方式,前端驱动确定接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,从而能够避免domU的频繁退出造成的前后端接收性能低下。In the above manner, when the front-end driver determines that the mode in which the receiving thread is in the polling mode, it is not necessary to send a wake-up request to the receiving thread of the Dom0, so that the front-end receiving performance caused by the frequent exit of the domU can be avoided.
在其中一种可能的设计中,所述方法还可以包括:In one of the possible designs, the method may further include:
所述前端驱动生成第二数据请求放置在所述前端驱动与Dom0的后端驱动之间的共享内存;The front end driver generates a second data request to be placed in the shared memory between the front end driver and the back end driver of the Dom0;
所述前端驱动接收到所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息时,所述前端驱动向所述接收线程发送用于唤醒所述接收线程的唤醒请求,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When the front-end driver receives the notification information sent by the receiving thread for notifying that the mode of the receiving thread is changed from the polling mode to the non-polling mode, the front-end driver sends the receiving thread to the receiving thread for awakening. The waking request of the receiving thread, the non-polling mode is used to identify that the receiving thread is in a sleep state when the skb queue is empty or when the shared memory between the front end driver of the DomU and the backend driver is full .
前端驱动接收到所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息时,确定了所述接收线程的模式由轮询模式更改为非轮询模式,也就是接收线程此刻处于非轮询模式了,因此不能确定此刻所述接收线程是否休眠了,所述前端驱动需要向所述接收线程发送用于唤醒 所述接收线程的唤醒请求。When the front-end driver receives the notification information sent by the receiving thread to notify the receiving thread that the mode is changed from the polling mode to the non-polling mode, it is determined that the mode of the receiving thread is changed from the polling mode to the non-round mode. Inquiry mode, that is, the receiving thread is in the non-polling mode at the moment, so it cannot be determined whether the receiving thread is sleeping at the moment, and the front-end driver needs to send the receiving thread to wake up. The receiving thread wakes up the request.
第四方面,本发明实施例还提供了一种虚拟化平台中的数据处理装置,所述数据处理装置应用于Dom0的后端驱动,包括:In a fourth aspect, the embodiment of the present invention further provides a data processing device in a virtualization platform, where the data processing device is applied to a backend driver of the Dom0, including:
接收单元,用于接收VMM的事件通道发来的第一数据包;a receiving unit, configured to receive a first data packet sent by an event channel of the VMM;
处理单元,用于将所述接收单元接收到的所述第一数据包处理后存储在skb队列后,在确定所述Dom0的接收线程所处的模式为轮询模式时,无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态。a processing unit, configured to: after the first data packet received by the receiving unit is processed and stored in a skb queue, when determining that a mode in which the receiving thread of the Dom0 is in a polling mode, Thread, the polling mode is used to identify that the receiving thread is in a non-sleep state.
在一种可能的设计中,所述处理单元,在确定所述接收线程所处的模式为轮询模式具体用于:In a possible design, the processing unit determines that the mode in which the receiving thread is located is a polling mode specifically for:
所述后端驱动在被允许读取所述接收线程所处的模式时,读取所述接收线程所处的模式为轮询模式。The backend driver reads a mode in which the receiving thread is in a polling mode when being allowed to read a mode in which the receiving thread is located.
在其中一种可能的设计中,所述处理单元,在确定所述接收线程所处的模式为轮询模式时,具体用于:In one of the possible designs, the processing unit is specifically configured to: when determining that the mode in which the receiving thread is in the polling mode:
在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。When it is forbidden to read the mode in which the receiving thread is located, after waiting for a predetermined time, try again to read the mode in which the receiving thread is located until it is allowed and the mode in which the receiving thread is read is Polling mode.
在其中一种可能的设计中,所述处理单元在确定所述Dom0的接收线程所处的模式为轮询模式之后,还用于:In one of the possible designs, after determining that the mode in which the receiving thread of the Dom0 is in the polling mode, the processing unit is further configured to:
在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When it is determined that the remaining memory space in the skb queue is not less than the second space threshold and determines that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is modified from the polling mode to In the non-polling mode, the non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the DomU and the backend driver is full.
在其中一种可能的设计中,所述接收单元,还用于接收VMM的事件通道发送的第二数据包;In one possible design, the receiving unit is further configured to receive a second data packet sent by an event channel of the VMM;
所述处理单元,还用于将所述接收单元接收到的所述第二数据包处理后存储在skb队列中之后,在确定skb队列中的剩余内存空间小于第一空间阈值且 确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态;唤醒所述接收线程。The processing unit is further configured to: after the second data packet received by the receiving unit is processed and stored in the skb queue, determine that a remaining memory space in the skb queue is smaller than a first space threshold and Determining, when the mode in which the receiving thread is in the non-polling mode, modifying a mode in which the receiving thread is located from a non-polling mode to a polling mode, where the non-polling mode is used to identify that the receiving thread is The skb queue is empty or is in a sleep state when the shared memory between the front end driver of the DomU and the backend driver is full; the receiving thread is woken up.
在其中一种可能的设计中,所述处理单元,还用于在对所述接收线程所处的模式修改时,对所述接收线程所处的模式设置写锁,所述写锁用于禁止其他后端驱动以及所述接收线程读取所述接收线程所处的模式,并In one possible design, the processing unit is further configured to set a write lock on a mode in which the receiving thread is located when modifying a mode in which the receiving thread is located, where the write lock is used to prohibit Other backend drivers and the receiving thread read the mode in which the receiving thread is located, and
在对所述接收线程所处的模式修改完成后,解除所述写锁。After the mode modification of the receiving thread is completed, the write lock is released.
第五方面,本发明实施例还提供了一种虚拟化平台中的数据处理装置,所述数据处理装置应用于Dom0的接收线程,包括:In a fifth aspect, the embodiment of the present invention further provides a data processing device in a virtualization platform, where the data processing device is applied to a receiving thread of the Dom0, including:
确定单元,用于在尝试对skb队列中的数据包进行处理时,确定skb队列是否为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存是否为满;a determining unit, configured to determine whether the skb queue is empty or to determine whether the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full when attempting to process the data packet in the skb queue;
所述读取单元,在确定skb队列为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存为满时,读取所述接收线程需处于的模式;并在读取到所述模式为轮询模式时,所述接收线程无需休眠;所述轮询模式用于标识接收线程处于非休眠状态。The reading unit reads a mode that the receiving thread needs to be in when determining that the skb queue is empty or determines that the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full; and is reading When the mode is the polling mode, the receiving thread does not need to sleep; the polling mode is used to identify that the receiving thread is in a non-sleep state.
在其中一种可能的设计中,所述确定单元,还用于在所述读取单元读取到所述模式为轮询模式后,确定上一次读取到的所述接收线程需处于的模式;In a possible design, the determining unit is further configured to: after the reading unit reads that the mode is a polling mode, determine a mode that the receiving thread that is last read needs to be in ;
还包括:Also includes:
第一通知单元,在确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,向DomU的前端驱动发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息;The first notification unit, when determining that the last read mode of the receiving thread needs to be in the non-polling mode, sending a mode for notifying the receiving thread to the front end driver of the DomU to change from the non-polling mode to Notification information for polling mode;
所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The non-polling mode is configured to identify that the receiving thread is in a sleep state when the skb queue is empty or when the shared memory between the front end driver of the DomU and the backend driver is full.
在其中一种可能的设计中,所述读取单元,在读取所述接收线程需处于的模式,具体用于在被允许读取所述接收线程需处于的模式时,读取所述接收线 程需处于的模式。In one possible design, the reading unit reads a mode in which the receiving thread needs to be in, specifically for reading the receiving when it is allowed to read a mode in which the receiving thread needs to be in Line The mode that the process needs to be.
在其中一种可能的设计中,所述读取单元,在读取所述接收线程需处于的模式,具体用于:In one of the possible designs, the reading unit is in a mode in which the receiving thread needs to be read, specifically for:
在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When it is forbidden to read the mode that the receiving thread needs to be in, after waiting for a predetermined time, try again to read the mode that the receiving thread needs to be in until the mode in which the receiving thread needs to be read is allowed to be read.
在其中一种可能的设计中,还包括:Among one of the possible designs, it also includes:
第二通知单元,用于在所述确定单元确定skb队列为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存为满之后,所述读取单元读取到所述接收线程需处于非轮询模式且所述确定单元确定上一次读取到所述接收线程需处于的模式为轮询模式时,向所述前端驱动发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。a second notification unit, configured to: after the determining unit determines that the skb queue is empty or determines that the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full, the reading unit reads the The receiving thread needs to be in the non-polling mode and the determining unit determines that the mode in which the receiving thread needs to be in the polling mode last time is sent to the front end driver to send a mode for notifying the receiving thread The polling mode is changed to the notification information of the non-polling mode.
第六方面,本发明实施例还提供了一种虚拟化平台中的数据处理装置,所述数据处理装置应用于DomU的前端驱动,包括:In a sixth aspect, the embodiment of the present invention further provides a data processing device in a virtualization platform, where the data processing device is applied to a front end driver of the DomU, including:
处理单元,用于生成第一数据请求并放置在所述前端驱动与特权虚拟机Dom0的后端驱动之间的共享内存;a processing unit, configured to generate a first data request and place a shared memory between the front end driver and a backend driver of the privileged virtual machine Dom0;
发送单元,用于在所述处理单元确定Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,所述轮询模式用于标识接收线程处于非休眠状态。a sending unit, configured to: when the processing unit determines that a mode in which the receiving thread of the Dom0 is in a polling mode, does not need to send a wakeup request to the receiving thread of the Dom0, where the polling mode is used to identify that the receiving thread is in a non-sleeping state. status.
在其中一种可能的设计中,所述处理单元,还用于生成第二数据请求放置在所述前端驱动与所述后端驱动之间的共享内存;In one possible design, the processing unit is further configured to generate a second data request to be placed in a shared memory between the front end driver and the back end driver;
还包括:Also includes:
接收单元,用于接收所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息;a receiving unit, configured to receive, by the receiving thread, notification information for notifying that the mode of the receiving thread is changed from a polling mode to a non-polling mode;
所述发送单元,还用于在所述接收单元接收到所述通知信息时,向所述接收线程发送用于唤醒所述接收线程的唤醒请求,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共 享内存为满时处于休眠状态。The sending unit is further configured to: when the receiving unit receives the notification information, send a wakeup request for waking up the receiving thread to the receiving thread, where the non-polling mode is used to identify the receiving The thread is empty in the skb queue or is between the front end of the DomU and the backend driver When the memory is full, it is in a sleep state.
Dom0的后端驱动接收VMM的事件通道发来的第一数据包,现有技术中后端驱动不知道接收线程是否休眠,因此所述后端驱动将接收到的所述第一数据包处理后存储在网络套接字包缓存skb队列之中,需要唤醒接收线程,但利用本发明实施例提供的方案,所述后端驱动在确定所述Dom0的接收线程所处的模式为轮询模式时,确定了接收线程目前处于非休眠状态,因此无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态,从而避免了后端驱动频繁唤醒接收线程。The backend driver of the Dom0 receives the first data packet sent by the event channel of the VMM. In the prior art, the backend driver does not know whether the receiving thread is dormant, so the backend driver processes the received first data packet. Storing in the network socket packet cache skb queue, the receiving thread needs to be awake, but with the solution provided by the embodiment of the present invention, the backend driver determines that the mode of the receiving thread of the Dom0 is in the polling mode. It is determined that the receiving thread is currently in a non-sleep state, so there is no need to wake up the receiving thread, and the polling mode is used to identify that the receiving thread is in a non-sleep state, thereby avoiding that the backend driver frequently wakes up the receiving thread.
在DomU的前端驱动生成第一数据请求放置在所述前端驱动与Dom0的后端驱动之间的共享内存后,现有技术中DomU的前端驱动不知道接收线程此刻是否休眠,因此需要唤醒接收线程,利用本发明实施例提供的方案,确定Dom0的接收线程所处的模式为轮询模式时,确定了接收线程此刻处于非休眠状态,因此无需向所述Dom0的接收线程发送唤醒请求,从而避免了DomU频繁的退出。After the front end driver of the DomU generates the first data request and is placed in the shared memory between the front end driver and the back end driver of the Dom0, the front end driver of the DomU in the prior art does not know whether the receiving thread is hibernating at the moment, and therefore needs to wake up the receiving thread. When the mode in which the receiving thread of the Dom0 is in the polling mode is determined by using the solution provided by the embodiment of the present invention, it is determined that the receiving thread is in the non-sleep state at the moment, so there is no need to send a wakeup request to the receiving thread of the Dom0, thereby avoiding DomU has frequent exits.
附图说明DRAWINGS
图1为本发明实施例提供的虚拟化平台示意图;FIG. 1 is a schematic diagram of a virtualization platform according to an embodiment of the present invention;
图2为本发明实施例提供的虚拟化平台中的设备实现数据处理流程示意图;2 is a schematic diagram of a process for implementing data processing of a device in a virtualization platform according to an embodiment of the present invention;
图3为本发明实施例提供的netback进行数据处理的流程图;3 is a flowchart of data processing performed by a netback according to an embodiment of the present invention;
图4为本发明实施例提供的接收线程进行数据处理的流程图;4 is a flowchart of data processing performed by a receiving thread according to an embodiment of the present invention;
图5为本发明实施例提供的netfront进行数据处理的流程图;FIG. 5 is a flowchart of data processing performed by the netfront according to an embodiment of the present invention;
图6为本发明实施例提供的一种应用于后端驱动的数据处理装置示意图;FIG. 6 is a schematic diagram of a data processing apparatus applied to a backend driving according to an embodiment of the present invention;
图7为本发明实施例提供的另一种应用于后端驱动的数据处理装置示意图;FIG. 7 is a schematic diagram of another data processing apparatus applied to a backend driving according to an embodiment of the present invention;
图8为本发明实施例提供的一种应用于接收线程的数据处理装置示意图;FIG. 8 is a schematic diagram of a data processing apparatus applied to a receiving thread according to an embodiment of the present invention;
图9为本发明实施例提供的另一种应用于接收线程的数据处理装置示意图; FIG. 9 is a schematic diagram of another data processing apparatus applied to a receiving thread according to an embodiment of the present invention;
图10为本发明实施例提供的一种应用于前端驱动的数据处理装置示意图;FIG. 10 is a schematic diagram of a data processing apparatus applied to front end driving according to an embodiment of the present invention; FIG.
图11为本发明实施例提供的另一种应用于前端驱动的数据处理装置示意图。FIG. 11 is a schematic diagram of another data processing apparatus applied to front end driving according to an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。The present invention will be further described in detail with reference to the accompanying drawings, in which FIG. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例提供一种虚拟化平台中的数据处理方法及装置,用于解决现有技术存在的后端驱动频繁唤醒接收线程以及DomU频繁的退出,从而造成XEN下现有网络前后端性能低下的问题。其中,方法和装置是基于同一发明构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。The embodiment of the invention provides a data processing method and device in a virtualization platform, which is used to solve the problem that the back-end driver frequently wakes up the receiving thread and the DomU frequently exits in the prior art, thereby causing low performance of the existing network front and back end under XEN. The problem. The method and the device are based on the same inventive concept. Since the principles of the method and the device for solving the problem are similar, the implementation of the device and the method can be referred to each other, and the repeated description is not repeated.
本发明实施例应用于一种虚拟化平台,如图1所示,该虚拟化平台包括虚拟机监控器(英文:Virtual Machine Monitor,简称:VMM)、一个特权虚拟机(Domain 0,简称:Dom0)和多个客户虚拟机(Domain U,简称:DomU)。The embodiment of the present invention is applied to a virtualization platform. As shown in FIG. 1 , the virtualization platform includes a virtual machine monitor (English: Virtual Machine Monitor, VMM for short) and a privileged virtual machine (Domain 0, referred to as Dom0). ) and multiple guest virtual machines (Domain U, referred to as DomU).
VMM运行在客户虚拟机和硬件之间,Dom0与DomU都运行在VMM层之上。VMM用于管理物理网卡(NIC),发往DomU的数据包首先会到达NIC。The VMM runs between the guest virtual machine and the hardware, and both Dom0 and DomU run on top of the VMM layer. The VMM is used to manage physical network cards (NICs), and packets destined for DomU first arrive at the NIC.
Dom0的特殊之处在于:其具有管理其他DomU的管理工具,以及与VMM通信的接口,从而达到对虚拟环境进行控制的目的。Dom0端还包括接收DomU硬件访问信息的接口,称为后端驱动(netback),后端驱动能够接收同一物理机上所有的DomU的硬件请求。DomU端还包括向Dom0发送硬件请求的接口,称为前端驱动(netfront)。The special feature of Dom0 is that it has management tools for managing other DomUs and interfaces with VMMs to control the virtual environment. The Dom0 side also includes an interface for receiving DomU hardware access information, called a backend driver (netback), and the backend driver can receive hardware requests from all DomUs on the same physical machine. The DomU side also includes an interface to send hardware requests to Dom0, called front-end driver (netfront).
在Dom0与DomU之间存在一块固定的共享内存,即输入/输出端口(英文:input/output,简称:I/O)环,用于DomU与Dom0之间传递数据请求和数据响应。Dom0与DomU相互之间交互数据请求和数据响应需要通过设置于VMM上的 事件通道(event channel),即Dom0与DomU相互之间交互数据请求和数据响应都会经过Dom0<->VMM<->DomU。There is a fixed shared memory between Dom0 and DomU, that is, an input/output port (English: input/output, referred to as I/O) ring, which is used to transfer data requests and data responses between DomU and Dom0. Dom0 and DomU exchange data requests and data responses with each other through the settings on the VMM. The event channel, that is, Dom0 and DomU exchange data requests and data responses with each other through Dom0<->VMM<->DomU.
基于图1所示的虚拟化平台,虚拟化平台中的设备实现数据处理的流程如图2所示。Based on the virtualization platform shown in Figure 1, the flow of data processing implemented by devices in the virtualization platform is shown in Figure 2.
参见图3,为本发明实施例提供的应用于上述虚拟化平台的一种数据处理的方法流程。FIG. 3 is a flowchart of a method for processing data applied to the virtualization platform according to an embodiment of the present invention.
DomU的netfront预先申请内存空间。该内存空间用于存储发往该DomU的数据包。针对该内存空间,其中DomU可以访问,另外Dom0也可以访问。DomU's netfront pre-applies for memory space. This memory space is used to store packets destined for the DomU. For this memory space, where DomU can be accessed, and Dom0 can also be accessed.
DomU的netfront将申请的内存空间的内存地址携带在数据请求(req)中放置到I/O环上。例如图2中实线I/O环中所示的req1~req6。DomU's netfront carries the memory address of the requested memory space in the data request (req) and places it on the I/O ring. For example, req1 to req6 shown in the solid line I/O ring in FIG.
VMM确定NIC接收到发往DomU的第一数据包。VMM将所述第一数据包通过事件通道发送给Dom0的netback。The VMM determines that the NIC receives the first data packet destined for the DomU. The VMM sends the first data packet to the netback of Dom0 through the event channel.
其中,事件通道包括Dom0与VMM之间的以及DomU与VMM之间的。具体的,VMM将所述第一数据包通过Dom0与VMM之间的事件通道发送给Dom0的netback。The event channel includes between Dom0 and VMM and between DomU and VMM. Specifically, the VMM sends the first data packet to the netback of the Dom0 through an event channel between the Dom0 and the VMM.
下面具体描述netback的处理流程,如图3所示。The following describes the processing flow of netback in detail, as shown in Figure 3.
S301,Dom0的netback在接收到VMM发送的所述第一数据包后,对所述第一数据包处理后存储在skb队列。本发明实施例中以skb队列为skb_list为例,如图2所示。S301. After receiving the first data packet sent by the VMM, the netback of the Dom0 processes the first data packet and stores the first data packet in the skb queue. In the embodiment of the present invention, the skb queue is taken as an example of skb_list, as shown in FIG. 2 .
具体的,Dom0的netback将所述第一数据包进行封装,具体封装为skb的格式,然后放置到skb_list中。Specifically, the netback of the Dom0 encapsulates the first data packet, specifically encapsulated into a skb format, and then placed in the skb_list.
S302,netback确定所述Dom0的接收线程所处的模式为轮询模式,无需唤醒所述接收线程。S302. The netback determines that the mode in which the receiving thread of the Dom0 is located is a polling mode, and does not need to wake up the receiving thread.
其中接收线程所处的模式包括轮询模式和非轮询模式。轮询模式用于标识接收线程处于非休眠模式。所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的netfront与所述netback之间共享的I/O环为满时处于休眠状态。The mode in which the receiving thread is located includes a polling mode and a non-polling mode. The polling mode is used to identify that the receiving thread is in non-sleep mode. The non-polling mode is used to identify that the receiving thread is in a sleep state when the skb queue is empty or when an I/O ring shared between the netfront of the DomU and the netback is full.
在现有技术中netback不知道接收线程是否休眠,因此所述netback将接 收到的所述第一数据包处理后存储在skb队列之后,需要唤醒接收线程,但利用本发明实施例提供的方案,所述netback在确定所述Dom0的接收线程所处的模式为轮询模式时,确定了接收线程目前处于非休眠状态,因此无需唤醒所述接收线程,从而避免了netback频繁唤醒接收线程。In the prior art, netback does not know whether the receiving thread is dormant, so the netback will be connected. After the received first data packet is processed and stored in the skb queue, the receiving thread needs to be awake, but with the solution provided by the embodiment of the present invention, the netback determines that the mode of the receiving thread of the Dom0 is polling. In the mode, it is determined that the receiving thread is currently in a non-sleep state, so there is no need to wake up the receiving thread, thereby avoiding netback frequently waking up the receiving thread.
其中,可以设置接收线程一直处于轮询模式。则接收线程所处的模式一直处于轮询模式,不会更改到非轮询模式,这样能够保证接收线程一直不会休眠。但是这样接收线程一直处于工作状态,会造成浪费资源。因此可以设置接收线程所处的模式在满足某个条件下能够变为非轮询模式。Among them, you can set the receiving thread to be in polling mode. The mode in which the receiving thread is located is always in polling mode and does not change to non-polling mode, which ensures that the receiving thread will not sleep. But this way the receiving thread is always working, which will result in wasted resources. Therefore, it can be set that the mode in which the receiving thread is located can become a non-polling mode under certain conditions.
因此,可选的,netback确定所述Dom0的接收线程所处的模式为轮询模式之后,还可以包括:Therefore, optionally, after the netback determines that the mode in which the receiving thread of the Dom0 is in the polling mode, the method may further include:
netback在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式。When the netback determines that the remaining memory space in the skb queue is not less than the second space threshold and determines that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is modified from the polling mode to The non-polling mode.
在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值,也就是说skb队列中在这段时间内接收线程处理的数据包数量较小,因此可以将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,也就是在skb队列为空时允许接收线程休眠,从而能够使得接收线程不会长期处于工作状态而浪费资源。After determining that the remaining memory space in the skb queue is not less than the second space threshold and determining that the receiving thread is in the polling mode, the time threshold is reached, that is, the number of data packets processed by the receiving thread in the skb queue is shorter. Small, so the mode in which the receiving thread is located can be modified from the polling mode to the non-polling mode, that is, the receiving thread is allowed to sleep when the skb queue is empty, so that the receiving thread will not be in the long-term Work status and waste resources.
那么由于接收线程处于非轮询模式时,也就是现有技术中接收线程所处的状态,则接收线程在确定skb队列中的剩余内存空间为空或者在DomU的netfront与所述netback之间共享的I/O环为满时,会休眠,因此能够使得接收线程在没有数据需要处理时,或者所处理的数据无法放置到I/O环来使得netfront处理时,进行休眠,从而能够避免接收线程一直处于工作状态,造成的资源浪费。Then, since the receiving thread is in the non-polling mode, that is, the state in which the receiving thread is in the prior art, the receiving thread determines whether the remaining memory space in the skb queue is empty or is shared between the netfront of the DomU and the netback. When the I/O ring is full, it sleeps, so it can make the receiving thread sleep when there is no data to process, or when the processed data cannot be placed in the I/O ring to make the netfront processing, so that the receiving thread can be avoided. It has been working, and the resources caused are wasted.
其中,netback确定所述Dom0的接收线程所处的模式为轮询模式,具体包括:The netback determines that the mode in which the receiving thread of the Dom0 is located is a polling mode, and specifically includes:
所述netback在被允许读取所述接收线程所处的模式时,读取所述接收线 程所处的模式为轮询模式;或者,Reading the receiving line when the netback is allowed to read the mode in which the receiving thread is located The mode in which the process is located is the polling mode; or,
所述netback在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。The netback, after being prohibited from reading the mode in which the receiving thread is located, waits for a predetermined time and then attempts to read the mode in which the receiving thread is located until it is allowed and reads the receiving thread. The mode is polling mode.
由于所述接收线程可以被多个netback使用。因此在其他netback在对所述接收线程的所处的模式修改时,所述netback被禁止读取所述接收线程所处的模式,因此,能够保证所述netback不会读取到接收线程的错误模式而出现处理错误。另外,在其他特权虚拟机的netback对所述接收线程所处的模式进行修改时,可以对所述接收线程所处的模式设置写锁,所述写锁,用于禁止除所述对所述接收线程的模式进行修改的netback以外的其他netback以及所述接收线程读取所述接收线程所处的模式。那么在对所述接收线程所处的模式修改完成后,解除所述写锁,因此所述netback在被禁止读取所述接收线程所处的模式时,则等待预定时间后,可以再次尝试读取所述接收线程所处的模式。Since the receiving thread can be used by multiple netbacks. Therefore, when other netbacks modify the mode of the receiving thread, the netback is prohibited from reading the mode in which the receiving thread is located, and therefore, the netback can be guaranteed not to read the error of the receiving thread. A processing error occurred in the mode. In addition, when the netback of the other privileged virtual machine modifies the mode in which the receiving thread is located, a write lock may be set to a mode in which the receiving thread is located, and the write lock is used to prohibit the The netback other than the netback that receives the modified mode of the thread and the receiving thread read the mode in which the receiving thread is located. Then, after the mode modification of the receiving thread is completed, the write lock is released, so when the netback is prohibited from reading the mode in which the receiving thread is located, after waiting for a predetermined time, the netback may be tried again. Take the mode in which the receiving thread is located.
通过设置写锁可以保证在所述接收线程的模式被修改时,其他的netback以及所述接收线程不会读取到错误的模式而出现错误。By setting the write lock, it can be ensured that when the mode of the receiving thread is modified, other netbacks and the receiving thread will not read the wrong mode and an error occurs.
其中,netback和接收线程是属于同一个虚拟机操作系统内部的两个线程,接收线程模式可以存储在两个线程都可以读取的共享变量中。因此,netback对所述共享变量中存储的接收线程的模式修改时,在所述共享变量中对所述接收线程的模式设置写锁。The netback and the receiving thread are two threads belonging to the same virtual machine operating system, and the receiving thread mode can be stored in a shared variable that both threads can read. Therefore, when netback modifies the mode of the receiving thread stored in the shared variable, a write lock is set to the mode of the receiving thread in the shared variable.
可选地,所述方法还可以包括:所述netback接收VMM的事件通道发送的第二数据包;所述netback将接收到的所述第二数据包处理后存储在skb队列中之后,在确定skb队列中的剩余内存空间小于第一空间阈值且确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在netfront与所述netback之间的共享内存为满时处于休眠状态;所述netback唤醒所述接收线程。Optionally, the method may further include: the netback receives the second data packet sent by the event channel of the VMM; the netback processes the received second data packet after being processed in the skb queue, and determines When the remaining memory space in the skb queue is smaller than the first space threshold and determining that the mode in which the receiving thread is in the non-polling mode, the mode in which the receiving thread is located is changed from the non-polling mode to the polling mode. The non-polling mode is configured to identify that the receiving thread is in a sleep state when the skb queue is empty or when the shared memory between the netfront and the netback is full; the netback wakes up the receiving thread.
上述设计中,在确定skb队列中的剩余内存空间小于第二空间阈值且确定 接收线程处于所述非轮询模式,也就是说skb队列中在这段时间内接收线程处理的数据包数量较大,将所述接收线程所处的模式由所述非轮询模式修改为所述轮询模式,也就是强制在接收线程为轮询模式时不去休眠,从而使得netback在知道接收线程为轮询模式时,不再需要唤醒接收线程,提高了后端的性能。In the above design, determining that the remaining memory space in the skb queue is smaller than the second space threshold and determining The receiving thread is in the non-polling mode, that is, the number of data packets processed by the receiving thread in the skb queue is large during the period, and the mode in which the receiving thread is located is modified from the non-polling mode to the The polling mode, that is, forcing to do not sleep when the receiving thread is in the polling mode, causes the netback to no longer need to wake up the receiving thread when it knows that the receiving thread is in the polling mode, thereby improving the performance of the back end.
在netback进行上述处理后,接收线程会做如下处理,如图4所示。After the netback performs the above processing, the receiving thread performs the following processing, as shown in FIG.
S401,Dom0的接收线程尝试对skb队列中的数据包进行处理时,确定skb队列为空或者确定DomU的netfront与所述Dom0的netback之间的I/O环为满时,读取所述接收线程需处于的模式。S401. When the receiving thread of Dom0 attempts to process the data packet in the skb queue, determine that the skb queue is empty or determine that the I/O ring between the netfront of the DomU and the netback of the Dom0 is full, and read the receiving. The mode in which the thread needs to be.
首先在netback对接收线程的模式进行修改时,可以不设置写锁,也可以设置写锁。在不设置写锁时,接收线程在读取自身需处于的模式时,不需要确定是否被允许读取所述接收线程需处于的模式。若是设置写锁,接收线程在读取所述接收线程需处于的模式时,可以通过以下方式实现:First, when netback changes the mode of the receiving thread, you can set the write lock without setting the write lock. When the write lock is not set, the receiving thread does not need to determine whether it is allowed to read the mode in which the receiving thread needs to be in reading the mode that it is in. If the write lock is set, the receiving thread can realize the mode in which the receiving thread needs to be in the following manner:
所述接收线程在被允许读取所述接收线程需处于的模式时,读取所述接收线程需处于的模式;或者,The receiving thread reads a mode in which the receiving thread needs to be in a mode that is allowed to read the receiving thread; or
所述接收线程在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When the receiving thread is prohibited from reading the mode that the receiving thread needs to be in, after waiting for a predetermined time, it tries again to read the mode that the receiving thread needs to be in, until it is allowed to read the receiving thread. mode.
S402,所述接收线程在读取到所述模式为轮询模式时,无需休眠。S402. The receiving thread does not need to sleep when reading the mode to the polling mode.
所述轮询模式用于标识接收线程处于非休眠状态。The polling mode is used to identify that the receiving thread is in a non-sleep state.
在现有技术中确定skb队列为空或者确定用户虚拟机DomU的netfront与所述特权虚拟机Dom0的netback之间的共享内存为满,接收线程一定休眠,在本发明实施例提供的方案中,接收线程在确定模式为轮询模式时,不会去休眠,也就是接收线程在轮询模式时,无论是什么情况下均不会休眠。保证netback和netfront在轮询模式时不去唤醒接收线程,提高了前netback的接收性能。In the prior art, it is determined that the skb queue is empty or that the shared memory between the netfront of the user virtual machine DomU and the netback of the privileged virtual machine Dom0 is full, and the receiving thread must be dormant. In the solution provided by the embodiment of the present invention, When the receiving thread determines that the mode is polling mode, it does not go to sleep, that is, when the receiving thread is in polling mode, it will not sleep under any circumstances. Ensure that netback and netfront do not wake up the receiving thread when in polling mode, improving the receiving performance of the former netback.
若在skb队列为空的条件下,接收线程不进行休眠后,接收线程可以等待,每隔一段时间去尝试对skb队列中的数据包进行处理。If the receiving thread does not sleep after the skb queue is empty, the receiving thread can wait and try to process the data packets in the skb queue at regular intervals.
其中,在skb不为空并且确定DomU的netfront与所述Dom0的netback 之间的I/O环不为满,则接收线程肯定不会休眠。接收线程对skb队列中的数据包进行处理,读取一个数据包,并拷贝数据包中包括的数据到I/O环上的数据请求(req)携带的内存地址对应的内存空间中,然后将拷贝的数据对应的内存地址携带在数据响应中放置到IO环上之前数据请求(req)所占用的位置,并通过event channel发送通知消息来通知DomU的netfront有数据需要处理。从而netfront读取I/O环,对数据响应中携带的内存地址所存储的数据进行处理。Wherein, the skb is not empty and the netfront of the DomU is determined with the netback of the Dom0 If the I/O ring is not full, the receiving thread will definitely not sleep. The receiving thread processes the data packet in the skb queue, reads a data packet, and copies the data included in the data packet to the memory space corresponding to the memory address carried by the data request (req) on the I/O ring, and then The memory address corresponding to the copied data carries the location occupied by the data request (req) before being placed on the IO ring in the data response, and sends a notification message through the event channel to notify the DomU that the data needs to be processed. Thus netfront reads the I/O ring and processes the data stored in the memory address carried in the data response.
例如,这里以数据响应为rep1为例,则将图2实线I/O环中所示的rsq1替换为虚线I/O环中放置rep1。For example, here, taking the data response as rep1 as an example, replacing rsq1 shown in the solid line I/O ring of FIG. 2 with rep1 placed in the dotted I/O ring.
具体的,S401中接收线程可以尝试对skb队列中的数据包进行处理。那么首先确定skb队列是否为空或者确定DomU的netfront与所述Dom0的netback之间的I/O环是否为满。Specifically, the receiving thread in S401 may try to process the data packet in the skb queue. Then first determine if the skb queue is empty or determine if the I/O ring between the netfront of the DomU and the netback of the Dom0 is full.
若确定skb队列为空或者确定DomU的netfront与所述Dom0的netback之间的共享I/O环为满时,读取所述接收线程需要处于的模式,所述接收线程在读取到所述模式为轮询模式时,无需休眠。由于所述接收线程尝试对skb队列中的数据包进行处理,此刻所述接收线程肯定处于非休眠状态,因此无需休眠也就是接收线程保持非休眠状态。If it is determined that the skb queue is empty or it is determined that the shared I/O ring between the netfront of the DomU and the netback of the Dom0 is full, reading a mode in which the receiving thread needs to be in, the receiving thread reads the When the mode is polling mode, no hibernation is required. Since the receiving thread attempts to process the data packet in the skb queue, the receiving thread is definitely in a non-sleep state at this moment, so there is no need to sleep, that is, the receiving thread remains in a non-sleep state.
可选的,所述接收线程确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,所述接收线程向DomU的netfront发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息。Optionally, when the receiving thread determines that the mode that the receiving thread that was last read needs to be in a non-polling mode, the receiving thread sends a mode for notifying the receiving thread to the netfront of the DomU. The polling mode is changed to the notification information of the polling mode.
在现有技术中,netfront在生成数据请求并放置在netfront与netback之间的共享内存之后,都会尝试唤醒接收线程。而在本发明实施例中,由于接收线程,在确定自身所处的模式发生变化时,已经通知netfront所述接收线程是由非轮询模式变为轮询模式,因此,netfront可以将所述接收线程的模式存储下来。从而netfront生成第一数据请求放置在所述netfront与netback之间的共享内存之后,读取自身存储的所述接收线程的模式,在确定读取到所述接收线程的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,提 高了前netback的接收性能。In the prior art, netfront attempts to wake up the receiving thread after generating a data request and placing it in shared memory between netfront and netback. In the embodiment of the present invention, the receiving thread has notified the netfront that the receiving thread is changed from the non-polling mode to the polling mode due to the receiving thread, so that the netfront can receive the receiving. The mode of the thread is stored. Therefore, after the netfront generates the first data request and is placed in the shared memory between the netfront and the netback, reading the mode of the receiving thread stored by itself, when determining that the mode of reading the receiving thread is the polling mode, There is no need to send a wakeup request to the receiving thread of the Dom0, High before the netback reception performance.
可选的,所述接收线程确定skb队列为空或者确定DomU的netfront与所述Dom0的netback之间的I/O环为满之后,所述接收线程读取到所述接收线程需处于非轮询模式且确定上一次读取到所述接收线程需处于的模式为轮询模式时,向所述netfront发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。Optionally, after the receiving thread determines that the skb queue is empty or determines that the I/O ring between the netfront of the DomU and the netback of the Dom0 is full, the receiving thread reads that the receiving thread needs to be in a non-round Query mode and determine that the mode in which the receiving thread is in the polling mode last time is sent to the netfront to send notification information indicating that the mode of the receiving thread is changed from the polling mode to the non-polling mode. .
接收线程在读取到所述接收线程需处于非轮询模式且上一次读取到所述接收线程需处于的模式为轮询模式,也就是说接收线程在满足条件时要休眠,因此将该修改通知给netfront,从而使得netfront能够在得知接收线程为非轮询模式时唤醒接收线程。The receiving thread needs to be in the non-polling mode when reading the receiving thread and the mode in which the receiving thread is last read to be in the polling mode, that is, the receiving thread sleeps when the condition is met, so Modify the notification to netfront so that netfront can wake up the receiving thread when it knows that the receiving thread is in non-polling mode.
这里接收线程读取所述接收线程需处于的模式,可以从接收线程与netback之间的共享变量中读取。Here, the receiving thread reads the mode that the receiving thread needs to be in, and can read from the shared variable between the receiving thread and the netback.
其中,netfront与接收线程之间存储所述接收线程的模式可以通过Xenstore实现,Xenstore是一个位于Dom0的树状数据库,存储了所有正在运行的DomU的配置信息。因此可以在Xenstore中设置固定的键值来对应接收线程应该所处的模式。当接收线程从接收线程与netback之间的共享变量中读取到所述接收线程需处于的模式发生变化时,在Xenstore修改标识所述接收线程的键值。The mode of storing the receiving thread between the netfront and the receiving thread can be implemented by Xenstore, which is a tree database located in Dom0, and stores configuration information of all running DomUs. So you can set a fixed key value in Xenstore to correspond to the mode in which the receiving thread should be. When the receiving thread reads from the shared variable between the receiving thread and the netback that the mode in which the receiving thread needs to be changed, the key value of the receiving thread is modified in Xenstore.
同时Xenstore提供一种“watch”监听机制,即当所接收线程在Xenstore修改标识所述接收线程的模式的键值后,触发Xenstore向netfront发送通知信息,该通知信息用于通知所述接收线程的所处的模式发生了变化。具体通知netfront所述接收线程是由非轮询模式变为轮询模式,还是有轮询模式变为非轮询模式。At the same time, Xenstore provides a "watch" listening mechanism, that is, when the receiving thread modifies the key value of the mode of the receiving thread in Xenstore, Xenstore is triggered to send notification information to the netfront, the notification information is used to notify the receiving thread The pattern at the place has changed. Specifically, the netfront said receiving thread changes from a non-polling mode to a polling mode, or a polling mode to a non-polling mode.
在所述接收线程通过event channel发送通知消息来通知DomU的netfront有数据需要处理时,netfront读取I/O环,对数据响应中携带的内存地址所存储的数据进行处理。netfront处理一个数据响应后,则会再次申请内存空间,并将申请的内存空间的内存地址携带在数据请求(req)中放置到I/O环上。 When the receiving thread sends a notification message through the event channel to notify the DomU that the data needs to be processed, the netfront reads the I/O ring and processes the data stored in the memory address carried in the data response. After netfront processes a data response, it will apply for memory space again, and carry the memory address of the requested memory space in the data request (req) and place it on the I/O ring.
具体的,DomU的netfront进行如下处理,如图5所示。Specifically, the netfront of DomU is processed as follows, as shown in FIG. 5.
S501,DomU的netfront生成第一数据请求放置在所述netfront与Dom0的netback之间的I/O环。S501. The netfront of the DomU generates a first data request to place an I/O ring between the netfront and the netback of the Dom0.
S502,DomU的netfront确定Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求。S502. The netfront of the DomU determines that the mode in which the receiving thread of the Dom0 is in the polling mode, and does not need to send a wake-up request to the receiving thread of the Dom0.
所述轮询模式用于标识接收线程处于非休眠状态。The polling mode is used to identify that the receiving thread is in a non-sleep state.
由于接收线程,在确定自身所处的模式发生变化时,已经通知netfront所述接收线程是由非轮询模式变为轮询模式,还是有轮询模式变为非轮询模式。因此,netfront可以将所述接收线程的模式存储下来。从而netfront生成第一数据请求放置在所述netfront与netback之间的I/O环之后,读取自身存储的所述接收线程的模式,在确定读取到所述接收线程的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,从而能够避免domU的频繁退出造成的前后端接收性能低下。Due to the receiving thread, when it is determined that the mode in which it is located has changed, it has been notified to the netfront whether the receiving thread has changed from the non-polling mode to the polling mode or the polling mode has changed to the non-polling mode. Therefore, netfront can store the mode of the receiving thread. Therefore, after the netfront generates the first data request and places the I/O ring between the netfront and the netback, reading the mode of the receiving thread stored by itself, determining that the mode of reading the receiving thread is the polling mode At this time, it is not necessary to send a wake-up request to the receiving thread of the Dom0, so that the front-end receiving performance caused by the frequent exit of the domU can be avoided.
可选的,所述netfront生成第二数据请求放置在所述netfront与Dom0的netback之间的I/O环后,所述netfront接收到所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息时,所述netfront向所述接收线程发送用于唤醒所述接收线程的唤醒请求。Optionally, after the netfront generates a second data request and is placed in an I/O ring between the netfront and the netback of the Dom0, the netfront receives a mode sent by the receiving thread to notify the receiving thread. When the polling mode is changed to the notification information of the non-polling mode, the netfront sends a wakeup request for waking up the receiving thread to the receiving thread.
netfront接收到所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息时,确定了所述接收线程的模式由轮询模式更改为非轮询模式,也就是接收线程此刻处于非轮询模式了,因此不能确定此刻所述接收线程是否休眠了,所述netfront需要向所述接收线程发送用于唤醒所述接收线程的唤醒请求。When the netfront receives the notification information sent by the receiving thread to notify the receiving thread that the mode is changed from the polling mode to the non-polling mode, it is determined that the mode of the receiving thread is changed from the polling mode to the non-polling mode. The mode, that is, the receiving thread is now in the non-polling mode, and therefore cannot determine whether the receiving thread is hibernating at the moment, and the netfront needs to send a wake-up request for waking up the receiving thread to the receiving thread.
Dom0的netback接收虚拟机监控器VMM的事件通道发来的第一数据包,现有技术中netback不知道接收线程是否休眠,因此所述netback将接收到的所述第一数据包处理后存储在网络套接字包缓存skb队列之中,需要唤醒接收线程,但利用本发明实施例提供的方案,所述netback在确定所述Dom0的接收线程所处的模式为轮询模式时,确定了接收线程目前处于非休眠状态,因此无需 唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态,从而避免了netback频繁唤醒接收线程。The netback of the Dom0 receives the first data packet sent by the event channel of the virtual machine monitor VMM. In the prior art, the netback does not know whether the receiving thread is dormant, so the netback processes the received first data packet and stores it in the In the skb queue of the network socket cache, the receiving thread needs to be awake, but with the solution provided by the embodiment of the present invention, the netback determines the receiving when determining that the mode of the receiving thread of the Dom0 is in the polling mode. The thread is currently in a non-sleep state, so there is no need The receiving thread is woken up, and the polling mode is used to identify that the receiving thread is in a non-sleep state, thereby preventing the netback from frequently waking up the receiving thread.
在DomU的netfront生成第一数据请求放置在所述netfront与Dom0的netback之间的I/O环后,现有技术中DomU的netfront不知道接收线程此刻是否休眠,因此需要唤醒接收线程,利用本发明实施例提供的方案,确定Dom0的接收线程所处的模式为轮询模式时,确定了接收线程此刻处于非休眠状态,因此无需向所述Dom0的接收线程发送唤醒请求,从而避免了DomU频繁的退出。After the first data request of the DomU's netfront is placed in the I/O ring between the netfront and the netback of the Dom0, the netfront of the DomU in the prior art does not know whether the receiving thread is hibernating at the moment, and therefore needs to wake up the receiving thread, and utilize the present The solution provided by the embodiment of the present invention determines that the mode in which the receiving thread of the Dom0 is in the polling mode determines that the receiving thread is in the non-sleep state at the moment, and therefore does not need to send a wakeup request to the receiving thread of the Dom0, thereby avoiding frequent DomU. Exit.
基于与图3对应的方法实施例同样的发明构思,本发明实施例还提供了一种虚拟化平台中的数据处理装置,如图6所示,所述数据处理装置应用于特权虚拟机Dom0的后端驱动,该装置包括:Based on the same inventive concept as the method embodiment corresponding to FIG. 3, the embodiment of the present invention further provides a data processing apparatus in a virtualization platform. As shown in FIG. 6, the data processing apparatus is applied to a privileged virtual machine Dom0. Backend drive, the device includes:
接收单元601,用于接收VMM的事件通道发来的第一数据包;The receiving unit 601 is configured to receive a first data packet sent by an event channel of the VMM.
处理单元602,用于将所述接收单元601接收到的所述第一数据包处理后存储在skb队列后,在确定所述Dom0的接收线程所处的模式为轮询模式时,无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态。The processing unit 602 is configured to: after the first data packet received by the receiving unit 601 is processed and stored in the skb queue, when determining that the mode of the receiving thread of the Dom0 is in a polling mode, The receiving thread is configured to identify that the receiving thread is in a non-sleep state.
可选地,所述处理单元602,在确定所述接收线程所处的模式为轮询模式具体可以通过如下方式实现:Optionally, the processing unit 602, in determining that the mode in which the receiving thread is located, is a polling mode, which may be implemented by:
第一种实现方式:The first way to achieve:
在被允许读取所述接收线程所处的模式时,读取所述接收线程所处的模式为轮询模式。When the mode in which the receiving thread is allowed to be read is read, the mode in which the receiving thread is located is read as a polling mode.
第二种实现方式:The second way to achieve:
在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。When it is forbidden to read the mode in which the receiving thread is located, after waiting for a predetermined time, try again to read the mode in which the receiving thread is located until it is allowed and the mode in which the receiving thread is read is Polling mode.
可选地,所述处理单元602在确定所述Dom0的接收线程所处的模式为轮询模式之后,还用于:Optionally, after determining that the mode in which the receiving thread of the Dom0 is in the polling mode, the processing unit 602 is further configured to:
在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮 询模式修改为所述非轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When determining that the remaining memory space in the skb queue is not less than the second space threshold and determining that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is by the round The mode is modified to the non-polling mode, and the non-polling mode is used to identify that the receiving thread is empty in the skb queue or is shared between the front end driver of the user virtual machine DomU and the backend driver. When the memory is full, it is in a sleep state.
可选地,所述接收单元601,还用于接收VMM的事件通道发送的第二数据包;Optionally, the receiving unit 601 is further configured to receive a second data packet sent by an event channel of the VMM.
所述处理单元602,还用于将所述接收单元601接收到的所述第二数据包处理后存储在skb队列中之后,在确定skb队列中的剩余内存空间小于第一空间阈值且确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态;唤醒所述接收线程。The processing unit 602 is further configured to: after the second data packet received by the receiving unit 601 is processed and stored in the skb queue, determine that the remaining memory space in the skb queue is smaller than the first space threshold and determine the location When the mode in which the receiving thread is in the non-polling mode, the mode in which the receiving thread is located is modified from a non-polling mode to a polling mode, and the non-polling mode is used to identify the receiving thread in the The skb queue is empty or is in a sleep state when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full; the receiving thread is woken up.
可选地,所述处理单元602,还用于在对所述接收线程所处的模式修改时,对所述接收线程所处的模式设置写锁,所述写锁用于禁止其他后端驱动以及所述接收线程读取所述接收线程所处的模式,并在对所述接收线程所处的模式修改完成后,解除所述写锁。Optionally, the processing unit 602 is further configured to: when the mode of the receiving thread is modified, set a write lock on a mode in which the receiving thread is located, where the write lock is used to prohibit other backend drivers. And the receiving thread reads the mode in which the receiving thread is located, and releases the write lock after the mode modification of the receiving thread is completed.
本发明实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of the unit in the embodiment of the present invention is schematic, and is only a logical function division. In actual implementation, there may be another division manner. In addition, each functional unit in each embodiment of the present application may be integrated into one processing. In the device, it may be physically present alone, or two or more units may be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module.
其中,集成的单元既可以采用硬件的形式实现时,如图7所示,接收单元601对应的实体的硬件为通信接口701,处理单元602对应的实体硬件为处理器702。处理器702,可以是一个中央处理单元(英文:central processing unit,简称CPU),或者为数字处理单元等等。When the integrated unit is implemented in the form of hardware, as shown in FIG. 7 , the hardware of the entity corresponding to the receiving unit 601 is the communication interface 701 , and the physical hardware corresponding to the processing unit 602 is the processor 702 . The processor 702 can be a central processing unit (English: central processing unit, CPU for short), or a digital processing unit or the like.
其中,该数据处理装置还包括:存储器703,用于存储处理器702执行的程序。处理器702用于执行存储器703存储的程序,具体用于处理单元602以及接收单元601执行的方案。存储器703还可以用于存储skb队列。 The data processing apparatus further includes a memory 703 for storing a program executed by the processor 702. The processor 702 is configured to execute a program stored in the memory 703, specifically for the processing unit 602 and the scheme executed by the receiving unit 601. The memory 703 can also be used to store skb queues.
本发明实施例中不限定上述通信接口701、处理器702以及存储器703之间的具体连接介质。本发明实施例在图7中以存储器703、处理器702以及通信接口701之间通过总线704连接,总线在图7中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The specific connection medium between the communication interface 701, the processor 702, and the memory 703 is not limited in the embodiment of the present invention. In the embodiment of the present invention, the memory 703, the processor 702, and the communication interface 701 are connected by a bus 704 in FIG. 7. The bus is shown by a thick line in FIG. 7, and the connection manner between other components is only for illustrative description. , not limited to. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 7, but it does not mean that there is only one bus or one type of bus.
存储器703可以是易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以是非易失性存储器(英文:non-volatile memory),例如只读存储器(英文:read-only memory,缩写:ROM),快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD)、或者存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是上述存储器的组合。The memory 703 may be a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviation: RAM); the memory may also be a non-volatile memory (English: non-volatile memory). For example, read-only memory (English: read-only memory, abbreviation: ROM), flash memory (English: flash memory), hard disk (English: hard disk drive, abbreviation: HDD) or solid state drive (English: solid-state drive, Abbreviations: SSD), or memory, are any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory can be a combination of the above memories.
基于与图4所示的方法实施例同样的发明构思,本发明实施例还提供了一种虚拟化平台中的数据处理装置,所述数据处理装置应用于Dom0的接收线程,如图8所示,该数据处理装置包括:Based on the same inventive concept as the method embodiment shown in FIG. 4, the embodiment of the present invention further provides a data processing apparatus in a virtualization platform, where the data processing apparatus is applied to a receiving thread of Dom0, as shown in FIG. The data processing device includes:
确定单元801,用于在尝试对skb队列中的数据包进行处理时,确定skb队列是否为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存是否为满;a determining unit 801, configured to determine whether the skb queue is empty or to determine whether the shared memory between the front end driver of the DomU and the backend driver of the Dom0 is full when attempting to process the data packet in the skb queue;
所述读取单元802,在确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满时,读取所述接收线程需处于的模式;并在读取到所述模式为轮询模式时,所述接收线程无需休眠;所述轮询模式用于标识接收线程处于非休眠状态。The reading unit 802, when determining that the skb queue is empty or determining that the shared memory between the front-end driver of the user virtual machine DomU and the back-end driver of the privileged virtual machine Dom0 is full, reading the receiving thread needs to be in And the receiving thread does not need to sleep when reading the mode to the polling mode; the polling mode is used to identify that the receiving thread is in a non-sleep state.
可选地,所述确定单元801,还用于在所述读取单元802读取到所述模式为轮询模式后,确定上一次读取到的所述接收线程需处于的模式;Optionally, the determining unit 801 is further configured to: after the reading unit 802 reads that the mode is a polling mode, determine a mode that the receiving thread that is last read needs to be in;
还包括: Also includes:
第一通知单元803,在确定单元801确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,向用户虚拟机DomU的前端驱动发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息。The first notification unit 803, when the determining unit 801 determines that the mode in which the receiving thread that was last read is to be in the non-polling mode, sends a mode for notifying the receiving thread to the front end driver of the user virtual machine DomU. Notification information changed from non-polling mode to polling mode.
其中,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the DomU and the backend driver is full.
可选地,所述读取单元802,在读取所述接收线程需处于的模式,具体用于在被允许读取所述接收线程需处于的模式时,读取所述接收线程需处于的模式。Optionally, the reading unit 802 is configured to read a mode that the receiving thread needs to be in, specifically for reading, when the mode that the receiving thread needs to be read is read, mode.
可选地,所述读取单元802,在读取所述接收线程需处于的模式,具体用于:Optionally, the reading unit 802 is in a mode in which the receiving thread needs to be read, and is specifically configured to:
在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When it is forbidden to read the mode that the receiving thread needs to be in, after waiting for a predetermined time, try again to read the mode that the receiving thread needs to be in until the mode in which the receiving thread needs to be read is allowed to be read.
可选地,该数据处理装置还可以包括:Optionally, the data processing apparatus may further include:
第二通知单元804,用于在所述确定单元801确定skb队列为空或者确定DomU的前端驱动与所述Dom0的后端驱动之间的共享内存为满之后,所述读取单元802读取到所述接收线程需处于非轮询模式且所述确定单元801确定上一次读取到所述接收线程需处于的模式为轮询模式时,向所述前端驱动发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。a second notification unit 804, configured to: after the determining unit 801 determines that the skb queue is empty or determines that the shared memory between the front end driver of the DomU and the back end driver of the Dom0 is full, the reading unit 802 reads When the receiving thread needs to be in the non-polling mode and the determining unit 801 determines that the mode that the receiving thread needs to be in the polling mode last time, the sending to the front end driver is sent to notify the receiving thread. The mode is changed from polling mode to notification information in non-polling mode.
本发明实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of the unit in the embodiment of the present invention is schematic, and is only a logical function division. In actual implementation, there may be another division manner. In addition, each functional unit in each embodiment of the present application may be integrated into one processing. In the device, it may be physically present alone, or two or more units may be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module.
其中,集成的单元既可以采用硬件的形式实现时,如图9所示,第一通知单元803以及第二通知单元804对应的实体的硬件为通信接口901,确定单元801、读取单元802对应的实体硬件为处理器902。处理器902,可以是一个CPU, 或者为数字处理单元等等。When the integrated unit is implemented in the form of hardware, as shown in FIG. 9, the hardware of the entity corresponding to the first notification unit 803 and the second notification unit 804 is the communication interface 901, and the determining unit 801 and the reading unit 802 correspond to each other. The physical hardware is processor 902. The processor 902 can be a CPU. Or a digital processing unit or the like.
其中,该数据处理装置还包括:存储器903,用于存储处理器902执行的程序。处理器902用于执行存储器903存储的程序。The data processing apparatus further includes a memory 903 for storing a program executed by the processor 902. The processor 902 is configured to execute a program stored in the memory 903.
本发明实施例中不限定上述通信接口901、处理器902以及存储器903之间的具体连接介质。本发明实施例在图9中以存储器903、处理器902以及通信接口901之间通过总线904连接,总线在图9中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图9中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The specific connection medium between the communication interface 901, the processor 902, and the memory 903 is not limited in the embodiment of the present invention. In the embodiment of the present invention, the memory 903, the processor 902, and the communication interface 901 are connected by a bus 904 in FIG. 9. The bus is indicated by a thick line in FIG. 9, and the connection manner between other components is only schematically illustrated. , not limited to. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 9, but it does not mean that there is only one bus or one type of bus.
存储器903可以是volatile memory,例如RAM;存储器903也可以是非易失性存储器,例如ROM,flash memory,HDD或SSD、或者存储器903是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器903可以是上述存储器的组合。The memory 903 can be a volatile memory such as a RAM; the memory 903 can also be a non-volatile memory such as a ROM, flash memory, HDD or SSD, or the memory 903 can be used to carry or store a desired program in the form of an instruction or data structure. Code and any other medium that can be accessed by a computer, but is not limited thereto. The memory 903 may be a combination of the above memories.
基于与图5所示的方法实施例同样的发明构思,本发明实施例还提供了一种虚拟化平台中的数据处理装置,所述数据处理装置应用于DomU的前端驱动,如图10所示,该数据处理装置包括:Based on the same inventive concept as the method embodiment shown in FIG. 5, the embodiment of the present invention further provides a data processing device in a virtualization platform, where the data processing device is applied to a front end driver of the DomU, as shown in FIG. The data processing device includes:
处理单元1001,用于生成第一数据请求并放置在所述前端驱动与特权虚拟机Dom0的后端驱动之间的共享内存;The processing unit 1001 is configured to generate a first data request and place the shared memory between the front end driver and the back end driver of the privileged virtual machine Dom0;
发送单元1002,用于在所述处理单元1001确定特权虚拟机Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,所述轮询模式用于标识接收线程处于非休眠状态。The sending unit 1002 is configured to: when the processing unit 1001 determines that the mode in which the receiving thread of the privileged virtual machine Dom0 is in the polling mode, does not need to send a wakeup request to the receiving thread of the Dom0, where the polling mode is used to identify The receiving thread is in a non-sleep state.
可选地,所述处理单元1001,还用于生成第二数据请求放置在所述前端驱动与所述后端驱动之间的共享内存;Optionally, the processing unit 1001 is further configured to generate a second data request to be placed in the shared memory between the front end driver and the back end driver;
还包括:Also includes:
接收单元1003,用于接收所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息;The receiving unit 1003 is configured to receive, by the receiving thread, notification information for notifying that the mode of the receiving thread is changed from a polling mode to a non-polling mode;
所述发送单元1002,还用于在所述接收单元1003接收到所述通知信息时, 向所述接收线程发送用于唤醒所述接收线程的唤醒请求,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The sending unit 1002 is further configured to: when the receiving unit 1003 receives the notification information, Sending, to the receiving thread, a wakeup request for waking up the receiving thread, where the non-polling mode is used to identify that the receiving thread is empty in the skb queue or is driven on the front end of the user virtual machine DomU The shared memory between the end drives is in a sleep state when full.
本发明实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of the unit in the embodiment of the present invention is schematic, and is only a logical function division. In actual implementation, there may be another division manner. In addition, each functional unit in each embodiment of the present application may be integrated into one processing. In the device, it may be physically present alone, or two or more units may be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software function module.
其中,集成的单元既可以采用硬件的形式实现时,如图11所示,接收单元1003以及发送单元1002对应的实体的硬件为通信接口1101,处理单元1001、对应的实体硬件为处理器1102。处理器1102,可以是一个CPU,或者为数字处理单元等等。When the integrated unit is implemented in the form of hardware, as shown in FIG. 11, the hardware of the entity corresponding to the receiving unit 1003 and the sending unit 1002 is the communication interface 1101, and the processing unit 1001 is the processor 1102. The processor 1102 can be a CPU, or a digital processing unit or the like.
其中,该数据处理装置还包括:存储器1103,用于存储处理器1102执行的程序。处理器1102用于执行存储器1103存储的程序。The data processing apparatus further includes a memory 1103 for storing a program executed by the processor 1102. The processor 1102 is configured to execute a program stored in the memory 1103.
本发明实施例中不限定上述通信接口1101、处理器1102以及存储器1103之间的具体连接介质。本发明实施例在图11中以存储器1103、处理器1102以及通信接口1101之间通过总线1104连接,总线在图11中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The specific connection medium between the communication interface 1101, the processor 1102, and the memory 1103 is not limited in the embodiment of the present invention. In the embodiment of the present invention, the memory 1103, the processor 1102, and the communication interface 1101 are connected by a bus 1104 in FIG. 11, and the bus is indicated by a thick line in FIG. 11, and the connection manner between other components is only schematically illustrated. , not limited to. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 11, but it does not mean that there is only one bus or one type of bus.
存储器1103可以是volatile memory,例如RAM;存储器1103也可以是非易失性存储器,例如ROM,flash memory,HDD或SSD、或者存储器1103是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器1103可以是上述存储器的组合。The memory 1103 can be a volatile memory, such as a RAM; the memory 1103 can also be a non-volatile memory, such as a ROM, flash memory, HDD or SSD, or the memory 1103 can be used to carry or store a desired program in the form of an instruction or data structure. Code and any other medium that can be accessed by a computer, but is not limited thereto. The memory 1103 may be a combination of the above memories.
其中,本发明实施例中处理器702、处理器902、处理器1102可以为同一个处理器,也可以为不同的处理器。存储器703、存储器903、存储器1103可以为同一个存储器,也可以为不同的存储器,用于保存skb队列,以及共享内 存以及xenstore等等。The processor 702, the processor 902, and the processor 1102 in the embodiment of the present invention may be the same processor or different processors. The memory 703, the memory 903, and the memory 1103 may be the same memory or different memories for storing the skb queue and the shared memory. Save as well as xenstore and so on.
Dom0的后端驱动接收VMM的事件通道发来的第一数据包,现有技术中后端驱动不知道接收线程是否休眠,因此所述后端驱动将接收到的所述第一数据包处理后存储在网络套接字包缓存skb队列之中,需要唤醒接收线程,但利用本发明实施例提供的方案,所述后端驱动在确定所述Dom0的接收线程所处的模式为轮询模式时,确定了接收线程目前处于非休眠状态,因此无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态,从而避免了后端驱动频繁唤醒接收线程。The backend driver of the Dom0 receives the first data packet sent by the event channel of the VMM. In the prior art, the backend driver does not know whether the receiving thread is dormant, so the backend driver processes the received first data packet. Storing in the network socket packet cache skb queue, the receiving thread needs to be awake, but with the solution provided by the embodiment of the present invention, the backend driver determines that the mode of the receiving thread of the Dom0 is in the polling mode. It is determined that the receiving thread is currently in a non-sleep state, so there is no need to wake up the receiving thread, and the polling mode is used to identify that the receiving thread is in a non-sleep state, thereby avoiding that the backend driver frequently wakes up the receiving thread.
在DomU的前端驱动生成第一数据请求放置在所述前端驱动与Dom0的后端驱动之间的共享内存后,现有技术中DomU的前端驱动不知道接收线程此刻是否休眠,因此需要唤醒接收线程,利用本发明实施例提供的方案,确定Dom0的接收线程所处的模式为轮询模式时,确定了接收线程此刻处于非休眠状态,因此无需向所述Dom0的接收线程发送唤醒请求,从而避免了DomU频繁的退出。After the front end driver of the DomU generates the first data request and is placed in the shared memory between the front end driver and the back end driver of the Dom0, the front end driver of the DomU in the prior art does not know whether the receiving thread is hibernating at the moment, and therefore needs to wake up the receiving thread. When the mode in which the receiving thread of the Dom0 is in the polling mode is determined by using the solution provided by the embodiment of the present invention, it is determined that the receiving thread is in the non-sleep state at the moment, so there is no need to send a wakeup request to the receiving thread of the Dom0, thereby avoiding DomU has frequent exits.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的 指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that it is stored in the computer readable memory. The instructions produce an article of manufacture including an instruction device that implements the functions specified in one or more blocks of the flowchart or in a flow or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While the preferred embodiment of the invention has been described, it will be understood that Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and the modifications and
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and modifications of the invention

Claims (26)

  1. 一种虚拟化平台中的数据处理方法,其特征在于,包括:A data processing method in a virtualization platform, comprising:
    特权虚拟机Dom0的后端驱动接收虚拟机监控器VMM的事件通道发来的第一数据包;The backend driver of the privileged virtual machine Dom0 receives the first data packet sent by the event channel of the virtual machine monitor VMM;
    所述后端驱动将接收到的所述第一数据包处理后存储在网络套接字包缓存skb队列后,在确定所述Dom0的接收线程所处的模式为轮询模式时,无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态。The backend driver stores the received first data packet and stores it in the network socket packet cache skb queue, and does not need to wake up when determining that the mode of the Dom0 receiving thread is in the polling mode. The receiving thread is configured to identify that the receiving thread is in a non-sleep state.
  2. 如权利要求1所述的方法,其特征在于,所述后端驱动确定所述接收线程所处的模式为轮询模式,包括:The method of claim 1, wherein the backend driver determines that the mode in which the receiving thread is located is a polling mode, including:
    所述后端驱动在被允许读取所述接收线程所处的模式时,读取所述接收线程所处的模式为轮询模式。The backend driver reads a mode in which the receiving thread is in a polling mode when being allowed to read a mode in which the receiving thread is located.
  3. 如权利要求1所述的方法,其特征在于,所述后端驱动确定所述接收线程所处的模式为轮询模式,包括:The method of claim 1, wherein the backend driver determines that the mode in which the receiving thread is located is a polling mode, including:
    所述后端驱动在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。The backend driver, when being prohibited from reading the mode in which the receiving thread is located, waits for a predetermined time and then attempts to read the mode in which the receiving thread is located until it is allowed and reads the receiving thread. The mode is in polling mode.
  4. 如权利要求1至3任一项所述的方法,其特征在于,所述后端驱动在确定所述Dom0的接收线程所处的模式为轮询模式之后,还包括:The method according to any one of claims 1 to 3, wherein the backend driver further comprises: after determining that the mode in which the receiving thread of the Dom0 is in the polling mode, further comprising:
    在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When it is determined that the remaining memory space in the skb queue is not less than the second space threshold and determines that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is modified from the polling mode to In the non-polling mode, the non-polling mode is used to identify that the receiving thread is in the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full Sleep state.
  5. 如权利要求1所述的方法,其特征在于,还包括:The method of claim 1 further comprising:
    所述后端驱动接收VMM的事件通道发送的第二数据包;The back end driver receives a second data packet sent by an event channel of the VMM;
    所述后端驱动将接收到的所述第二数据包处理后存储在skb队列中之后, 在确定skb队列中的剩余内存空间小于第一空间阈值且确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态;After the backend driver processes the received second data packet and stores it in the skb queue, When it is determined that the remaining memory space in the skb queue is smaller than the first space threshold and determining that the mode in which the receiving thread is in the non-polling mode, the mode in which the receiving thread is located is changed from the non-polling mode to the polling mode. The non-polling mode is configured to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full;
    所述后端驱动唤醒所述接收线程。The backend driver wakes up the receiving thread.
  6. 如权利要求4或5所述的方法,其特征在于,还包括:The method of claim 4 or 5, further comprising:
    所述后端驱动在对所述接收线程所处的模式修改时,对所述接收线程所处的模式设置写锁,所述写锁用于禁止其他后端驱动以及所述接收线程读取所述接收线程所处的模式,并The backend driver sets a write lock on a mode in which the receiving thread is located when modifying a mode in which the receiving thread is located, the write lock is used to prohibit other backend drivers and the receiving thread from reading State the mode in which the receiving thread is located, and
    在对所述接收线程所处的模式修改完成后,解除所述写锁。After the mode modification of the receiving thread is completed, the write lock is released.
  7. 一种虚拟化平台中的数据处理方法,其特征在于,包括:A data processing method in a virtualization platform, comprising:
    特权虚拟机Dom0的接收线程尝试对网络套接字包缓存skb队列中的数据包进行处理时,确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满时,读取所述接收线程需处于的模式;When the receiving thread of the privileged virtual machine Dom0 attempts to process the data packet in the skb queue of the network socket packet cache, it is determined that the skb queue is empty or the front end driver of the user virtual machine DomU and the back end driver of the privileged virtual machine Dom0 are determined. When the shared memory is full, the mode in which the receiving thread needs to be read is read;
    所述接收线程在读取到所述模式为轮询模式时,无需休眠;所述轮询模式用于标识接收线程处于非休眠状态。The receiving thread does not need to sleep when reading the mode to the polling mode; the polling mode is used to identify that the receiving thread is in a non-sleep state.
  8. 如权利要求7所述的方法,其特征在于,所述接收线程在读取到所述模式为轮询模式后,还包括:The method of claim 7, wherein the receiving thread, after reading the mode to the polling mode, further comprises:
    所述接收线程确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,所述接收线程向用户虚拟机DomU的前端驱动发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息;When the receiving thread determines that the mode in which the receiving thread that was last read needs to be in the non-polling mode, the receiving thread sends a mode for notifying the receiving thread to the front end driver of the user virtual machine DomU. The polling mode is changed to the notification information of the polling mode;
    所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full.
  9. 如权利要求7或8所述的方法,其特征在于,所述接收线程读取所述接收线程需处于的模式,包括:The method according to claim 7 or 8, wherein the receiving thread reads a mode that the receiving thread needs to be in, including:
    所述接收线程在被允许读取所述接收线程需处于的模式时,读取所述接收 线程需处于的模式。The receiving thread reads the receiving when it is allowed to read a mode in which the receiving thread needs to be in The mode in which the thread needs to be.
  10. 如权利要求7或8所述的方法,其特征在于,所述接收线程读取所述接收线程需处于的模式,包括:The method according to claim 7 or 8, wherein the receiving thread reads a mode that the receiving thread needs to be in, including:
    所述接收线程在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When the receiving thread is prohibited from reading the mode that the receiving thread needs to be in, after waiting for a predetermined time, it tries again to read the mode that the receiving thread needs to be in, until it is allowed to read the receiving thread. mode.
  11. 如权利要求7至10任一项所述的方法,其特征在于,所述接收线程确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满之后,还包括:The method according to any one of claims 7 to 10, wherein the receiving thread determines that the skb queue is empty or determines between the front end driver of the user virtual machine DomU and the back end driver of the privileged virtual machine Dom0. After the shared memory is full, it also includes:
    所述接收线程读取到所述接收线程需处于非轮询模式且确定上一次读取到所述接收线程需处于的模式为轮询模式时,向所述前端驱动发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。The receiving thread reads, when the receiving thread needs to be in the non-polling mode, and determines that the mode that the receiving thread needs to be in the polling mode last time, sends the notification to the front end driver to notify the receiving The mode of the thread is changed from polling mode to notification information in non-polling mode.
  12. 一种虚拟化平台中的数据处理方法,其特征在于,包括:A data processing method in a virtualization platform, comprising:
    用户虚拟机DomU的前端驱动生成第一数据请求放置在所述前端驱动与特权虚拟机Dom0的后端驱动之间的共享内存;The front end driver of the user virtual machine DomU generates a first data request to be placed in the shared memory between the front end driver and the back end driver of the privileged virtual machine Dom0;
    用户虚拟机DomU的前端驱动确定特权虚拟机Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,所述轮询模式用于标识接收线程处于非休眠状态。When the front-end driver of the user virtual machine DomU determines that the mode in which the receiving thread of the privileged virtual machine Dom0 is in the polling mode, there is no need to send a wake-up request to the receiving thread of the Dom0, and the polling mode is used to identify that the receiving thread is not sleeping. status.
  13. 如权利要求12所述的方法,其特征在于,还包括:The method of claim 12, further comprising:
    所述前端驱动生成第二数据请求放置在所述前端驱动与特权虚拟机Dom0的后端驱动之间的共享内存;The front end driver generates a second data request to be placed in a shared memory between the front end driver and a back end drive of the privileged virtual machine Dom0;
    所述前端驱动接收到所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息时,所述前端驱动向所述接收线程发送用于唤醒所述接收线程的唤醒请求,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When the front-end driver receives the notification information sent by the receiving thread for notifying that the mode of the receiving thread is changed from the polling mode to the non-polling mode, the front-end driver sends the receiving thread to the receiving thread for awakening. The wake-up request of the receiving thread, the non-polling mode is used to identify that the receiving thread is empty when the skb queue is empty or when the shared memory between the front-end driver of the user virtual machine DomU and the backend driver is full Is in a dormant state.
  14. 一种虚拟化平台中的数据处理装置,其特征在于,所述数据处理装置 应用于特权虚拟机Dom0的后端驱动,包括:A data processing device in a virtualization platform, characterized in that the data processing device The backend driver applied to the privileged virtual machine Dom0, including:
    接收单元,用于接收虚拟机监控器VMM的事件通道发来的第一数据包;a receiving unit, configured to receive a first data packet sent by an event channel of the virtual machine monitor VMM;
    处理单元,用于将所述接收单元接收到的所述第一数据包处理后存储在网络套接字包缓存skb队列后,在确定所述Dom0的接收线程所处的模式为轮询模式时,无需唤醒所述接收线程,所述轮询模式用于标识接收线程处于非休眠状态。a processing unit, configured to: after the first data packet received by the receiving unit is processed and stored in a network socket buffer skb queue, when determining that the mode of receiving the Dom0 is in a polling mode There is no need to wake up the receiving thread, and the polling mode is used to identify that the receiving thread is in a non-sleep state.
  15. 如权利要求14所述的装置,其特征在于,所述处理单元,在确定所述接收线程所处的模式为轮询模式具体用于:The apparatus according to claim 14, wherein the processing unit determines that the mode in which the receiving thread is located is a polling mode, specifically for:
    在被允许读取所述接收线程所处的模式时,读取所述接收线程所处的模式为轮询模式。When the mode in which the receiving thread is allowed to be read is read, the mode in which the receiving thread is located is read as a polling mode.
  16. 如权利要求14所述的装置,其特征在于,所述处理单元,在确定所述接收线程所处的模式为轮询模式时,具体用于:The device according to claim 14, wherein the processing unit is configured to: when determining that the mode in which the receiving thread is in the polling mode:
    在被禁止读取所述接收线程所处的模式时,则等待预定时间后,再次尝试读取所述接收线程所处的模式,直到被允许且读取到所述接收线程所处的模式为轮询模式。When it is forbidden to read the mode in which the receiving thread is located, after waiting for a predetermined time, try again to read the mode in which the receiving thread is located until it is allowed and the mode in which the receiving thread is read is Polling mode.
  17. 如权利要求14至16任一项所述的装置,其特征在于,所述处理单元在确定所述Dom0的接收线程所处的模式为轮询模式之后,还用于:The device according to any one of claims 14 to 16, wherein the processing unit is further configured to: after determining that the mode in which the receiving thread of the Dom0 is in the polling mode:
    在确定skb队列中的剩余内存空间不小于第二空间阈值且确定接收线程处于所述轮询模式的时间达到时间阈值时,将所述接收线程所处的模式由所述轮询模式修改为所述非轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。When it is determined that the remaining memory space in the skb queue is not less than the second space threshold and determines that the time when the receiving thread is in the polling mode reaches a time threshold, the mode in which the receiving thread is located is modified from the polling mode to In the non-polling mode, the non-polling mode is used to identify that the receiving thread is in the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full Sleep state.
  18. 如权利要求14所述的装置,其特征在于,所述接收单元,还用于接收VMM的事件通道发送的第二数据包;The apparatus according to claim 14, wherein the receiving unit is further configured to receive a second data packet sent by an event channel of the VMM;
    所述处理单元,还用于将所述接收单元接收到的所述第二数据包处理后存储在skb队列中之后,在确定skb队列中的剩余内存空间小于第一空间阈值且确定所述接收线程所处的模式为非轮询模式时,将所述接收线程所处的模式由 非轮询模式修改为轮询模式,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态;唤醒所述接收线程。The processing unit is further configured to: after the second data packet received by the receiving unit is processed and stored in the skb queue, determine that the remaining memory space in the skb queue is smaller than the first space threshold and determine the receiving When the mode in which the thread is in the non-polling mode, the mode in which the receiving thread is located is The non-polling mode is modified to a polling mode, and the non-polling mode is used to identify that the receiving thread is empty in the skb queue or shared memory between the front end of the user virtual machine DomU and the backend driver. Is in a sleep state when full; wakes up the receiving thread.
  19. 如权利要求17或18所述的装置,其特征在于,所述处理单元,还用于在对所述接收线程所处的模式修改时,对所述接收线程所处的模式设置写锁,所述写锁用于禁止其他后端驱动以及所述接收线程读取所述接收线程所处的模式,并The device according to claim 17 or 18, wherein the processing unit is further configured to set a write lock on a mode in which the receiving thread is located when modifying a mode in which the receiving thread is located. The write lock is used to disable other backend drivers and the receiving thread reads the mode in which the receiving thread is located, and
    在对所述接收线程所处的模式修改完成后,解除所述写锁。After the mode modification of the receiving thread is completed, the write lock is released.
  20. 一种虚拟化平台中的数据处理装置,其特征在于,所述数据处理装置应用于特权虚拟机Dom0的接收线程,包括:A data processing device in a virtualization platform, wherein the data processing device is applied to a receiving thread of the privileged virtual machine Dom0, including:
    确定单元,用于在尝试对网络套接字包缓存skb队列中的数据包进行处理时,确定skb队列是否为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存是否为满;a determining unit, configured to determine whether the skb queue is empty or to determine a front end driver of the user virtual machine DomU and a backend driver of the privileged virtual machine Dom0 when attempting to process a data packet in the network socket buffer skb queue Whether the shared memory between is full;
    所述读取单元,在确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满时,读取所述接收线程需处于的模式;并在读取到所述模式为轮询模式时,所述接收线程无需休眠;所述轮询模式用于标识接收线程处于非休眠状态。The reading unit reads that the receiving thread needs to be in the process of determining that the skb queue is empty or determining that the shared memory between the front end driver of the user virtual machine DomU and the back end driver of the privileged virtual machine Dom0 is full. Mode; and when the mode is read to be polling mode, the receiving thread does not need to sleep; the polling mode is used to identify that the receiving thread is in a non-sleep state.
  21. 如权利要求20所述的装置,其特征在于,所述确定单元,还用于在所述读取单元读取到所述模式为轮询模式后,确定上一次读取到的所述接收线程需处于的模式;The device according to claim 20, wherein the determining unit is further configured to: after the reading unit reads that the mode is a polling mode, determine the receiving thread that was last read Mode to be in;
    还包括:Also includes:
    第一通知单元,在确定上一次读取到的所述接收线程需处于的模式为非轮询模式时,向用户虚拟机DomU的前端驱动发送用于通知所述接收线程的模式由非轮询模式更改为轮询模式的通知信息;a first notification unit, configured to send a mode for notifying the receiving thread to the front end driver of the user virtual machine DomU when the mode in which the receiving thread is last read is in a non-polling mode, by the non-polling mode The mode is changed to the notification information of the polling mode;
    所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。The non-polling mode is used to identify that the receiving thread is in a dormant state when the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full.
  22. 如权利要求20或21所述的装置,其特征在于,所述读取单元,在读 取所述接收线程需处于的模式,具体用于在被允许读取所述接收线程需处于的模式时,读取所述接收线程需处于的模式。The apparatus according to claim 20 or 21, wherein said reading unit is in reading The mode that the receiving thread needs to be in, specifically for reading the mode that the receiving thread needs to be in when it is allowed to read the mode that the receiving thread needs to be in.
  23. 如权利要求20或21所述的装置,其特征在于,所述读取单元,在读取所述接收线程需处于的模式,具体用于:The device according to claim 20 or 21, wherein the reading unit is in a mode in which the receiving thread needs to be read, specifically for:
    在被禁止读取所述接收线程需处于的模式时,则等待预定时间后,再次尝试读取所述接收线程需处于的模式,直到被允许读取所述接收线程需处于的模式。When it is forbidden to read the mode that the receiving thread needs to be in, after waiting for a predetermined time, try again to read the mode that the receiving thread needs to be in until the mode in which the receiving thread needs to be read is allowed to be read.
  24. 如权利要求20至23任一项所述的装置,其特征在于,还包括:The device according to any one of claims 20 to 23, further comprising:
    第二通知单元,用于在所述确定单元确定skb队列为空或者确定用户虚拟机DomU的前端驱动与所述特权虚拟机Dom0的后端驱动之间的共享内存为满之后,所述读取单元读取到所述接收线程需处于非轮询模式且所述确定单元确定上一次读取到所述接收线程需处于的模式为轮询模式时,向所述前端驱动发送用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息。a second notification unit, configured to: after the determining unit determines that the skb queue is empty or determines that the shared memory between the front end driver of the user virtual machine DomU and the back end driver of the privileged virtual machine Dom0 is full, the reading The unit reads that the receiving thread needs to be in the non-polling mode and the determining unit determines that the mode that the previous reading to the receiving thread needs to be in the polling mode, and sends the notification to the front end driver to notify the The mode of the receiving thread is changed from polling mode to notification information in non-polling mode.
  25. 一种虚拟化平台中的数据处理装置,其特征在于,所述数据处理装置应用于用户虚拟机DomU的前端驱动,包括:A data processing device in a virtualization platform, wherein the data processing device is applied to a front end driver of a user virtual machine DomU, including:
    处理单元,用于生成第一数据请求并放置在所述前端驱动与特权虚拟机Dom0的后端驱动之间的共享内存;a processing unit, configured to generate a first data request and place a shared memory between the front end driver and a backend driver of the privileged virtual machine Dom0;
    发送单元,用于在所述处理单元确定特权虚拟机Dom0的接收线程所处的模式为轮询模式时,无需向所述Dom0的接收线程发送唤醒请求,所述轮询模式用于标识接收线程处于非休眠状态。a sending unit, configured to: when the processing unit determines that a mode in which the receiving thread of the privileged virtual machine Dom0 is in a polling mode, does not need to send a wakeup request to the receiving thread of the Dom0, where the polling mode is used to identify the receiving thread In a non-sleep state.
  26. 如权利要求25所述的装置,其特征在于,所述处理单元,还用于生成第二数据请求放置在所述前端驱动与所述后端驱动之间的共享内存;The device according to claim 25, wherein the processing unit is further configured to generate a second data request to be placed in the shared memory between the front end driver and the back end driver;
    还包括:Also includes:
    接收单元,用于接收所述接收线程发送的用于通知所述接收线程的模式由轮询模式更改为非轮询模式的通知信息;a receiving unit, configured to receive, by the receiving thread, notification information for notifying that the mode of the receiving thread is changed from a polling mode to a non-polling mode;
    所述发送单元,还用于在所述接收单元接收到所述通知信息时,向所述接收线程发送用于唤醒所述接收线程的唤醒请求,所述非轮询模式用于标识所述接收线程在所述skb队列为空或者在用户虚拟机DomU的前端驱动与所述后端驱动之间的共享内存为满时处于休眠状态。 The sending unit is further configured to: when the receiving unit receives the notification information, send a wakeup request for waking up the receiving thread to the receiving thread, where the non-polling mode is used to identify the receiving The thread is in a sleep state when the skb queue is empty or when the shared memory between the front end driver of the user virtual machine DomU and the backend driver is full.
PCT/CN2016/109747 2015-12-23 2016-12-13 Method of processing data on virtualization platform and device WO2017107816A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510979888.2A CN105630576B (en) 2015-12-23 2015-12-23 Data processing method and device in a kind of virtual platform
CN201510979888.2 2015-12-23

Publications (1)

Publication Number Publication Date
WO2017107816A1 true WO2017107816A1 (en) 2017-06-29

Family

ID=56045555

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/109747 WO2017107816A1 (en) 2015-12-23 2016-12-13 Method of processing data on virtualization platform and device

Country Status (2)

Country Link
CN (1) CN105630576B (en)
WO (1) WO2017107816A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630576B (en) * 2015-12-23 2019-08-20 华为技术有限公司 Data processing method and device in a kind of virtual platform
CN106095580B (en) * 2016-06-14 2019-04-09 上海交通大学 A kind of efficient sending method of data packet virtualizing network interface card for half
CN107643897B (en) * 2016-07-20 2021-04-16 阿里巴巴集团控股有限公司 Method and device for updating back-end driver
CN110018782B (en) * 2018-01-09 2022-06-17 阿里巴巴集团控股有限公司 Data reading/writing method and related device
CN115756143B (en) * 2022-11-30 2024-03-12 深圳市领创星通科技有限公司 Energy-saving method and device for data packet processing, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335694A (en) * 2007-06-29 2008-12-31 联想(北京)有限公司 Interrupt handling method and system
CN101887393A (en) * 2010-07-01 2010-11-17 中兴通讯股份有限公司 Equipment fault reproduction method and system based on para-virtualization technique
CN103176833A (en) * 2013-03-11 2013-06-26 华为技术有限公司 Data transmission method, data receiving method and system based on virtual machine
CN105630576A (en) * 2015-12-23 2016-06-01 华为技术有限公司 Data processing method and apparatus in virtualization platform

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101430674B (en) * 2008-12-23 2010-10-20 北京航空航天大学 Intraconnection communication method of distributed virtual machine monitoring apparatus
CN101557420B (en) * 2009-03-31 2012-07-25 北京航空航天大学 Realization method of high-efficiency network communication of a virtual machine monitor
CN101706742B (en) * 2009-11-20 2012-11-21 北京航空航天大学 Method for dispatching I/O of asymmetry virtual machine based on multi-core dynamic partitioning
CN103870311B (en) * 2012-12-10 2016-12-21 华为技术有限公司 The method of hardware that accesses, rear end is driven to drive and front-end driven by half virtualization
WO2015042684A1 (en) * 2013-09-24 2015-04-02 University Of Ottawa Virtualization of hardware accelerator

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101335694A (en) * 2007-06-29 2008-12-31 联想(北京)有限公司 Interrupt handling method and system
CN101887393A (en) * 2010-07-01 2010-11-17 中兴通讯股份有限公司 Equipment fault reproduction method and system based on para-virtualization technique
CN103176833A (en) * 2013-03-11 2013-06-26 华为技术有限公司 Data transmission method, data receiving method and system based on virtual machine
CN105630576A (en) * 2015-12-23 2016-06-01 华为技术有限公司 Data processing method and apparatus in virtualization platform

Also Published As

Publication number Publication date
CN105630576A (en) 2016-06-01
CN105630576B (en) 2019-08-20

Similar Documents

Publication Publication Date Title
WO2017107816A1 (en) Method of processing data on virtualization platform and device
US10552337B2 (en) Memory management and device
US20190155760A1 (en) NVME Data Processing Method and NVME Device
JP5784677B2 (en) Extending the processor for secure embedded container execution
WO2023103296A1 (en) Write data cache method and system, device, and storage medium
JP2006127462A (en) Information processing device, process control method, and computer program
JP2000330806A (en) Computer system
TW201015318A (en) Performance based cache management
TW201229742A (en) Power-optimized interrupt delivery
US9489223B2 (en) Virtual machine wakeup using a memory monitoring instruction
US9600314B2 (en) Scheduler limited virtual device polling
WO2015024475A1 (en) Detection of hot pages for partition hibernation
EP3803663B1 (en) Watchdog timer hierarchy
TW200525365A (en) Optimization of SMI handling and initialization
EP3598310A1 (en) Network interface device and host processing device
JP2011060238A (en) Information processor, image forming apparatus, operation mode switching method
EP3770759A1 (en) Wake-up and scheduling of functions with context hints
TWI515554B (en) Power-up restriction
US11567884B2 (en) Efficient management of bus bandwidth for multiple drivers
US10649763B2 (en) Resource efficient deployment of multiple hot patches
US8832483B1 (en) System-on-chip with power-save mode processor
WO2018067386A1 (en) Preventing power gating of a domain
JP2013000941A (en) Information processor, information processing method, and program
CN108845969B (en) Operation control method and operation system suitable for incompletely symmetrical multi-processing microcontroller
CN112462926B (en) Power management method and device in mobile terminal, electronic equipment and computer storage medium

Legal Events

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

Ref document number: 16877627

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16877627

Country of ref document: EP

Kind code of ref document: A1