** Hackintosh ** Tips to make a bare metal MacOS


Leoyzen

Recommended Posts

On 9/9/2021 at 9:59 AM, ofawx said:

 

For those suffering issues during restart/shutdown, I can share what worked for me.

 

In config.plist, under NVRAM > boot-args, add 

vti=12

 

Sir, you are an absolute Champion. My hero. My saviour. I do not know who your are, or where you're from but you alone make the internet worth to me. This absolute simple advice solved a two year long mystery : the macos sleep / unraid sleep / unraid wake / macos wake -- macos random crash issue

 

Since two days everything works now flawlessly. Before that, I was about seriously considering buying a mac mini...

 

So. THANK YOU.

  • Haha 1
Link to comment

Thank you @ofawx I had the same issue in the past, the vm crashed sometime, when compiling in xcode with all cores near to 100%; after isolating the cpus and optimizing the xml the issue did not come back; anyway if it will come back I will know what to try.

 

I'm currently experiencing some issues with mac os updates, which I cannot track if it0s due to qemu or bootloader or configuration: for example, when performing an ota delta update, once finished the download, the os asks to restart, but it isn't fully rebooting after the first stage; the vm is running, this is what virsh is reporting, but the os is unable to start again, so I need to force the shutdown and boot again manually. After this, the next stages are completed automatically.

Anyone experiencing similar behavior?

 

Moreover, I'm testing qemu on another machine (not unraid) and it seems that machine type pc-q35-6.1 is unable to boot, we should remind this when qemu 6.1 will be part of unraid.

It seems qemu 6.1 introduced hotpluggable capabilities for pcie with some modifications to DSDT, but even if injecting the old DSDT (qemu 6.0) doesn't fix the issue.

Machine type 6.0 works as expected.

Edited by ghost82
Link to comment
20 hours ago, ghost82 said:

Thank you @ofawx I had the same issue in the past, the vm crashed sometime, when compiling in xcode with all cores near to 100%; after isolating the cpus and optimizing the xml the issue did not come back; anyway if it will come back I will know what to try.

 

I'm currently experiencing some issues with mac os updates, which I cannot track if it0s due to qemu or bootloader or configuration: for example, when performing an ota delta update, once finished the download, the os asks to restart, but it isn't fully rebooting after the first stage; the vm is running, this is what virsh is reporting, but the os is unable to start again, so I need to force the shutdown and boot again manually. After this, the next stages are completed automatically.

Anyone experiencing similar behavior?

 

Moreover, I'm testing qemu on another machine (not unraid) and it seems that machine type pc-q35-6.1 is unable to boot, we should remind this when qemu 6.1 will be part of unraid.

It seems qemu 6.1 introduced hotpluggable capabilities for pcie with some modifications to DSDT, but even if injecting the old DSDT (qemu 6.0) doesn't fix the issue.

Machine type 6.0 works as expected.

I have some issues similar to what you describe but unfortunately I couldn't get to the root of the issue. Tried a lot of combinations and messed up the entire VM.  I ended up doing a clean install with fresh XML definition. I can share my config.plist for BigSur/Monterey if it helps you compare stuff.

  • Like 1
Link to comment
43 minutes ago, ghost82 said:

Thank you, I think I don't need it, just wanted to know if it's specific to my setup or not, maybe qemu related...

Ok - I'll observe and report the behavior when Beta7 comes out and I do the install.  BTW do you mind sharing your conf.plist ?

  • Like 1
Link to comment
18 hours ago, ghost82 said:

Here it is, for latest opencore, some parts are REDACTED.

Some parts are customized with addresses referencing to my hardware addresses.

config.plist 26.49 kB · 3 downloads

I'm curious as to what benchmarks do you get on the VM.

I have an Intel i9-10850K (10 core 20 threads) with no overclock on the cores. I have allocated 8 threads to the VM and 16GB RAM iMacPro1,1.  The cores are isloated for use by the VM. and I am getting 1311 as the Single-Core Score and 7752 for Multi-Core Score in Geekbench5.

I got slight performance bump by 

  1. cat /sys/devices/system/clocksource/clocksource0/current_clocksource - changing the clocksource to tsc in bootmenu of the flash drive
  2. In the VM XML , allocating CPU threads consecutively (2,3,4,5,6,7,8) as opposed to allocating based on hyper-threaded pairs (2,12,3,13,4,14,5,15)

 

 

 

Edited by ab5g
  • Like 1
Link to comment
55 minutes ago, ab5g said:

I have an Intel i9-10850K (10 core 20 threads) with no overclock on the cores. I have allocated 8 threads to the VM and 16GB RAM iMacPro1,1.  The cores are isloated for use by the VM. and I am getting 1311 as the Single-Core Score and 7752 for Multi-Core Score in Geekbench5.

I think it's what you can expect.

 

My result with Geekbench 5.0.4, 14 cores+ht (28 threads), big sur 11.6 (just updated)

Single core: 603

Multicore: 7403

 

My cpu is older (yours: Q3 2020, mine Q1 2012), higher base frequency for yours (3.6 GHz vs 3.1 GHz), higher boost (5.2 GHz vs. 3.8 GHz).

 

Though my cpu was launched in 2012 is still good enough for me.

 

Depending on the os version single core performance ranges/ranged roughly from 600 to 700, multicore doesn't/didn't change too much.

Edited by ghost82
  • Like 1
Link to comment
1 hour ago, ghost82 said:

I think it's what you can expect.

 

My result with Geekbench 5.0.4, 14 cores+ht (28 threads), big sur 11.6 (just updated)

Single core: 603

Multicore: 7403

 

My cpu is older (yours: Q3 2020, mine Q1 2012), higher base frequency for yours (3.6 GHz vs 3.1 GHz), higher boost (5.2 GHz vs. 3.8 GHz).

 

Though my cpu was launched in 2012 is still good enough for me.

 

Depending on the os version single core performance ranges/ranged roughly from 600 to 700, multicore doesn't/didn't change too much.

 

Hmm, I have a baremetal install of Big Sur on an i9-9900k which gives me a single core perf of 5800+ and multicore near 39000 - I'm wondering if the low scores are normal or is it the KVM penalty or is it because the Geekbench lowers the score as it realizes its on a VM  ?

 

Edited by ab5g
Link to comment
2 minutes ago, ab5g said:

 

Hmm, I have a baremetal install of Big Sur on an i9-9900k which gives me a single core perf of 5800+ and multicore near 39000 - I'm wondering if the low scores are normal or is it the KVM penalty ?

 

 

Are you sure about these values?

Same version of geekbench? values change if version is different, I think I remember newer versions output higher values.

 

Bare metal:

https://browser.geekbench.com/processors/intel-core-i9-9900k

Edited by ghost82
Link to comment
23 minutes ago, ghost82 said:

 

Are you sure about these values?

Same version of geekbench? values change if version is different, I think I remember newer versions output higher values.

 

Bare metal:

https://browser.geekbench.com/processors/intel-core-i9-9900k

Gosh ! that was it. I was comparing the wrong versions. thank you

  • Geekbench 5 on Baremetal with i9-9900k is 1203 and 8068 on VM with i10-10850(8 threads) is 1311 and 7752  
  • Geekbench 4 on Baremetal with i9-9900k is 6310 and 35213 on VM with i10-10850(8 threads) is 6117  and 34138  
Link to comment
On 9/12/2021 at 10:30 PM, ghost82 said:

Thank you @ofawx I had the same issue in the past, the vm crashed sometime, when compiling in xcode with all cores near to 100%; after isolating the cpus and optimizing the xml the issue did not come back; anyway if it will come back I will know what to try.

 

I'm currently experiencing some issues with mac os updates, which I cannot track if it0s due to qemu or bootloader or configuration: for example, when performing an ota delta update, once finished the download, the os asks to restart, but it isn't fully rebooting after the first stage; the vm is running, this is what virsh is reporting, but the os is unable to start again, so I need to force the shutdown and boot again manually. After this, the next stages are completed automatically.

Anyone experiencing similar behavior?

I used to have this issue too which was also solved by the VTI trick. Maybe worth trying anyway?

  • Thanks 1
Link to comment
On 9/11/2021 at 9:03 AM, bjornatic said:

Since two days everything works now flawlessly. Before that, I was about seriously considering buying a mac mini...

 

Well... I spoke too soon. The KP as I wake macOS are back. Every time now. And this is the report I get :


mp_kdp_enter() timed-out on cpu 0, NMI-ing
mp_kdp_enter() NMI pending on cpus: 0 1 3 6 7
mp_kdp_enter() timed-out during locked wait after NMI;expected 8 acks but received 4 after 0 loops in 8192004096000 ticks

 

With few variations on CPUs number and count...

 

I tried with isolated CPU's and without, with vti=12, 9 or 14 : same problem.

 

And I really don't get why it worked two days in a row without a single issue (and during that time, the process : macOS sleep / unraid sleep / unraid wake / macOS wake happened at least 8 times (as I was testing it and not believing it was working...)

 

😭

 

Link to comment
10 minutes ago, bjornatic said:

macOS sleep / unraid sleep / unraid wake / macOS wake

Not sure about this, but in our mac os vms we cannot control power states of cpu, even if it's passed through..I was never able to get p and c states in mac os as in bare metal, so playing with states in both the guest and the os should not be recommended..

 

btw, are you mapping your usb ports?passedthrough usb controller(s)?

Edited by ghost82
Link to comment
14 hours ago, ghost82 said:

I just set it!I will see in the next installation/update.

Thank you!

 

Update: unfortunately, it doesn't fix the issue :(

 

I upgraded to 11.6 without the shutdown error you encountered. I made an observation that when the clocksource was tsc, the machine had random sleep/wake issues. Setting the clocksource to hpet for Unraid got rid of those issues for me (although I loose some performance in Geekbench). You can try and see if that gets rid of the shutdown error for you.

I'll observe the behavior when Beta6 comes out.  

 

  • Like 1
Link to comment
6 hours ago, bjornatic said:

 

Well... I spoke too soon. The KP as I wake macOS are back. Every time now. And this is the report I get :


mp_kdp_enter() timed-out on cpu 0, NMI-ing
mp_kdp_enter() NMI pending on cpus: 0 1 3 6 7
mp_kdp_enter() timed-out during locked wait after NMI;expected 8 acks but received 4 after 0 loops in 8192004096000 ticks

 

With few variations on CPUs number and count...

 

I tried with isolated CPU's and without, with vti=12, 9 or 14 : same problem.

 

And I really don't get why it worked two days in a row without a single issue (and during that time, the process : macOS sleep / unraid sleep / unraid wake / macOS wake happened at least 8 times (as I was testing it and not believing it was working...)

 

😭

 

Going by my own experience on this - I would recommend the following 

  1. Check to make sure your USB patches are correct. Did you copy the kext from somewhere and doesn't know how it works ? Here's an excellent resource to map your USB properly.- https://github.com/corpnewt/USBMap
  2. Check to make sure that whatever you inject as Kernel Properties in OC have the correct device path. You can use Hackintool then PCI to see the true device path of PCI devices and match that with what you are injecting. I realized that if you mess with the XML or change the machine type the device paths can change which in turn mess up with sleep wake.
  3. Check for errors in your config.plist. Compare with the sample on this page.
  4. Try adding tlbto_us=0 in the OC boot argument along with vti=12. Details here - https://www.nicksherlock.com/2020/08/solving-macos-vm-kernel-panics-on-heavily-loaded-proxmox-qemu-kvm-servers/
  5. Try CpuTscSync kext - it helps avoid crashes from certain wake-from-sleep scenarios. 
  6. Check the clocksource in Unraid here - cat /sys/devices/system/clocksource/clocksource0/current_clocksource. I got some stability by changing that to 'hpet' instead of 'tsc'. You can change that by adding a boot argument in the flash drive 'clocksource=hpet'.
  7. Isolate the cores that the VM runs on by adding a boot argument in the flash drive. Isolate and allocate cores consecutively (2,3,4,5,6,7,8) as opposed to isolating and allocating based on hyper-threaded pairs (2,12,3,13,4,14,5,15)
  • Like 2
Link to comment
11 hours ago, ghost82 said:

btw, are you mapping your usb ports?passedthrough usb controller(s)?

I'm passing though : GPU, nVme drive controller and usb controller (Fresco Logic FL1100 USB 3.0 Host Controller). And I'm only using the ports on the Fresco card... do I still need mapping  and USB patches ?

 

 

5 hours ago, ab5g said:

Going by my own experience on this - I would recommend the following 

...

 

Thanks ! I'll try what you suggest and I'll report back.

Link to comment
On 9/12/2021 at 2:30 PM, ghost82 said:

I'm currently experiencing some issues with mac os updates, which I cannot track if it0s due to qemu or bootloader or configuration: for example, when performing an ota delta update, once finished the download, the os asks to restart, but it isn't fully rebooting after the first stage; the vm is running, this is what virsh is reporting, but the os is unable to start again, so I need to force the shutdown and boot again manually. After this, the next stages are completed automatically.

 

It seems a bug in libvirt or qemu...libvirt 6.5.0+qemu 5.1.0 is ok (unraid 6.9.2).

Expect similar behavior with next versions if the issue isn't tracked upstream.

Edited by ghost82
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.