Opened 4 years ago
Closed 4 years ago
#19903 closed defect (fixed)
VBoxService CPU hotplug brings always cpu1 online regardless of plugged CPU => fixed in SVN/next maintenance
Reported by: | musteresel | Owned by: | |
---|---|---|---|
Component: | guest additions | Version: | VirtualBox 6.1.6 |
Keywords: | hotplug | Cc: | |
Guest type: | Linux | Host type: | Linux |
Description
The code to bring a newly plugged CPU online is seriously wrong, textual description of what is done there:
- Lists all files under /sys/devices/system/cpu
- Iterates over these, one after the other
- If current file name starts with "cpu" but is not "cpu0" nor "cpuidle", then
- Tries to open /sys/devices/system/cpu/FILENAME/online and write 1 to it
- If that succeeds (for ONE single file), calls it a day and returns.
Actual code is here: https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp#L449
Assuming (?) that the directory listing is sorted by name, this will always put cpu1 (and only that!) online.
---
Stumbled over this while trying to find out why my CPU (cpu2 ... cpu1 comes before that in the directory listing) isn't online prior to getting it back offline (https://www.virtualbox.org/ticket/19902)
Change History (5)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Thanks for the report, should be fixed in the next maintenance release. There is a new testbuild available on Testbuilds, >= r140448. You only need to update the guest additions if you want to try it out. I decided against turning potentially all CPUs on to find the one with the matching topology as it could induce quite some load for VMs with many CPUs, instead the first offline CPU found is being enabled. I couldn't find a way to get the CPU topology from an offline CPU so far, not even when running in the kernel.
comment:3 by , 4 years ago
Summary: | VBoxService CPU hotplug brings always cpu1 online regardless of plugged CPU → VBoxService CPU hotplug brings always cpu1 online regardless of plugged CPU => fixed in SVN/next maintenance |
---|
comment:4 by , 4 years ago
Yes, test build fixes this. I'm looking whether I can find a way to get the topology of an offline cpu and let you know if I find something!
Suggestion for a better approach:
If necessary one could also look through the currently online CPUs to see if the hotplugged CPU is there already.
If there's interest I can make a patch. I'm not sure about the support of the various files across Linux kernel versions, however. Also perhaps there is a way to get the topology of an offline CPU without turning it on?