Just wondering, is it possible to allocate more cores?
Originally created by @sanderfoobar on GitHub (Oct 1, 2020).
Starting with:
```
docker run --device /dev/kvm --device /dev/snd -e CORES=8 -e RAM=10 -p 8888:5999 -p 50922:10022 -d --privileged docker-osx-vnc:latest
```
Does not start the VM. QEMU args (truncated):
```
qemu-system-x86_64 -m 10000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check -machine q35,accel=kvm:tcg -smp 4,cores=8 -usb[...]
```
`CORES=4` works.
Just wondering, is it possible to allocate more cores?
I actually don't know the SMP, cores, sockets situation. I'll play around with it in virt-manager and come back with more info.
Someone else, or a QEMU whizz, would be better to answer this than me.
@sickcodes commented on GitHub (Oct 6, 2020):
I actually don't know the SMP, cores, sockets situation. I'll play around with it in virt-manager and come back with more info.
Someone else, or a QEMU whizz, would be better to answer this than me.
Just wondering, is it possible to allocate more cores?
You could try -smp 16,cores=16,threads=1,sockets=1 and it means the vm will use 16 phsical CPU cores, 16 logic cores. I managed to run macOS vm with the paramter above. I also tried -smp 32,cores=16,threads=2,sockets=1 but macOS stuck after running several hours and cannot recover by itself. I guess qemu/clover may not be able to work well with the threads parameter greater than 1.
@iedwin commented on GitHub (Nov 23, 2020):
> Starting with:
>
> ```
> docker run --device /dev/kvm --device /dev/snd -e CORES=8 -e RAM=10 -p 8888:5999 -p 50922:10022 -d --privileged docker-osx-vnc:latest
> ```
>
> Does not start the VM. QEMU args (truncated):
>
> ```
> qemu-system-x86_64 -m 10000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check -machine q35,accel=kvm:tcg -smp 4,cores=8 -usb[...]
> ```
>
> `CORES=4` works.
>
> Just wondering, is it possible to allocate more cores?
You could try -smp 16,cores=16,threads=1,sockets=1 and it means the vm will use 16 phsical CPU cores, 16 logic cores. I managed to run macOS vm with the paramter above. I also tried -smp 32,cores=16,threads=2,sockets=1 but macOS stuck after running several hours and cannot recover by itself. I guess qemu/clover may not be able to work well with the threads parameter greater than 1.
I ran Passmark (cli) benchmark on the Linux host and the macos guest and saw big improvements with SMP/threads.
After I set SMP=8 and threads=2, with default CORES=4 Passmark reported twice the guest performance. I don't know if threads is needed or if qemu can figure that out automatically from SMP.
Host cpu is pretty high still pretty high (10%) even when the guest is idle: Load Avg: 0.36, 0.49, 0.53 CPU usage: 0.23% user, 0.59% sys, 99.16% idle SharedLibs: 448M resident, 76M data, 59M linkedit.
This has been pretty consistent no matter how many CPUs the guest has.
@jpmorrison commented on GitHub (Oct 15, 2021):
I ran Passmark (cli) benchmark on the Linux host and the macos guest and saw big improvements with SMP/threads.
After I set SMP=8 and threads=2, with default CORES=4 Passmark reported twice the guest performance. I don't know if threads is needed or if qemu can figure that out automatically from SMP.
Host cpu is pretty high still pretty high (10%) even when the guest is idle:
`
Load Avg: 0.36, 0.49, 0.53 CPU usage: 0.23% user, 0.59% sys, 99.16% idle SharedLibs: 448M resident, 76M data, 59M linkedit.
`
This has been pretty consistent no matter how many CPUs the guest has.
Thanks for the tip @jpmorrison, do you want to add your findings to the CPU in the README or create a more detailed bit? I'd be happy to later this week, unless you would like to add some notes :)
@sickcodes commented on GitHub (Oct 18, 2021):
Thanks for the tip @jpmorrison, do you want to add your findings to the CPU in the README or create a more detailed bit? I'd be happy to later this week, unless you would like to add some notes :)
Here's my Launch.sh (as-is). I've learned a lot from @sickcodes quickemu and various qemu/kvm pages.
CPU
threads: need to have threads=SMP/CORES. I've hard coded for now. Qemu won't start if the math doesn't add up.
Passmark has cli based linux and macos benchmarks that are useful for checking performance. SMP=8 CORE=4,threads=2 is definitely better than 4/4/1. Maybe 8/8/1 is better/worse/no difference.
OpenSSL can test aes crypto acceleration. Passmark tests SSE already - need other benchmarks that work on both host/guest.
Initially I suspected performance issues with Qemu/KVM but I think I have ruled that out. If you need maximum performance then pass all the cores/threads and Passmark will reflect that.
I'm using CPU=kvm64 but quickemu uses host. Worth trying host especially if you have a new CPU. Mine's old and still boots Catalina.
VirtIO
Don't bother with virtio with CoreBoot. I'm just testing it. It works but forgets to boot off of MacHDD.
qxl: video glitches at boot but you can change resolution in guest System Preferences.
I was using -vga virtio before - might work better for some. I don't think it supports System Preferences. Toss up performance wise.
virtio mouse/keyboard: not sure if this adds anything
virtioserial is used for Spice vdagent, webdav, USB redirection and Qemu guest agent.
usb-ehci is needed for Catalina USB redirection from Spice remote-viewer. Newer can use qemu-xhci.
virtio-net-pci works in Big Sur according to quickemu. The kext loads in Catalina but doesn't work properly. Might work as a second nic though.
Guest
Inside the guest run sudo mount_9p NFS for the public file sharing. Host side permissions should be 777. This works and seems faster than using a network share mounted from the guest. Need to see if this can be automated through the qemu guest agent.
vdagent: is used for spice file sharing/clipboard. The chardev setup is for spice, @kraxel's blog says qemu has its own vdagent now which could be useful for vnc/X11 clipboard.
Unfortunately there's no MacOS spice-vdagent - yet. I'm trying to compile the linux version with macports/gtk but there's a bunch of linuxisms including alsa. I'll create a repository when it's further along.
cat /dev/tty.com.redhat.spice.0 in the guest sets seamless mouse in spice remote-viewer and echoes mouse movement. Interesting but currently useless until vdagent is ported.
/dev/tty.org.spice-space.webdav.0 spice file sharing with freedesktop phodav - need to look at porting. mount_webdav is already in Catalina
Qemu guest agent: I exposed this because guestagent.log was filling up with errors from AppleQEMUGuestAgent. I didn't do anything in Catalina to start this so maybe passing +hypervisor or CPU=kvm64 triggers this.
AppleQEMUGuestAgent has apple-guest-set-remote-login apple-working-directory apple-stdin and other stuff I assume are Apple extensions. AppleVirtIOConsole IOSerialBSDClient makes me wonder about connecting another virtioserial for console. Useful for kernel debugging?
Qemu guest agent can send commands to the guest but I don't know how to use it. It would be nice to expose more functions and virt-manager features so you can hotplug devices etc. The chardev setup is probably out of date for this version of qemu, Qemu docs mention a different way to setup the host side. Unclear/conflicting docs here unfortunately.
# errors and launchd complaints stopped exposing /dev/tty.org.qemu.guest_agent.0
tail /var/log/guestagent.log
Mon Oct 18 04:10:05 2021 AppleQEMUGuestAgent 1.3-AppleVirtIO-16.140.6~70 (JazzSecuritySky tools)
Mon Oct 18 04:10:05 2021 Error opening serial port: '/dev/tty.org.qemu.guest_agent.0' (No such file or directory)
Mon Oct 18 04:10:06 2021 AppleQEMUGuestAgent 1.3-AppleVirtIO-16.140.6~70 (JazzSecuritySky tools)
ps -ef | grep -i qemu
0 252 1 0 Mon04AM ?? 0:00.01 /usr/libexec/AppleQEMUGuestAgent
USB redirection (Spice)
So far only works (for me) with usb flash drives and Android adb shell
iPhone/iPod/Android pass through to Catalina but don't show up in Finder. Need to make sense of Catalina error logs.
Qemu issues too? Need to look into these messages: qemu-system-x86_64: usb-redir error:
Windows remote-viewer: needs usb support installed separately. Some devices won't redirect 'rejected by host' and might need additional setup. I think some devices are blacklisted so you don't lock yourself out redirecting your keyboard!
Linux: can't redirect a device already in use. You may have to blacklist modules or shutdown services like usbmuxd. Check permissions.
Some devices don't redirect on USB3 ports. Try a USB2 port, at least with Catalina/USB2
Launch.sh
#!/bin/bash
set -eux
sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true
RAM=half
EXTRA="-nographic -spice disable-ticketing,port=3001,disable-copy-paste=off,disable-agent-file-xfer=off -enable-kvm"
CPU=kvm64
SMP=8
# CPUID flags: these might not be needed with CPU=host used by quickemu, Haven't tested.
# Qemu recommends +pdpe1gb,+pcid
# Kholia recommends +vmx,+rdtscp
# Forgot who suggested +hypervisor - it might be what enables /usr/libexec/AppleQEMUGuestAgent
# Other flags don't seem to help if they work, and qemu ignores others.
CPUID_FLAGS="vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,+hypervisor,+pcid,+pdpe1gb,+pclmulqdq,+vmx,+rdtscp,+tsc-deadline,+ss,+ds-cpl,+dtes64,+pdcm,+xtpr,+vmx-unrestricted-guest,+vmx-vintr-pending,check"
# Share a directory to the guest
# security_model=none for NFS and root_squash otherwise the guest can't create files
# security_model=mapped-xattr can be used with local filesystem
#PUBLIC=/test
PUBLIC=/mnt
PUBLIC_TAG="NFS"
sudo mount -t nfs 172.17.0.1:/exports/vm /mnt
AUDIO_DRIVER="spice"
# Virtio-net has too many issues in Catalina
#NETWORKING=virtio-net-pci
[[ "${RAM}" = max ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 1000000"))"
[[ "${RAM}" = half ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 2000000"))"
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true
exec qemu-system-x86_64 -m ${RAM:-2}000 \
-cpu ${CPU:-Penryn},${CPUID_FLAGS:-vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,+hypervisor,+pcid,+pdpe1gb,+pclmulqdq,check,}${BOOT_ARGS} \
-machine q35,${KVM-"accel=kvm:tcg"} \
-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4},threads=2} \
-usb -device usb-kbd -device usb-mouse \
-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \
-drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd \
-smbios type=2 \
-audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \
-drive id=OpenCoreBoot,if=virtio,snapshot=on,format=qcow2,file=${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2} \
-drive id=InstallMedia,if=virtio,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \
-drive id=MacHDD,if=virtio,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=${IMAGE_FORMAT:-qcow2} \
-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900,${ADDITIONAL_PORTS} \
-device ${NETWORKING:-vmxnet3},netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \
-device virtio-serial-pci \
-chardev spicevmc,id=vdagent0,name=vdagent \
-device virtserialport,chardev=vdagent0,name=com.redhat.spice.0 \
-device virtio-mouse \
-device virtio-keyboard \
-monitor stdio \
-boot menu=on \
-device qxl \
-serial none \
-fsdev local,id=fsdev0,path=${PUBLIC},security_model=none -device virtio-9p-pci,fsdev=fsdev0,mount_tag=${PUBLIC_TAG} \
-device usb-ehci,id=spicepass \
-chardev spicevmc,id=usbredirchardev1,name=usbredir \
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
-chardev spicevmc,id=usbredirchardev2,name=usbredir \
-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
-chardev spicevmc,id=usbredirchardev3,name=usbredir \
-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 \
-chardev spiceport,id=webdav0,name=org.spice-space.webdav.0 \
-device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0 \
-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
${EXTRA:-}
(END)
@jpmorrison commented on GitHub (Oct 19, 2021):
Here's my Launch.sh (as-is). I've learned a lot from @sickcodes quickemu and various qemu/kvm pages.
# CPU
- threads: need to have threads=SMP/CORES. I've hard coded for now. Qemu won't start if the math doesn't add up.
- Passmark has cli based linux and macos benchmarks that are useful for checking performance. SMP=8 CORE=4,threads=2 is definitely better than 4/4/1. Maybe 8/8/1 is better/worse/no difference.
- OpenSSL can test aes crypto acceleration. Passmark tests SSE already - need other benchmarks that work on both host/guest.
- Initially I suspected performance issues with Qemu/KVM but I think I have ruled that out. If you need maximum performance then pass all the cores/threads and Passmark will reflect that.
- I'm using CPU=kvm64 but quickemu uses host. Worth trying host especially if you have a new CPU. Mine's old and still boots Catalina.
# VirtIO
- Don't bother with virtio with CoreBoot. I'm just testing it. It works but forgets to boot off of MacHDD.
- qxl: video glitches at boot but you can change resolution in guest System Preferences.
- I was using -vga virtio before - might work better for some. I don't think it supports System Preferences. Toss up performance wise.
- virtio mouse/keyboard: not sure if this adds anything
- virtioserial is used for Spice vdagent, webdav, USB redirection and Qemu guest agent.
- usb-ehci is needed for Catalina USB redirection from Spice remote-viewer. Newer can use qemu-xhci.
- virtio-net-pci works in Big Sur according to quickemu. The kext loads in Catalina but doesn't work properly. Might work as a second nic though.
# Guest
- Inside the guest run `sudo mount_9p NFS` for the public file sharing. Host side permissions should be 777. This works and seems faster than using a network share mounted from the guest. Need to see if this can be automated through the qemu guest agent.
- vdagent: is used for spice file sharing/clipboard. The chardev setup is for spice, @kraxel's blog says qemu has its own vdagent now which could be useful for vnc/X11 clipboard.
- Unfortunately there's no MacOS spice-vdagent - yet. I'm trying to compile the linux version with macports/gtk but there's a bunch of linuxisms including alsa. I'll create a repository when it's further along.
- `cat /dev/tty.com.redhat.spice.0` in the guest sets seamless mouse in spice remote-viewer and echoes mouse movement. Interesting but currently useless until vdagent is ported.
- `/dev/tty.org.spice-space.webdav.0` spice file sharing with freedesktop phodav - need to look at porting. `mount_webdav` is already in Catalina
- Qemu guest agent: I exposed this because guestagent.log was filling up with errors from AppleQEMUGuestAgent. I didn't do anything in Catalina to start this so maybe passing +hypervisor or CPU=kvm64 triggers this.
- AppleQEMUGuestAgent has `apple-guest-set-remote-login apple-working-directory apple-stdin` and other stuff I assume are Apple extensions. `AppleVirtIOConsole IOSerialBSDClient` makes me wonder about connecting another virtioserial for console. Useful for kernel debugging?
- Qemu guest agent can send commands to the guest but I don't know how to use it. It would be nice to expose more functions and virt-manager features so you can hotplug devices etc. The chardev setup is probably out of date for this version of qemu, Qemu docs mention a different way to setup the host side. Unclear/conflicting docs here unfortunately.
```
# errors and launchd complaints stopped exposing /dev/tty.org.qemu.guest_agent.0
tail /var/log/guestagent.log
Mon Oct 18 04:10:05 2021 AppleQEMUGuestAgent 1.3-AppleVirtIO-16.140.6~70 (JazzSecuritySky tools)
Mon Oct 18 04:10:05 2021 Error opening serial port: '/dev/tty.org.qemu.guest_agent.0' (No such file or directory)
Mon Oct 18 04:10:06 2021 AppleQEMUGuestAgent 1.3-AppleVirtIO-16.140.6~70 (JazzSecuritySky tools)
ps -ef | grep -i qemu
0 252 1 0 Mon04AM ?? 0:00.01 /usr/libexec/AppleQEMUGuestAgent
```
# USB redirection (Spice)
- So far only works (for me) with usb flash drives and Android `adb shell`
- iPhone/iPod/Android pass through to Catalina but don't show up in Finder. Need to make sense of Catalina error logs.
- Qemu issues too? Need to look into these messages: `qemu-system-x86_64: usb-redir error:`
- Windows remote-viewer: needs usb support installed separately. Some devices won't redirect 'rejected by host' and might need additional setup. I think some devices are blacklisted so you don't lock yourself out redirecting your keyboard!
- Linux: can't redirect a device already in use. You may have to blacklist modules or shutdown services like usbmuxd. Check permissions.
- Some devices don't redirect on USB3 ports. Try a USB2 port, at least with Catalina/USB2
# Launch.sh
```
#!/bin/bash
set -eux
sudo chown $(id -u):$(id -g) /dev/kvm 2>/dev/null || true
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true
RAM=half
EXTRA="-nographic -spice disable-ticketing,port=3001,disable-copy-paste=off,disable-agent-file-xfer=off -enable-kvm"
CPU=kvm64
SMP=8
# CPUID flags: these might not be needed with CPU=host used by quickemu, Haven't tested.
# Qemu recommends +pdpe1gb,+pcid
# Kholia recommends +vmx,+rdtscp
# Forgot who suggested +hypervisor - it might be what enables /usr/libexec/AppleQEMUGuestAgent
# Other flags don't seem to help if they work, and qemu ignores others.
CPUID_FLAGS="vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,+hypervisor,+pcid,+pdpe1gb,+pclmulqdq,+vmx,+rdtscp,+tsc-deadline,+ss,+ds-cpl,+dtes64,+pdcm,+xtpr,+vmx-unrestricted-guest,+vmx-vintr-pending,check"
# Share a directory to the guest
# security_model=none for NFS and root_squash otherwise the guest can't create files
# security_model=mapped-xattr can be used with local filesystem
#PUBLIC=/test
PUBLIC=/mnt
PUBLIC_TAG="NFS"
sudo mount -t nfs 172.17.0.1:/exports/vm /mnt
AUDIO_DRIVER="spice"
# Virtio-net has too many issues in Catalina
#NETWORKING=virtio-net-pci
[[ "${RAM}" = max ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 1000000"))"
[[ "${RAM}" = half ]] && export RAM="$(("$(head -n1 /proc/meminfo | tr -dc "[:digit:]") / 2000000"))"
sudo chown -R $(id -u):$(id -g) /dev/snd 2>/dev/null || true
exec qemu-system-x86_64 -m ${RAM:-2}000 \
-cpu ${CPU:-Penryn},${CPUID_FLAGS:-vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,+hypervisor,+pcid,+pdpe1gb,+pclmulqdq,check,}${BOOT_ARGS} \
-machine q35,${KVM-"accel=kvm:tcg"} \
-smp ${CPU_STRING:-${SMP:-4},cores=${CORES:-4},threads=2} \
-usb -device usb-kbd -device usb-mouse \
-device isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal\(c\)AppleComputerInc \
-drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd \
-smbios type=2 \
-audiodev ${AUDIO_DRIVER:-alsa},id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda \
-drive id=OpenCoreBoot,if=virtio,snapshot=on,format=qcow2,file=${BOOTDISK:-/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore.qcow2} \
-drive id=InstallMedia,if=virtio,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 \
-drive id=MacHDD,if=virtio,file=${IMAGE_PATH:-/home/arch/OSX-KVM/mac_hdd_ng.img},format=${IMAGE_FORMAT:-qcow2} \
-netdev user,id=net0,hostfwd=tcp::${INTERNAL_SSH_PORT:-10022}-:22,hostfwd=tcp::${SCREEN_SHARE_PORT:-5900}-:5900,${ADDITIONAL_PORTS} \
-device ${NETWORKING:-vmxnet3},netdev=net0,id=net0,mac=${MAC_ADDRESS:-52:54:00:09:49:17} \
-device virtio-serial-pci \
-chardev spicevmc,id=vdagent0,name=vdagent \
-device virtserialport,chardev=vdagent0,name=com.redhat.spice.0 \
-device virtio-mouse \
-device virtio-keyboard \
-monitor stdio \
-boot menu=on \
-device qxl \
-serial none \
-fsdev local,id=fsdev0,path=${PUBLIC},security_model=none -device virtio-9p-pci,fsdev=fsdev0,mount_tag=${PUBLIC_TAG} \
-device usb-ehci,id=spicepass \
-chardev spicevmc,id=usbredirchardev1,name=usbredir \
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
-chardev spicevmc,id=usbredirchardev2,name=usbredir \
-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
-chardev spicevmc,id=usbredirchardev3,name=usbredir \
-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3 \
-chardev spiceport,id=webdav0,name=org.spice-space.webdav.0 \
-device virtserialport,chardev=webdav0,name=org.spice-space.webdav.0 \
-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
${EXTRA:-}
(END)
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @sanderfoobar on GitHub (Oct 1, 2020).
Starting with:
Does not start the VM. QEMU args (truncated):
CORES=4works.Just wondering, is it possible to allocate more cores?
@sickcodes commented on GitHub (Oct 6, 2020):
I actually don't know the SMP, cores, sockets situation. I'll play around with it in virt-manager and come back with more info.
Someone else, or a QEMU whizz, would be better to answer this than me.
@iedwin commented on GitHub (Nov 23, 2020):
You could try -smp 16,cores=16,threads=1,sockets=1 and it means the vm will use 16 phsical CPU cores, 16 logic cores. I managed to run macOS vm with the paramter above. I also tried -smp 32,cores=16,threads=2,sockets=1 but macOS stuck after running several hours and cannot recover by itself. I guess qemu/clover may not be able to work well with the threads parameter greater than 1.
@jpmorrison commented on GitHub (Oct 15, 2021):
I ran Passmark (cli) benchmark on the Linux host and the macos guest and saw big improvements with SMP/threads.
After I set SMP=8 and threads=2, with default CORES=4 Passmark reported twice the guest performance. I don't know if threads is needed or if qemu can figure that out automatically from SMP.
Host cpu is pretty high still pretty high (10%) even when the guest is idle:
Load Avg: 0.36, 0.49, 0.53 CPU usage: 0.23% user, 0.59% sys, 99.16% idle SharedLibs: 448M resident, 76M data, 59M linkedit.This has been pretty consistent no matter how many CPUs the guest has.
@sickcodes commented on GitHub (Oct 18, 2021):
Thanks for the tip @jpmorrison, do you want to add your findings to the CPU in the README or create a more detailed bit? I'd be happy to later this week, unless you would like to add some notes :)
@jpmorrison commented on GitHub (Oct 19, 2021):
Here's my Launch.sh (as-is). I've learned a lot from @sickcodes quickemu and various qemu/kvm pages.
CPU
VirtIO
Guest
sudo mount_9p NFSfor the public file sharing. Host side permissions should be 777. This works and seems faster than using a network share mounted from the guest. Need to see if this can be automated through the qemu guest agent.cat /dev/tty.com.redhat.spice.0in the guest sets seamless mouse in spice remote-viewer and echoes mouse movement. Interesting but currently useless until vdagent is ported./dev/tty.org.spice-space.webdav.0spice file sharing with freedesktop phodav - need to look at porting.mount_webdavis already in Catalinaapple-guest-set-remote-login apple-working-directory apple-stdinand other stuff I assume are Apple extensions.AppleVirtIOConsole IOSerialBSDClientmakes me wonder about connecting another virtioserial for console. Useful for kernel debugging?USB redirection (Spice)
adb shellqemu-system-x86_64: usb-redir error:Launch.sh