diff --git a/plugins/dynamix.vm.manager/include/libvirt.php b/plugins/dynamix.vm.manager/include/libvirt.php index 80233d5be..e8c07c32b 100644 --- a/plugins/dynamix.vm.manager/include/libvirt.php +++ b/plugins/dynamix.vm.manager/include/libvirt.php @@ -321,11 +321,22 @@ $intCPUThreadsPerCore = 1; $cpumode = ''; + $cpucache = ''; + $cpufeatures = ''; if (!empty($domain['cpumode']) && $domain['cpumode'] == 'host-passthrough') { $cpumode .= "mode='host-passthrough'"; + $cpucache = ""; // detect if the processor is hyperthreaded: $intCPUThreadsPerCore = max(intval(shell_exec('/usr/bin/lscpu | grep \'Thread(s) per core\' | awk \'{print $4}\'')), 1); + + // detect if the processor is AMD + multithreaded, and if so, enable topoext cpu feature + if ($intCPUThreadsPerCore > 1) { + $strCPUInfo = file_get_contents('/proc/cpuinfo'); + if (strpos($strCPUInfo, 'AuthenticAMD') !== false) { + $cpufeatures .= ""; + } + } // even amount of cores assigned and cpu is hyperthreaded: pass that info along to the cpu section below if ($intCPUThreadsPerCore > 1 && ($vcpus % $intCPUThreadsPerCore == 0)) { @@ -336,6 +347,8 @@ $cpustr = " + $cpucache + $cpufeatures {$vcpus}