←back to thread

QEMU 10.1.0

(wiki.qemu.org)
302 points dmitrijbelikov | 2 comments | | HN request time: 0.401s | source
Show context
dijit ◴[] No.45038037[source]
QEMU is truly excellent software, from the perspective of a person who very rarely needs to emulate another architecture. It "just works" and has wonderful integrations with basically everything I could want.. sometimes it feels like magic: even if the commandline UX is a bit weird in places.

I've always wondered though how it works with KVM: I know KVM is a virtualisation accelerator that enables passing through native code to the CPU somehow; but it feels like QEMU/KVM basically runs the internet now. Almost the entire modern cloud is built on QEMU and KVM as a hypervisor (right?) but I feel like I'm missing a lot about how it's working.

I also wonder if this steals huge amounts of resources away from emulation, or does it end up helping out. Because to say the modern internet is largely running on QEMU is likely a massive understatement.

replies(8): >>45038105 #>>45038111 #>>45038113 #>>45038185 #>>45038444 #>>45038616 #>>45038965 #>>45038990 #
monocasa ◴[] No.45038185[source]
KVM is basically three components.

* An abstraction over second level page tables to map some of a host user process as what the guest thinks of as physical memory.

* An abstraction to jump into the context that uses those page tables, and traps back out in the case of anything that the hardware would normally handle, but the hypervisor wants to handle manually instead.

* A collection of mechanisms to handle some of those traps in kernel space to avoid having to context switch back out to the host user process if the kind of trap is common enough, both in the sense of the trap itself happens often enough to show up on perf graphs, as well as the abstraction being exercised is relatively standard (think interrupt controllers and timers).

Let me know if you have any other questions.

replies(3): >>45038711 #>>45042005 #>>45042709 #
1. privatelypublic ◴[] No.45042005[source]
I thought part of vt-d/vt-x made the "virtual tables" actual tables.

Eg- the memory the VM can access is controlled by the MMU of the CPU (below ring0/kernel). Resulting in the only VM escapes being the Shim(s) for talking with the host (network, memory balloon, graphics).

replies(1): >>45043670 #
2. bonzini ◴[] No.45043670[source]
Yes, there are virtualization-specific page tables that convert guest physical to host physical addresses. KVM still haw to take host userspace's virtual addresses, convert them to host physical addresses, and make sure that the virtualization-specific page tables stay in sync with the kernel's usual page tables (which convery host virtual addresses to host physical)