IP Library Granted Patent US 10,846,124
Granted Patent B2
US 10,846,124 · App. 16/351,272 · Granted Nov 24, 2020

Communication method, apparatus and system for virtual machine and host machine

Inventors: Xun Ni (Beijing, CN); Yongji Xie (Beijing, CN); Yu Zhang (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
G06F9/45558G06F9/544G06F9/546G06F2009/45579G06F2009/45583
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,846,124
App. No.
16/351,272
Granted
Nov 24, 2020
Kind
B2
Abstract

Embodiments of the present disclosure disclose a communication method, apparatus and system for a virtual machine and a host machine. An embodiment of the communication method for a virtual machine and a host machine includes: polling a first command completion identifier queue set in a shared memory; comparing, in response to detecting an update of the first command completion identifier queue, the first command completion identifier queue with a second command completion identifier queue stored in the virtual machine to determine an identifier of a currently completed command; and updating the second command completion identifier queue based on the identifier of the currently completed command.

Claims (36)

1. A communication method for a virtual machine and a host machine, the method comprising:

polling a first command completion identifier queue set in a shared memory;

comparing, in response to detecting an update of the first command completion identifier queue, the first command completion identifier queue with a second command completion identifier queue stored in the virtual machine to determine an identifier of a currently completed command; and

updating the second command completion identifier queue based on the identifier of the currently completed command;

wherein the method further comprises:

sending a Input/Output (I/O) port read and write request to a to-be-executed command queue, and updating a to-be-executed command identifier queue corresponding to the to-be-executed command queue, causing the host machine polling the to-be-executed command identifier queue to obtain a current to-be-executed command, and to update the first command completion identifier queue after the current to-be-executed command is executed.

2. The method according to claim 1 , the method further comprising:

obtaining returned data corresponding to the currently completed command from a command queue based on the identifier of the currently completed command; and

invoking a function to process the returned data.

3. A communication system for a virtual machine and a host machine, the system comprising: the host machine and at least one virtual machine deployed on the host machine, wherein:

the at least one virtual machine is configured to: poll a first command completion identifier queue set in a shared memory; compare, in response to detecting an update of the first command completion identifier queue, the first command completion identifier queue with a second command completion identifier queue stored in the virtual machine to determine an identifier of a currently completed command; and update the second command completion identifier queue based on the identifier of the currently completed command;

the at least one virtual machine is further configured to send a Input/Output (I/O) port read and write request to a to-be-executed command queue, and update a to-be-executed command identifier queue corresponding to the to-be-executed command queue; and

the host machine is configured to: poll the to-be-executed command identifier queue in the shared memory to obtain a current to-be-executed command; and update the first command completion identifier queue after the current to-be-executed command is executed.

4. The system according to claim 3 , wherein when the host machine updates the first command completion identifier queue, the host machine is further configured to:

poll the to-be-executed command identifier queue in the shared memory;

determine, in response to detecting an update of the to-be-executed command identifier queue, from the to-be-executed command queue the I/O port read and write request as the current to-be-executed command;

send the current to-be-executed command to a hardware device to cause the hardware device to execute the current to-be-executed command; and

add, in response to receiving a command execution completion message returned by the hardware device, returned data of the current to-be-executed command to a command completion queue, and update the first command completion identifier queue.

5. The system according to claim 4 , wherein the at least one virtual machine is further configured to:

obtain returned data corresponding to the currently completed command from a command queue based on the identifier of the currently completed command; and

invoke a function to process the returned data.

6. A communication apparatus for a virtual machine and a host machine, the apparatus comprising:

at least one processor; and

a memory storing instructions, wherein the instructions when executed by the at least one processor, cause the at least one processor to perform operations, the operations comprising:

polling a first command completion identifier queue set in a shared memory;

comparing, in response to detecting an update of the first command completion identifier queue, the first command completion identifier queue with a second command completion identifier queue stored in the virtual machine to determine an identifier of a currently completed command; and

updating the second command completion identifier queue based on the identifier of the currently completed command;

wherein the operations further comprise:

sending a Input/Output (I/O) port read and write request to a to-be-executed command queue, and updating a to-be-executed command identifier queue corresponding to the to-be-executed command queue, causing the host machine polling the to-be-executed command identifier queue to obtain a current to-be-executed command, and to update the first command completion identifier queue after the current to-be-executed command is executed.

7. The apparatus according to claim 6 , the operations further comprising:

obtaining returned data corresponding to the currently completed command from a command queue based on the identifier of the currently completed command; and

invoking a function to process the returned data.

8. A non-transitory computer readable storage medium, storing a computer program thereon, the computer program, when executed by a processor, causes the process to implement the method according to claim 1 .

9. The non-transitory computer readable storage medium according to claim 8 , the method further comprising:

obtaining returned data corresponding to the currently completed command from a command queue based on the identifier of the currently completed command; and

invoking a function to process the returned data.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 13, 2019
From: NI, XUN; XIE, YONGJI; ZHANG, YU
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 048588/0434 →
Priority Claims (1)
CN 2018 1 0600242 · Jun 12, 2018 · national
Continuity (1)
Related Publication 20190377593A1 · Dec 12, 2019
Cited By (2)
US 12,436,795 US 12,498,952