quickemu-project / quickemu

Quickly create and run optimised Windows, macOS and Linux virtual machines
MIT License
10.63k stars 463 forks source link

bug: macos sonoma hang during startup #1114

Closed ctamietto closed 5 months ago

ctamietto commented 5 months ago

I have installed quickget cloning from github

I downloaded sonoma with quickget with the command quickget macos sonoma see the video https://youtu.be/07JLZCy5zlo

then I installed sonoma with the command quickemu --vm macos-sonoma.conf see the vidoes of the begin of installation end the end start : https://youtu.be/MpbozxjQACw end : https://youtu.be/Z5H0FT6Karo

it seem to me that almost at the end of the installation ( second startup ) the vm rebooted
so probably the installation in not complete ( you can view that in https://youtu.be/Z5H0FT6Karo )

when I try to boot i get a blank screen ( after i have chosen the disk of installation ) and after sometime it restart
see the video https://youtu.be/MpbozxjQACw

my system is fedora 39

immagine

the log is void

immagine

what can i check ? P.S: i have tried do install also big-sur monterey ventura with the same result

only the installation of catalina is working ( but is too old for what i have to do )

thank you for any response

TuxVinyards commented 4 months ago

Again sse3 is not a valid qemu parameter:

QEMU appears to refer to sse3 as pni. For many of these flags, though, I think it's likely they're enabled by default when you specify Haswell or whatever other architecture. SSE3, for example, was introduced in 2004. Surely anything expecting a Haswell CPU would require it.

It works the other way round. ssse3 includes sse3 Try lscpu | grep sse or :

lscpu | grep -i flags | tr ' ' '\n' | grep sse
sse
sse2
ssse3
sse4_1
sse4_2
TuxVinyards commented 4 months ago

A couple of CPU flags are named differently in QEMU, beware. vbmi2, for example, is avx512vbmi2

Well spotted. Not sure where that came from.

lscpu | grep -i flags | tr ' ' '\n' | grep bmi
bmi1
bmi2
avx512vbmi
avx512_vbmi2

qemu-system-x86_64 -cpu help | grep -A 100 flags | tr ' ' '\n' | grep bmi | cat -s
avx512vbmi
avx512vbmi2
bmi1
bmi2
flexiondotorg commented 4 months ago

I've incorporated the feedback in my feature branch, macos-host and created a new function, configure_cpu_flag(), which converts the appropriate flag to QEMU format.

What I have implemented does deviate slightly from the discussion because it also works for running macOS VMs on macOS hosts, and therefore handles macOS CPU flag conversions too.

If the host CPU is "GenuineIntel" then quickemu passes the host CPU model features, model, stepping, exactly to the guest. This is what the broader macOS on QEMU community recommends. I've tested this on Linux with Intel Xeon E-2176M and on macOS with Intel Core i7-4770HQ. If the host is not "GenuineIntel" then configure_cpu_flag() does its thing, including outright disabling pcid on "AuthenticAMD". I've tested this in Linux with Ryzen 5950X and 5900X using VMs of macOS Mojave, Catalina, Big Sur, Monterey, Ventura and Sonoma. All works well.

Fully disabling huge pages (,-pdpe1gb) is absolutely required on macOS to prevent crashes on every attempted boot:

Therefore, because it is now possible to run a macOS VM that, in turn, can run a VM, huge pages are always disabled on macOS hosts and guests.

TuxVinyards commented 4 months ago

Wow

TuxVinyards commented 4 months ago

@flexiondotorg A couple of things:

I am finding that -cpu host is making my CPU churn badly.

If I edit the following line to read as "xxGenuineIntel" and force AMD/Haswell, things run a lot smoother.

macos)
            # If the host has an Intel CPU, passes the host CPU model features, model, stepping, exactly to the guest.
            # Disable huge pages (,-pdpe1gb) on macOS to prevent crashes
            # - https://stackoverflow.com/questions/60231203/qemu-qcow2-mmu-gva-to-gpa-crash-in-mac-os-x
            if [ "${HOST_CPU_VENDOR}" == "xxGenuineIntel" ] && [ -z "${HYPERVISOR}" ]; then
                CPU_MODEL="host"
  1. There were a few overlooked flags that weren't quite right. I did make a comment but I think you had had enough at that point and these got missed. They are not critical but they shouldn't be there ....

https://github.com/quickemu-project/quickemu/pull/1225#issuecomment-2117555805

I also tried a PR but the bot kept blocking things and saying that I hadn't made any changes. Maybe because no lines were added. That's another issue to look at possibly.

flexiondotorg commented 4 months ago

Please provide some performance metrics for running a VM with host and Haswell so we have an objective comparison.

TuxVinyards commented 4 months ago

Every time I click on a GUI icon in -cpu host mode the physical Host monitors show the cores maxing out. Doesn't happen with Haswell.

On my 3 year old mid-range Intel, the objective times are as follows:

  1. Time from clicking the Mac start disk icon that shows after initial boot, until the logon screen is presented: Haswell mode 15 secs Host mode 21s

  2. Time to complete a 10k repeated bc calculation:

time for i in {1..10000} ; do  bc <<< "scale=10; $i*22/7" ; done

Physical Host: 32 secs and Sonoma/Haswell 28s but Sonoma/Host 3min 10s (7x slower)

host-7x-slower

sonoma-haswell-7x-faster

TuxVinyards commented 4 months ago

Also, from 4.9.5 code:

# A CPU with invtsc is required for macOS to boot

Not true:

invtsc-not-true-will-boot

TuxVinyards commented 4 months ago

Just noticed flag "eist" which is not Haswell.

I think a few things crept in from the Tech PowerUp links that I referenced, before I started using Qemu source instead.

https://www.techpowerup.com/cpu-specs/xeon-w-2140b.c2953

From the transitional work above https://github.com/quickemu-project/quickemu/issues/1114#issuecomment-2101368942

TuxVinyards commented 4 months ago

@flexiondotorg @lj3954

Something NEW

https://github.com/TuxVinyards/qqX/commit/79d2886d03e0ec9611e0b63f8787baef43c6e1aa

Subtractive CPU methods. Totally the reverse of Nick Sherlock's and Kholia's methods that have been used in Quickemu in the past.

Outperforms the additive methods at runtime. 26 secs for the bc test. Very smooth installation with Ventura but having a few problems with the installer on Sonoma that need sorting, if anyone has ideas ....

on tests, both haswell & skylake -ve perform well but skylake3 seems to manage IBRS (spectre-mitigation) and is still faster than Haswell +ve i=on timed tests use cpu_cores="8" in .conf

Use "sysctl -a | grep machdep.cpu" at terminal in MacOS to see flags