Opened 7 years ago
Last modified 7 years ago
#17045 new defect
"vboxmanage list hostinfo" fails if CPUs have gaps in their processor IDs.
Reported by: | Thorsten Schöning | Owned by: | |
---|---|---|---|
Component: | host support | Version: | VirtualBox 5.1.26 |
Keywords: | Cc: | ||
Guest type: | other | Host type: | Linux |
Description
I have a server containing two Intel(R) Xeon(R) CPU X5675[1] @ 3.07GHz with 6 physical cores each and hyperthreading enabled, which results in 24 processors in total. Running "vboxmanage list hostinfo" results in the following shortened output:
VBoxManage: error: Code NS_ERROR_FAILURE (0x80004005) - Operation failed (extended info not available) VBoxManage: error: Context: "GetProcessorDescription(i, processorDescription.asOutParam())" at line 241 of file VBoxManageList.cpp VBoxManage: error: Code NS_ERROR_FAILURE (0x80004005) - Operation failed (extended info not available) VBoxManage: error: Context: "GetProcessorDescription(i, processorDescription.asOutParam())" at line 241 of file VBoxManageList.cpp VBoxManage: error: Code NS_ERROR_FAILURE (0x80004005) - Operation failed (extended info not available) VBoxManage: error: Context: "GetProcessorDescription(i, processorDescription.asOutParam())" at line 241 of file VBoxManageList.cpp VBoxManage: error: Code NS_ERROR_FAILURE (0x80004005) - Operation failed (extended info not available) VBoxManage: error: Context: "GetProcessorDescription(i, processorDescription.asOutParam())" at line 241 of file VBoxManageList.cpp Host Information: Host time: 2017-08-29T09:42:55.061000000Z Processor online count: 24 Processor count: 24 Processor online core count: 12 Processor core count: 12 Processor supports HW virtualization: yes Processor supports PAE: yes Processor supports long mode: yes Processor supports nested paging: yes Processor#0 speed: 3066 MHz Processor#0 description: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz Processor#1 speed: 3066 MHz [...] Processor#11 speed: 3066 MHz Processor#11 description: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz Processor#12 speed: unknown Processor#12 description: Processor#13 speed: unknown Processor#13 description: Processor#14 speed: unknown Processor#14 description: Processor#15 speed: unknown Processor#15 description: Processor#16 speed: 3066 MHz Processor#16 description: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz [...] Processor#23 speed: 3066 MHz Processor#23 description: Intel(R) Xeon(R) CPU X5675 @ 3.07GHz Memory size: 145055 MByte Memory available: 143530 MByte Operating system: Linux Operating system version: 4.10.0-33-generic
As you can see, while the overall number of processors is known, the command fails to retrieve the description of some of those. The reason is pretty simple: The implementation uses a loop to iterate all processor IDs and fails, because my IDs have gaps. Look at the following output of lscpu:
NUMA node0 CPU(s): 0,2,4,6,8,10,16,18,20,22,24,26 NUMA node1 CPU(s): 1,3,5,7,9,11,17,19,21,23,25,27
The following is the implementation of VBoxManageList.cpp:
static HRESULT listHostInfo(const ComPtr<IVirtualBox> pVirtualBox) { [...] Bstr processorDescription; for (ULONG i = 0; i < processorCount; i++) { CHECK_ERROR(Host, GetProcessorSpeed(i, &processorSpeed)); if (processorSpeed) RTPrintf("Processor#%u speed: %lu MHz\n", i, processorSpeed); else RTPrintf("Processor#%u speed: unknown\n", i); CHECK_ERROR(Host, GetProcessorDescription(i, processorDescription.asOutParam())); RTPrintf("Processor#%u description: %ls\n", i, processorDescription.raw()); } [...] }
12, 13, 14 and 15 are not used currently and I'm pretty sure that I don't have any influence on those IDs. Have double-checked the BIOS and from what I've researched on the topic on how those IDs are assigned, I have the feeling that this is really some attribute of the CPUs itself and only used by the Linux kernel, not assigned. So gaps in those IDs should be a valid use case:
The x2APIC id space is not continuously mapped to logical processors however; there can be gaps in the mapping, meaning that some intermediate x2APIC ids don't necessarily correspond to any logical processor.
https://en.wikipedia.org/wiki/CPUID#EAX.3D4_and_EAX.3DBh:_Intel_thread.2Fcore_and_cache_topology
c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) & ((1 << core_bits) - 1);
http://elixir.free-electrons.com/linux/v4.0.9/source/arch/x86/kernel/cpu/common.c#L546
http://elixir.free-electrons.com/linux/v4.0.9/source/arch/x86/include/asm/processor.h#L114
With 8-core CPUs in mind, the gap of 2 per CPU might even make sense, because it's one additional core with hyperthreading, while the other core might simply be added at the end of the IDs.
So it seems using a loop might be a bit too naive and needs to be reworked to really use the available CPU IDs. I didn't came across any other errors like this one for now and hosting some VMs it looks like all CPUs are used by VirtualBox properly.
[1]: https://ark.intel.com/de/products/52577/Intel-Xeon-Processor-X5675-12M-Cache-3_06-GHz-6_40-GTs-Intel-QPI
Attachments (3)
Change History (4)
by , 7 years ago
Attachment: | cpuinfo.txt added |
---|
comment:1 by , 7 years ago
phpVirtualBox has a similar issue and other CPUs than mine are mentioned there, so it's pretty likely that it's really not my misconfiguration:
Xeon E5620
https://github.com/phpvirtualbox/phpvirtualbox/issues/53
Xeon L5520
cpuinfo