In my current project we have the requirement to deactivate Hyper-threading on some Azure VMs. There are some Azure VMs available without Hyper-threading which can be found on the Azure compute unit site where Microsoft published a table with VM SKUs sizes where the “vCPU: Core” give a hint about VMs which are not having HT integrated. But this sizes are very limited and we have some requirements from licensing side to disable Hyper-threading and there also some applications which have a better performance when HT is disabled.
We found several arcticle in the Internet with different options like enable a Tag to disable HT for the selected VMs and some other examples. Microsoft announced in the following article “Guidance for mitigating silicon based micro-architectural and speculative execution side-channel vulnerabilities “
If you’re running a hyper-threaded VM, contact Azure Support to get hyper-threading disabled.
After several of these attempts failed, we found out from Microsoft how we could solve this requirement without the help of Microsoft support or further requirements.
To see if a VM using Hyper-threading, we can use Powershell to check the current status in a Windows VM with the following parameter:
wmic CPU Get NumberOfCores,NumberOfLogicalProcessors /Format:List
The result like the following
There you can see the count for the number of cores and the numer of Logical processors which equals the Hyper-threading cores.
Implementation
To disable Hyper-threading on Azure VMs which have CPUs with enabled vCores there must be set two registry keys. This keys can be ad manually or via Command line over “reg add”.
When you run the following two registry settings and restart the VM the vCores are disabled.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverride /t REG_DWORD /d 8264 /f reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v FeatureSettingsOverrideMask /t REG_DWORD /d 3 /f
After the two commands have been executed in the command line, the registry looks like this:
After the registry settings have been implemented, the VM must be restarted to take effect. The settings will not take effect wihtout.
This will close this article. Thanks goes out to my colleague David Laukamp for noted me in this case.