lima
lima copied to clipboard
VM fails to start on M1 CPU when CPU cores set to more than the host has
Description
Greetings,
I recently discovered why https://github.com/abiosoft/colima was taking so long to start on an M1, and recently refused to start at all. The symptom I had been observing was a seeming timeout. I would see lots of logs with Waiting for the essential requirement 1 of 3: "ssh" printed to the terminal, and then ultimately it would bail out saying that ssh never came up (I assume this is a timeout.)
It turned out that if you set the number of CPU cores that the guest uses to be higher than the number of cores the M1 has, you end up with devastating performance. I had assumed incorrectly that the M1 had SMT, and so I had set the guest to use 16 cores since the M1 I use has 8 physical cores (plus 2 low power cores).
I am unsure if it is slow because it starts to use the low power cores, or if it's just a bug in the hypervisor, or both.
I have a few suggestions as to how lima could help users like me who make such poor assumptions, and all of them involve detecting the number of threads supported by the physical hardware:
- Log a warning if the user configured more cores than the hardware supports.
- Exit with an error if the user configured more cores than the hardware supports.
- Correct to
min(num_cores_detected, num_cores_requested)and log a warning.
This is MacOS 13.4 with vz virtualization.
Correct to min(num_cores_detected, num_cores_requested) and log a warning.
SGTM
Hello, my friend @BajuMcBites and I are students at UT Austin and after taking a virtualization class, we wanted to contribute to this project. Could we be assigned this issue? Thanks.
Could we be assigned this issue?
I've assigned the issue to you; I couldn't add your friend; maybe they need to comment on the issue first? Anyways, it doesn't matter; just create a PR and we can discuss from there.
Hello, I am @NotPranav0's partner. Thanks.
Hello, I am @NotPranav0's partner.
Thanks, that seems to have enabled it. I've assigned you as well now.
Hey, we've managed to figure out the issue. Can we just make a new branch and submit a PR?
Hey, we've managed to figure out the issue. Can we just make a new branch and submit a PR?
Yes, please, thanks