Octocontrabass wrote: ↑Fri May 23, 2025 6:38 pm
It couldn't be anything else, since that error code is coming directly from the CPU.
Ok, so my guess about what is really going on "under the hood" is as follows:
qemu/kvm VM was launched with -overcommit mem-lock=on qemu option. Host Linux OS allocates a qemu process's virtual address range which is what the guest thinks to be its "physical" address space (note that such a range includes VM configured RAM plus memory-mapped I/O as well). As result of that option, host Linux OS allocates and locks RAM resident page frames for guest "physical" memory including the "normal" host paging-structures needed to map it.
Here you can see the qemu process's VA range of 16779264 KiB (16386 MiB) allocated from 0x000072582bc00000 as resident (RSS) for VM/guest "physical" address space as required by mem-lock=on qemu option.
Code: Select all
root@eve-ng62:~# pmap -x 869394 | egrep "(qemu-6.0.0)|(000072582bc00000)" -A 1
869394: /opt/qemu-6.0.0/bin/qemu-system-x86_64 -nographic -device e1000,addr=3.0,multifunction=on,netdev=net0,mac=50:00:00:09:00:00 -netdev tap,id=net0,ifname=vunl0_9_0,script=no -device e1000,addr=3.1,multifunction=on,netdev=net1,mac=50:00:00:09:00:01 -netdev tap,id=net1,ifname=vunl0_9_1,script=no -device e1000,addr=3.2,multifunction=on,netdev=net2,mac=50:00:00:09:00:02 -netdev tap,id=net2,ifname=vunl0_9_2,script=no -smp 4 -m 16386 -enable-kvm
Address Kbytes RSS Dirty Mode Mapping
--
000072582bc00000 16779264 16779264 16779264 rw--- [ anon ]
0000725c2be00000 4 0 0 ----- [ anon ]
root@eve-ng62:~#
As long as guest keeps accessing new memory locations, the Dirty column increases up to the maximum. Therefore a qemu access to any address in that VA range will never result in a page fault. So far so good.
When it comes to second level address translation (Intel EPT) things are really different. qemu/kvm build on demand EPT paging-structures devoted to map VM's GPAs and do not lock RAM resident memory for them. So when the guest tries to access a GVA an EPT-induced VM-exit can occur for two reasons:
- exit occurs when the guest accesses an already accomplished/completed GVA-> GPA translated address (bit 8 within VM-exit violation is set (1) as in 0x181 and 0x182 error_code)
- exit occurs during the translation of a GVA into GPA (bit 8 within VM-exit violation is clear (0) as in 0x82 error_code)
What do you think, is the above plausible ? Thanks.