Situation & scope
Compare full virtualization (hardware-assisted: VT-x/AMD-V + NPT/EPT) vs paravirtualization (guest-aware hypervisor/virtio) and how OS internals change: TLB behavior/shootdowns, page-table management, timers/interrupts, and I/O. End with tuning advice for host and guest kernels.
TLB behavior & shootdowns
- Full virtualization (with nested page tables): CPU maintains guest TLB entries tagged by ASID; VM exits on EPT violations force expensive flushes. TLB shootdowns from guest vs host can be more frequent because hypervisor and guest both modify translations — cross-VM shootdowns cost more.
- Paravirtualization: guest uses hypercalls for mapping changes; hypervisor coordinates fewer hardware-induced exits so fewer unexpected TLB invalidations.
Page-table management
- Shadow page tables (older KVM approach): hypervisor mirrors guest PTEs; every guest write can require sync => more VM exits and higher overhead.
- Nested Page Tables (NPT/EPT): hardware walks both guest and host tables; much lower hypervisor overhead but increases TLB pressure and EPT-related faults on huge page fragmentation.
Timer & interrupt handling
- Full virtualization: virtual timer emulation causes frequent VM exits for timer ticks and IRQ injection latency. TSC scaling and KVM clocksource help.
- Paravirtual timers (paravirt clocks, KVM paravirt ops): reduce exits via hypercalls; lower latency and jitter.
I/O virtualization
- Emulated devices (full virt): high CPU/latency.
- virtio/vhost (paravirtual): guest drivers + vhost-net in host kernel move data with fewer copies and fewer context switches; use vhost-net or VFIO for SR-IOV to offload to NIC and reduce host involvement.
Tuning recommendations
- Host:
- Enable EPT/NPT and large pages (2MiB/1GiB) to reduce TLB pressure and EPT faults.
- Use vhost/vfio, enable hugepages and configure irqbalance, isolate CPUs for latency-sensitive guests.
- Monitor VM-exit rates and EPT faults; pin vCPUs to physical cores where appropriate.
- Guest:
- Use paravirtual drivers (virtio), enable pv-timers, and prefer large memory pages/slab tuning to reduce page churn.
- Avoid heavy kernel page-table churn (reduce frequent mmap/unmap loops), tune vm.swappiness and transparent hugepages policy for reduced TLB misses.
Why this matters
Understanding these trade-offs helps choose kernel configs, CPU pinning, hugepages, and I/O strategies that minimize VM-exits, TLB churn, and latency — critical for reliable cloud infrastructure performance.