diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2014-01-30 13:34:02 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2014-01-30 13:34:02 +0000 |
commit | cd0351d287ff2e29551e6521dac615352044f633 (patch) | |
tree | f229a28f0c559bdb4f3d14185a933f387bdd493d /src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp | |
parent | 14971305fe92a2d403502110029d3446fff3bc14 (diff) | |
download | VirtualBox-svn-cd0351d287ff2e29551e6521dac615352044f633.tar.gz |
VBoxService: Fix CPU hotunplug code for newer kernels where the \'sysdev\' directory was changed to \'physical_node\'
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@50286 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp')
-rw-r--r-- | src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp index 5c480dd9fb8..7ac5fe082e5 100644 --- a/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp +++ b/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp @@ -120,6 +120,18 @@ SYSFSCPUPATH g_aAcpiCpuPath[] = /** Level 4 */ {ACPI_CPU_PATH_NOT_PROBED, g_aAcpiCpuPathLvl4, RT_ELEMENTS(g_aAcpiCpuPathLvl4), NULL, NULL}, }; + +/** + * Possible directories to get to the topology directory for reading core and package id. + * + * @remark: This is not part of the path above because the eject file is not in one of the directories + * below and would make the hot unplug code fail. + */ +const char *g_apszTopologyPath[] = +{ + "sysdev", + "physical_node" +}; #endif #ifdef RT_OS_LINUX @@ -277,10 +289,25 @@ static int VBoxServiceCpuHotPlugGetACPIDevicePath(char **ppszPath, uint32_t idCp if (iLvlCurr == RT_ELEMENTS(g_aAcpiCpuPath) - 1) { /* Get the sysdev */ - uint32_t idCore = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/core_id", - pszPathCurr); - uint32_t idPackage = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/physical_package_id", - pszPathCurr); + uint32_t idCore = 0; + uint32_t idPackage = 0; + + for (unsigned i = 0; i < RT_ELEMENTS(g_apszTopologyPath); i++) + { + int64_t i64Core = RTLinuxSysFsReadIntFile(10, "%s/%s/topology/core_id", + pszPathCurr, g_apszTopologyPath[i]); + int64_t i64Package = RTLinuxSysFsReadIntFile(10, "%s/%s/topology/physical_package_id", + pszPathCurr, g_apszTopologyPath[i]); + + if ( i64Core != -1 + && i64Package != -1) + { + idCore = (uint32_t)i64Core; + idPackage = (uint32_t)i64Package; + break; + } + } + if ( idCore == idCpuCore && idPackage == idCpuPackage) { |