Memory page fault handling for network interface devices in a virtualized environment
Systems and methods for supporting memory page fault handling for network devices are disclosed. In one implementation, a processing device may receive, at a network interface device of a host computer system, an incoming packet from a network. The processing device may also select a first buffer from a plurality of buffers associated with a receiving queue of the network interface device. The processing device may attempt to store the incoming packet at the first buffer of the plurality of buffers. Responsive to receiving a notification that attempting to store the incoming packet at the first buffer encountered a page fault, the processing device may assign the first buffer to a wait queue of the network interface device. The processing device may further store the incoming packet at a second buffer of the plurality of buffers associated with the receiving queue.
1. A method, comprising:
receiving, by a network interface device of a host computer system, an incoming packet from a network;
selecting a first buffer from a plurality of buffers associated with a receiving queue of the network interface device;
attempting to store the incoming packet at the first buffer of the plurality of buffers; and
responsive to receiving a notification that attempting to store the incoming packet at the first buffer encountered a page fault:
assigning the first buffer to a wait queue of the network interface device; and
storing the incoming packet at a second buffer of the plurality of buffers associated with the receiving queue.
2. The method of claim 1 , wherein the plurality of buffers are allocated by a driver of the network interface device, and wherein the plurality of buffer are marked as available upon allocation.
3. The method of claim 2 , wherein the driver of the network interface device is executed by a guest operating system of a virtual machine running on the host computer system.
4. The method of claim 1 , wherein the network interface device comprises a Network Interface Card (NIC).
5. The method of claim 1 , wherein the page fault is generated responsive to a memory page of the first buffer being not present in a physical memory of the host computer system.
6. The method of claim 1 further comprising:
responsive to the page fault being handled, detecting that the memory page of the first buffer is present.
7. The method of claim 1 , wherein the receiving queue and the wait queue are allocated by the driver of the network interface device.
8. The method of claim 1 further comprising:
responsive to detecting that the page fault is handled:
removing the first buffer from the wait queue;
storing a second incoming packet at the first buffer; and
assigning the first buffer to the receiving queue.
9. The method of claim 1 , wherein responsive to storing the incoming packet at the second buffer, marking the second buffer as used.
10. The method of claim 9 , wherein responsive to detecting that the incoming packet at the second buffer has been read by the network interface device, marking the second buffer as available.
11. A system comprising:
a memory;
a processing device operatively coupled to the memory, the processing device to:
receive, at a network interface device, an incoming packet from a network;
select a first buffer from a plurality of buffers associated with a receiving queue of the network interface device;
attempt to store the incoming packet at the first buffer of the plurality of buffers; and
responsive to receiving a notification that attempting to store the incoming packet at the first buffer encountered a page fault:
assign the first buffer to a wait queue of the network interface device; and
store the incoming packet at a second buffer of the plurality of buffers associated with the receiving queue.
12. The system of claim 11 , wherein the plurality of buffers are allocated by a driver of the network interface device, and wherein the plurality of buffer are marked as available upon allocation.
13. The system of claim 11 , wherein the page fault is generated responsive to a memory page of the first buffer being not present.
14. The system of claim 11 , wherein the processing device is further to:
responsive to the page fault being handled, detect that the memory page of the first buffer is present.
15. The system of claim 11 , wherein the processing device is further to:
responsive to detecting that the page fault is handled:
remove the first buffer from the wait queue;
store a second incoming packet at the first buffer; and
assign the first buffer to the receiving queue.
16. The system of claim 11 , wherein responsive to storing the incoming packet at the second buffer, mark the second buffer as used.
17. A non-transitory computer-readable media storing instructions that, when executed, cause a processing device to:
receive, at a network interface device, an incoming packet from a network;
select a first buffer from a plurality of buffers associated with a receiving queue of the network interface device;
attempt to store the incoming packet at the first buffer of the plurality of buffers; and
responsive to receiving a notification that attempting to store the incoming packet at the first buffer encountered a page fault:
assign the first buffer to a wait queue of the network interface device; and
store the incoming packet at a second buffer of the plurality of buffers associated with the receiving queue.
18. The non-transitory computer-readable media of claim 17 , wherein the plurality of buffers are allocated by a driver of the network interface device, and wherein the plurality of buffer are marked as available upon allocation.
19. The non-transitory computer-readable media of claim 17 , wherein the driver of the network interface device is executed by a guest operating system of a virtual machine.
20. The non-transitory computer-readable media of claim 17 , wherein the processing device is further to:
responsive to detecting that the page fault is handled:
remove the first buffer from the wait queue;
store a second incoming packet at the first buffer; and
assign the first buffer to the receiving queue.