Lecture: I/O virtualization
- review physical I/O from 451
- examples:
abstract,
photo
- control
- port-mapped I/O (PIO)
- memroy-mapped I/O (MMIO)
- data transfer: direct memory access (DMA)
- example: NVMe and NIC in JOS
- ring buffers
- interrupts
- see Figure 10-2 of Intel SDM 3 about local APICs and I/O APIC
- PIC,
local APIC, I/O APIC, message signaled interrupts (MSI)
- IDT
- example: how an app communicates to the network
- send & recv
- consider two processes
- how does the OS decide which one to deliver packets to
- what’s the performance overhead
- what about two virtual machines
- how would you optimize this
- virtualization goals
- multiplexing: mutiple virtual devices share the same physical device
- performance: see the Linux I/O path
- virtualization approaches
- emulation
- paravirtualization
- hardware virtualization
- emulation
- example: emulate a disk on top of a Linux host/file system
- example: emulate an e1000 NIC
- how to intercept PIO, MMIO by guest?
- what’s the overhead of every PIO/MMIO access
- guest -> host kernel (KVM) -> host user (QEMU) -> …
- also see Figure 6.7 of the textbook
- I/O paravirtualization
- problem: the interface of physical devices was not designed for virtualization
- goal: interface redesign for performance
- reduce VM exits
- allow backend drivers to reduce switches to QEMU
- trade-off: need drivers in guest (and possibly host)
- VirtIO for KVM
- example from Table 6.2 of the textbook: 22x throughput (virtio-net vs e1000)
- hardware support
- reduce VM exits
- examples
- IOMMU
- assign devices to guests
- Figure 2-3, Example Virtualization Usage of DMA Remapping, VT-d spec
- Figure 6.15: IOVA translation with the Intel IOMMU, textbook
- interrupt posting
- single root I/O virtualization (SR-IOV)