intel / haxm

Intel® Hardware Accelerated Execution Manager (Intel® HAXM)
BSD 3-Clause "New" or "Revised" License
3.22k stars 875 forks source link

QEMU with HAXM is much slower than QEMU without HAXM on Windows 10 host #399

Open hsluoyz opened 3 years ago

hsluoyz commented 3 years ago

Env

Host: Win10 x64 21H1

image

QEMU: qemu-w64-setup-20210721.exe from: https://qemu.weilnetz.de/w64/

I'm trying to run the SONiC image on QEMU + Windows: https://github.com/Azure/SONiC/wiki/SONiC-on-virtual-machine-for-Windows. I tried two commands:

QEMU without HAXM (the command from the above SONiC guide)

"C:\Program Files\qemu\qemu-system-x86_64.exe" -name sonic-simulator_1 -m 4096M -smp cpus=4 -drive file=D:\sonic-vs.img,index=0,media=disk,id=drive0 -serial telnet:127.0.0.1:5001,server,nowait -monitor tcp:127.0.0.1:44001,server,nowait -device e1000,netdev=net0 -netdev user,id=net0

QEMU with HAXM

The information here: https://www.qemu.org/2017/11/22/haxm-usage-windows/ told me to install Intel HAXM (https://github.com/intel/haxm/releases/download/v7.7.0/haxm-windows_v7_7_0.zip) and add -accel hax to my QEMU command.

"C:\Program Files\qemu\qemu-system-x86_64.exe" -name sonic-simulator_1 -m 4096M -smp cpus=4 -drive file=D:\sonic-vs.img,index=0,media=disk,id=drive0 -serial telnet:127.0.0.1:5001,server,nowait -monitor tcp:127.0.0.1:44001,server,nowait -device e1000,netdev=net0 -netdev user,id=net0 -accel hax

From the screenshot, I can know HAX is working.

image

Result

But the result is, adding -accel hax will make the VM much much slower than even binary translation instead of being faster.

The SONiC guest VM is actually a Debian 10 x64 OS. So I think it should be something supported by HAXM.

Any ideas on why HAXM is even slower?

image

wcwang commented 3 years ago

Thanks for your report. We have followed the wiki page to set up the environment and completed the test. The QEMU launch command is exactly same as the example. However, the test results from our side are normal and the details are shared as below.

Launch SONiC without HAXM: 58 s 480 ms Launch SONiC with HAXM: 41 s 500 ms

The whole process included from executing command line, logging in to logging out. It is obvious that the performance has increased by nearly 30% with HAXM hardware acceleration. What is the result of your observation? Our testing environment is as below for your reference. Could you share more information about your hardware configuration?

OS: Windows 10 Version 21H1 (OS Build 19043.1110) Processor: Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz 3.00 GHz System type: 64-bit operating system, x64-based processor

Meanwhile, could you help to check below aspects to narrow down your issue?

nikishyn commented 2 years ago

I seem to have a similar issue. OS Host: Win10x64 OS guest: Win7x64 sp1 with KB3033929 update. QEMU: qemu-w64-setup-20211215.exe Haxm: 7.7.0 After adding --accel hax, the Windows start animation started much later. Unfortunately, I couldn't wait for the OS to load. I waited 20 minutes on this screen Capture

shtirlic commented 2 years ago

The same for me usinq latest qemu on windows 11, running arch linux guest, after enabling -accel hax I can not even pass the Grub screen

Accelerators supported in QEMU binary:
hax
whpx
tcg
PS C:\Users\x\VirtualBox VMs\arazu-arch> qemu-system-x86_64.exe -version
QEMU emulator version 6.2.0 (v6.2.0-11889-g5b72bf03f5-dirty)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
PS C:\Users\x\VirtualBox VMs\arazu-arch>
OS Name Microsoft Windows 11 Pro
Version 10.0.22000 Build 22000
Other OS Description    Not Available
OS Manufacturer Microsoft Corporation
System Name ARAZU
System Manufacturer Dell Inc.
System Model    XPS 13 7390 2-in-1
System Type x64-based PC
System SKU  08B0
Processor   Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz, 1498 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date   Dell Inc. 1.13.0, 10.12.2021
SMBIOS Version  3.1
Embedded Controller Version 255.255
BIOS Mode   UEFI
BaseBoard Manufacturer  Dell Inc.
BaseBoard Product   0V2CCD
BaseBoard Version   A03
Platform Role   Mobile

image