Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a system running a financial trading application at a remote facility. I do not have access to the ILO/DRAC, but need to disable hyperthreading. The system runs Intel Nehalem 3.33GHz X5680 hex-core CPUs. I can reboot, but want to make sure that the system does not enable hyperthreading due to performance problems. Is there a clean way to do this from within Linux?

Edit: The noht directive added to the kernel boot command line did not work. Same for RHEL.

See: https://bugzilla.redhat.com/show_bug.cgi?id=440321#c9

share|improve this question
add comment

4 Answers 4

You can do this at runtime if you want to. I found a nice solution described here: http://www.absolutelytech.com/2011/08/01/how-to-disable-cpu-cores-in-linux/

Step 1: Identify the linux CPUs you want to switch off:

cat /proc/cpuinfo

Look for the CPUs that have the same "core id", you want to switch off one of each pair.

Step 2: Switch off the hyperthreading CPUs (in my case the last four of the total 8 "CPUs" seen by Linux)

echo 0 > /sys/devices/system/cpu/cpu4/online
echo 0 > /sys/devices/system/cpu/cpu5/online
echo 0 > /sys/devices/system/cpu/cpu6/online
echo 0 > /sys/devices/system/cpu/cpu7/online

You could setup yourself a script that you run just after system start.

Best regards, Alexander.

share|improve this answer
add comment

In the libsmbios-bin package (Debian, Ubuntu, etc), you have the binaries isCmosTokenActive and activateCmosToken. Together with the token list, you can then try something like this:

# isCmosTokenActive 0x00d1 # CPU_Hyperthreading_Enable
[...] Type 0x00d1  Location 0x46 AND(fe) OR(0)  BITFIELD: 1
# isCmosTokenActive 0x00d2 # CPU_Hyperthreading_Disable
[....] Type 0x00d2  Location 0x46 AND(fe) OR(1)  BITFIELD: 0

Then activate the CPU_Hyperthreading_Disable token:

# activateCmosToken 0x00d2 # CPU_Hyperthreading_Disable
[...] Type 0x00d2  Location 0x46 AND(fe) OR(1)  BITFIELD: 1

Verify:

# isCmosTokenActive 0x00d1 # CPU_Hyperthreading_Enable
[...] Type 0x00d1  Location 0x46 AND(fe) OR(0)  BITFIELD: 0
# isCmosTokenActive 0x00d2 # CPU_Hyperthreading_Disable
[...] Type 0x00d2  Location 0x46 AND(fe) OR(1)  BITFIELD: 1

Now, the big question is whether or not you simply need a reboot for this to take effect, or if a full power cycle is required. Try it out and see how it goes!

share|improve this answer
add comment
up vote 0 down vote accepted

I had to wait until I could get into the ILO/Drac. The kernel boot parameters do not work on current Linux distributions.

share|improve this answer
add comment

Yes. Append the noht parameter to the kernel on boot.

From http://www.faqs.org/docs/Linux-HOWTO/BootPrompt-HOWTO.html :

The `noht' Argument

This will disable hyper-threading on intel processors that have this feature. 

If using lilo edit you /etc/lilo.conf (and run lilo afterwards) or if using grub then edit your /boot/grub/menu.lst .

share|improve this answer
    
Is this functionally equivalent to disabling HT in the BIOS? –  ewwhite Feb 15 '11 at 18:26
    
I don't know that for sure, but yes, I would expect noht to be equivalent to disabling it on the BIOS. –  rems Feb 15 '11 at 18:52
1  
This is a Gentoo system. I tried the noht entry in the grub kernel command line. The system did not honor the noht command. Same for RHEL. See: bugzilla.redhat.com/show_bug.cgi?id=440321#c9 –  ewwhite Feb 15 '11 at 19:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.