Architectures, Implementations and Deployment Patterns for Near-Native GPU Access in Virtual Machines
Introduction
- What You Will Learn
- How to Read This Book
- Conventions and Source References
Chapter 1: The GPU Virtualization Problem
- Why GPUs Are Hard to Virtualize
- Goals of GPU Virtualization
- The Evolution Timeline
- Taxonomy of GPU Virtualization Approaches
Chapter 2: KVM and QEMU: The Modern Linux Hypervisor Stack
- The Two-Part Architecture
- KVM Architecture
- QEMU Architecture
- The KVM IOCTL Interface in Detail
- Guest Execution Lifecycle
Chapter 3: IOMMU, VFIO and Device Assignment Foundations
- IOMMU Fundamentals
- VFIO Framework
- PCIe Topology and Isolation
- Security Implications of IOMMU and VFIO
Chapter 4: PCIe Passthrough: The Original Full-GPU Approach
- The Passthrough Mechanism
- Architecture Diagram
- Configuration and Setup
- Guest Driver Interaction
- Performance Characteristics
- The Passthrough Limitations
- Production Considerations
Chapter 5: Mediated Devices (mdev): Sharing GPU Time Slices
- The Mediated Device Framework
- NVIDIA’s vGPU via mdev
- Intel GVT-g
- Mediated Device Management
- Limitations and Constraints
Chapter 6: virtio: The Foundation of Paravirtualized I/O
- virtio Design Philosophy
- The Virtqueue Architecture
- Device Discovery
- Transport Options
- virtio in Linux
- virtio Performance Characteristics
- Summary
Chapter 7: VirtIO-GPU: Paravirtualized Graphics in the virtio World
- VirtIO-GPU Device Model
- Resource Types and Lifecycle
- Command Submission
- virtio-gpu with DRM/KMS
- virglrenderer Backend
- Venus Protocol for Vulkan
- DRM Native Context
- Performance Characteristics
- Limitations
Chapter 8: NVIDIA GPU Architecture: What the Hypervisor Must Deal With
- NVIDIA GPU Hardware Generations
- GPU Driver Architecture
- GPU Firmware and GSP
- PCIe BAR Layout
- Compute APIs and Context Management
- GPU Memory Architecture
- What This Means for Virtualization
Chapter 9: The Architecture of virtio-nvgpu: Bridging virtio and NVIDIA
- Motivation and Goals
- Design Philosophy: Forward the Driver ABI, Not the Graphics API
- High-Level Architecture
- The virtio Device Specification
- Design Decisions and Rationale
- Standardized vs. Vendor-Specific Components
- Relationship to Other Approaches
Chapter 10: virtio-nvgpu Host Components: Kernel Backend and Device Model
- Host Kernel Module
- virtio Backend Device
- Physical GPU Binding
- Command Translation Path
- Memory Management on Host
- NVIDIA Driver Interaction
- Error Handling and GPU State
- QEMU Integration
Chapter 11: virtio-nvgpu Guest Components: Frontend Driver and Device Discovery
- Guest virtio Frontend
- Guest NVIDIA Driver Integration
- Device Lifecycle in Guest
- Guest Kernel Configuration
- ABI Profile Loading
- Limitations of the Guest Driver
Chapter 12: Data Paths and Command Submission: End-to-End Workload Flow
- Application Launch
- Guest NVIDIA Driver Path
- Virtio Queue Submission
- Host Backend Processing
- Physical GPU Execution
- Memory Operations
- Result Return Path
- Synchronization
- Complete Flow Diagram
Chapter 13: Memory Management: The Core Challenge of GPU Virtualization
- GPU Memory Models
- Guest-Physical to Host-Physical Translation
- DMA and Coherency
- Huge Pages and GPU Memory
- Memory Isolation and Protection
- Memory Performance
- virtio-nvgpu Memory Management Summary
Chapter 14: Performance Engineering: Measuring and Maximizing GPU Throughput
- Performance Baselines
- Sources of Overhead
- CPU Overhead and vCPU Pinning
- PCIe Bus Utilization
- Memory Bandwidth
- Benchmarking Methodology
- Tuning Strategies
- Comparison with Bare-Metal GPU Execution
Chapter 15: Security, Isolation and Attack Surfaces
- Isolation Models
- DMA Protection
- Attack Vectors
- GPU Reset and Fault Handling
- Multi-Tenant Security
- Trust Boundaries
- Supply Chain Considerations
- Recommendations
Chapter 16: Comparison of GPU Virtualization Approaches
- Comparison Matrix
- PCIe Passthrough (VFIO)
- NVIDIA vGPU
- NVIDIA MIG
- virtio-nvgpu
- virtio-gpu with virglrenderer
- Intel GVT-g (Deprecated)
- Intel SR-IOV
- AMD MxGPU and SR-IOV
- Summary: Making the Right Choice
Chapter 17: Deployment Architectures: From Dev Workstations to Cloud Data Centers
- Single-GPU Development Machine
- Multi-GPU Server with Dedicated VMs
- Multi-Tenant GPU Cluster
- AI/ML Workload Patterns
- Graphics Workloads
- CI/CD Environments
- Hybrid Cloud and Edge
- Container vs. VM Trade-offs for GPU Workloads
- Production Operational Considerations
Chapter 18: Observability, Tracing and Debugging
- System-Level Diagnostics
- virtio Device Diagnostics
- KVM/QEMU Diagnostics
- Kernel Tracing with ftrace
- eBPF for Observability
- GPU-Specific Tools
- Network and PCIe Diagnostics
- Performance Profiling
Chapter 19: Troubleshooting GPU Virtualization Issues
- Issue: GPU Not Visible in VM
- Issue: IOMMU Group Contains Unwanted Devices
- Issue: GPU Reset Fails or Hangs
- Issue: High CPU Usage or Performance Degradation
- Issue: NVIDIA Driver Installation Fails Inside Guest
- Issue: VM Crashes on GPU Access
- Issue: Multi-Tenant GPU Contentions
- Issue: Security and Isolation Violations
- Issue: Host Crash Due to GPU Virtualization
- General Troubleshooting Methodology
Chapter 20: The Future of GPU Virtualization
- virtio-nvgpu Maturation Path
- SR-IOV for NVIDIA GPUs
- Hardware Assisted Virtualization
- Container Orchestration and GPU Virtualization
- Open-Source and Vendor-Neutral Standards
- AI/ML Workload Implications
- Security Trends
- Performance Improvements
- Cloud and Hyperscaler Adoption
- Remaining Open Problems
- Conclusion of Future Outlook
