Secure zero-copy packet forwarding
AssigneeRed Hat Israel, Ltd.
InventorsMichael Tsirkin, Amnon Ilan
Life of this patent
Estimating the term…
Abstract
A hypervisor detects a virtual device configured by a virtual machine, generates a para-virtualized networking interface between the virtual device and a memory space within hypervisor memory, maps the memory space to a peripheral component interconnect (PCI) memory space of the virtual machine, and configures the memory space to be accessible to a physical device via direct memory access (DMA), where the physical device is associated with the virtual device of the virtual machine. The hypervisor then transfer packets between the virtual machine and the physical device using the para-virtualized networking interface.
Claims19
A method, comprising:
- detecting, by a processing device executing a hypervisor, a virtual device configured by a virtual machine, wherein the virtual device is associated with a physical device;
- allocating a first portion of a hypervisor memory of the hypervisor as a shared memory space accessible by the virtual machine and the physical device;
- configuring, by the processing device executing the hypervisor, a para-virtualized networking interface between the virtual device and the shared memory space by mapping the shared memory space of the hypervisor to a second portion of a memory space of the virtual machine, wherein the second portion of the memory space of the virtual machine corresponds to a virtual device memory space for the virtual device of the virtual machine, the virtual device memory space corresponding to a peripheral component interconnect (PCI) memory space of the virtual machine associated with a PCI base address register (BAR) of the virtual device;
- configuring the shared memory space of the hypervisor to be directly accessible to the physical device via direct memory access (DMA);
- and
- causing, by the processing device executing the hypervisor, packets to be obtained from the shared memory space of the hypervisor by the virtual machine via the mapping and also causing the packets to be obtained from the shared memory space of the hypervisor by the physical device via the DMA.
A computing apparatus comprising:
- a memory;
- and
- a processing device, operatively coupled to the memory, to execute a hypervisor to:
- detect, by the processing device executing the hypervisor, a virtual device configured by a virtual machine, wherein the virtual device is associated with a physical device;
- allocate a first portion of a hypervisor memory of the hypervisor as a shared memory space accessible by the virtual machine and the physical device;
- configure, by the processing device executing the hypervisor, a para-virtualized networking interface between the virtual device and the shared memory space by mapping the shared memory space of the hypervisor to a second portion of a memory space of the virtual machine, wherein the second portion of the memory space of the virtual machine corresponds to a virtual device memory space for the virtual device of the virtual machine, the virtual device memory space corresponding to a peripheral component interconnect (PCI) memory space of the virtual machine associated with a PCI base address register (BAR) of the virtual device;
- configure the shared memory space of the hypervisor to be directly accessible to the physical device via direct memory access (DMA);
- and
- cause, by the processing device executing the hypervisor, packets to be obtained from the shared memory space of the hypervisor by the virtual machine via the mapping and also cause the packets to be obtained from the shared memory space of the hypervisor by the physical device via the DMA.
A non-transitory computer readable storage medium, having instructions stored therein, which when executed by a processing device of a computer system, cause the processing device to:
- detect, by the processing device executing a hypervisor, a virtual peripheral component interconnect (PCI) device configured by a virtual machine, wherein the virtual PCI device is associated with a physical PCI network interface controller (NIC) device;
- allocate a first portion of a memory space within hypervisor memory of the hypervisor as a shared memory space accessible by the virtual machine and the physical device;
- generate a VirtIO ring networking interface between the virtual PCI device and the shared memory space within the hypervisor memory by mapping the shared memory space of the hypervisor to a second portion of a memory space of the virtual machine, wherein the second portion of the memory space of the virtual machine corresponds to a virtual device memory space for the virtual PCI device of the virtual machine, the virtual device memory space corresponding to a PCI memory space of the virtual machine associated with a PCI base address register (BAR) of the virtual device;
- configure the shared memory space of the hypervisor to be directly accessible to the physical PCI NIC device via direct memory access (DMA);
- and
- cause, by the processing device executing the hypervisor, packets to be obtained from the shared memory space of the hypervisor by the virtual PCI device via the mapping and also cause the packets to be obtained from the shared memory space of the hypervisor by the physical PCI NIC device via the DMA;
- wherein the processing device to cause the packets to be obtained comprises the processing device to, responsive to detecting that the virtual machine has written a packet to the shared memory space, sending a notification to the physical PCI NIC device to cause the physical PCI NIC device to obtain the packet from the shared memory space using a DMA read operation.
Dependencies are inferred from the claim text.