Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU: Invalid CPU topology deprecated: sockets (0) * dies (1) * cores (8) * threads (1) != maxcpus (4) #248

Closed
taimaiduc opened this issue Apr 15, 2021 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@taimaiduc
Copy link

OS related issued, please help us identify the issue by posting the output of this

image

Running

docker run -it \
    --cpus=12 \
    --device /dev/kvm \
    -p 50922:10022 \
    -v "${PWD}/macos.img:/image" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e RAM=16 \
    -e CORES=8 \
    sickcodes/docker-osx:naked

egrep -c '(svm|vmx)' /proc/cpuinfo
12

ERROR

+ exec qemu-system-x86_64 -m 16000 -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 -device usb-kbd -device usb-tablet -device 'isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' -drive if=pflash,format=raw,readonly,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 alsa,id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore-Catalina/OpenCore-nopicker.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -drive id=MacHDD,if=none,file=/image,format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD -netdev user,id=net0,hostfwd=tcp::10022-:22,hostfwd=tcp::5900-:5900, -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17 -monitor stdio -vga vmware
qemu-system-x86_64: Invalid CPU topology deprecated: sockets (0) * dies (1) * cores (8) * threads (1) != maxcpus (4)
@sickcodes
Copy link
Owner

This should clear up the CPU limit questions https://github.com/kholia/OSX-KVM/blob/master/notes.md#pass-through-all-cpu-cores--threads

@sickcodes
Copy link
Owner

Via @kholia

Pass through all CPU cores / threads

macOS requires a core count that is a power of 2, but some modern CPUs have odd
counts - like 6 cores and 12 threads.

So how can we harness the entire CPU in the VM?

There are strategies that mix smp/sockets/cores/threads/maxcpu arguments and
use odd socket counts to arrive at even core counts, and even let you specify
that some of the cores are hyperthreaded.

Specifically for the case of an Intel i7 processor with 6 cores and 12 total
threads, altering the boot script to contain these variables and the following
modified SMP line results in a full CPU core/thread pass through:

CPU_SOCKETS="3"
CPU_CORES="2"
CPU_THREADS="2"
CPU_TOTAL="12"

The -smp line should read something like the following:

-smp "$CPU_TOTAL",cores="$CPU_CORES",sockets="$CPU_SOCKETS",threads="$CPU_THREADS",maxcpus="$CPU_TOTAL"

@sickcodes sickcodes mentioned this issue Apr 15, 2021
@taimaiduc taimaiduc changed the title CPU: Invalid CPU topology deprecated: sockets (0) * dies (1) * cores (8) * threads (1) != maxcpus (4) ``` CPU: Invalid CPU topology deprecated: sockets (0) * dies (1) * cores (8) * threads (1) != maxcpus (4) Apr 15, 2021
@sickcodes sickcodes added bug Something isn't working help wanted Extra attention is needed documentation Improvements or additions to documentation and removed bug Something isn't working help wanted Extra attention is needed labels Apr 15, 2021
@sickcodes
Copy link
Owner

@taimaiduc did you want to add documentation or a link via PR about the CPU topology? Glad to see you got it working!

@taimaiduc
Copy link
Author

Hi @sickcodes
Error
CPU_SOCKETS="3"
CPU_CORES="2"
CPU_THREADS="2"
CPU_TOTAL="12"

qemu-system-x86_64: Invalid CPU topology deprecated: sockets (3) * dies (1) * cores (4) * threads (2) != maxcpus (12)

I am running this command and it will be working

docker run -it \
    --cpus=12 \
    --device /dev/kvm \
    -p 50922:10022 \
    -v "${PWD}/macos.img:/image" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e RAM=16 \
    -e SMP="12",cores="2",sockets="3",threads="1",maxcpus="12" \
    sickcodes/docker-osx:naked

=>>>>
CPU_SOCKETS="3"
CPU_CORES="2"
CPU_THREADS="1"
CPU_TOTAL="12"

image

Not sure that is the correct or not

What do you think? @sickcodes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants