TransWikia.com

User mode qemu and KVM

Unix & Linux Asked by Mauricio Galindo on January 3, 2022

When running user mode qemu for target x86 on a target x86 (or just target arch = host arch), will qemu use KVM, transfer control to the directly to the CPU or will it be interpreting the instructions.

One Answer

A few circumstantial evidences that user mode does not use KVM:

  • the userland executable qemu-x86_64 --help does not show a --kvm option, as is present for the full system executable qemu-system-x86_64 --help

  • we can see both input instructions and the binary translated instructions with:

    qemu-x86_64 -d in_asm,out_asm hello.out
    

    A commented example: How does native android code written for ARM run on x86

Now, for the more interesting question, could it in theory work?

I'm not sure, but on the gem5 simulator, which also has an analogous user mode (called syscall emulation), there was at least some serious investigation of this possibility by AMD, and they concluded it would be possible: http://www.m5sim.org/wiki/images/5/53/2015_ws_12_KVM-in-SE.pdf

Something was actually merged in 2014: adbaa4dfde96d5aaf84adf0ae4989ef880aad726 "kvm, x86: Adding support for SE mode execution". But when I tried on 3ca404da175a66e0b958165ad75eb5f54cb5e772 it failed with KeyError: 'OsKernel', gotta investigate/ask further.

Answered by Ciro Santilli 新疆再教育营六四事件法轮功郝海东 on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP