Bug 440321

Summary: noht kernel parm to disable hyperthreading doesn't work on RHEL5
Product: Red Hat Enterprise Linux 5 Reporter: Jack Perdue <ss>
Component: doc-Installation_GuideAssignee: Ruediger Landmann <rlandman+disabled>
Status: CLOSED NEXTRELEASE QA Contact: Content Services Development <ecs-dev-list>
Severity: low Docs Contact:
Priority: low    
Version: 5.0CC: anton, dzickus, paul-redhat, prarit, qcai, syeghiay
Target Milestone: rcKeywords: Documentation
Target Release: ---   
Hardware: i686   
OS: Linux   
URL: https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/en-US/RHEL510/Installation_Guide/ch-bootopts-x86.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-03-30 23:54:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Script to disable hyperthreading if "noht" is on kernel boot line none

Description Jack Perdue 2008-04-02 19:34:11 UTC
Description of problem:

Chapter 8 of the RHEL5 Installation Guide, "Additional Boot Options for IntelĀ®
and AMD Systems", lists the "noht" option as a kernel boot parameter to be used
to disable hyperthreading on Intel chips.

AFAICT, there is no support in the kernel source for this option.  And
specifying on the kernel boot line in grub.conf does NOT disable hyperthreading.

Version-Release number of selected component (if applicable):

kernel-2.6.18-8.el5 thru kernel-2.6.18-53.1.14.el5 


How reproducible:

It has failed to work on every RHEL5 system I have tried it on (at least 2).


Steps to Reproduce:

1. Add "noht" to the kernel line in /boot/grub/grub.conf
2. Reboot
3. cat /proc/cpuinfo # verify 
  

Actual results:

Two logical CPUs show up in a system with one physical CPU.


Expected results:

One logical CPU shows up.


Additional info:

This appears to been lost in the upgrade from kernel 2.6.9-x in RHEL4 to
2.6.18-y in RHEL5.  A grep of the RHEL4 sources shows numerous occurances of
"noht".  A grep of the RHEL5 sources only returns
kernel-2.6.18/xen/arch/powerpc/setup.c as a hit, which seems very strange
(PowerPC has hyperthreading too?) and an unlikely place for x86 code.  

It sure is a nice feature, especially on clusters where manually resetting the
BIOS on umpteen machines can be a problem.  It would be nice if it was put back
in.  If not, then at the very least the Installation Guide for RHEL5 should be
corrected to remove that as an option.

Comment 2 Prarit Bhargava 2008-09-15 19:11:17 UTC
Jack,

Are you actually seeing a problem because hyperthreading is enabled?

P.

Comment 3 Jack Perdue 2008-09-15 19:25:16 UTC
Only in that I can't disable it (as documented) without manually resetting 
the BIOS.

In particular, we have a ROCKS cluster here with Intel Xeon's that we use for 
parallel research.  Part of that research involves running parallel benchmarks
and collecting timing profiles.  There are times during such studies to see
the impact of hyperthreading and so it would nice to be able to disable it.
When the "noht" option existed, I could enable two lines of code and reboot
the cluster and all nodes would come up without hyperthreading.  That
option no longer exists AFICT and if we want to do such studies, I have
to reset the BIOS on the 20+ compute nodes, which takes quite a bit longer.

Comment 7 Prarit Bhargava 2008-09-18 13:47:49 UTC
Jack,

The reference to "noht" in our documentation is an *install* option, however I can certainly understand why you could read that as a run-time option.  The documentation, however, states

" This appendix discusses additional boot and kernel boot options available for the Red Hat Enterprise Linux installation program.

To use any of the boot options presented here, type the command you wish to invoke at the installation boot: prompt. "

RHEL5 ships with CPU_HOTPLUG enabled.  This option allows a user to disable and enable HW or HT cores.

For example,

I have a 4 cpu system with two HT processors.

To disable the HT processors one can do:

echo 0 > /sys/devices/system/node/node0/cpu1/online
echo 0 > /sys/devices/system/node/node0/cpu3/online

You could write a system service script that does something similar to (please note that this code is untested and is just a suggestion):

grep noht /proc/cmdline

if [ $? -eq 0 ]; then
     # noht specified on the command line, disabling HT cpus
     echo 0 > /sys/devices/system/node/node0/cpu1/online
     echo 0 > /sys/devices/system/node/node0/cpu3/online
fi

As you will note this has a small drawback:  You must boot the system at least once to determine how the CPUs are enumerated.  However if you have a large cluster of identical systems the same script will work everywhere.

Pulling in the "noht" option is not something we were planning on doing in RHEL5 -- it is a remnant of the RHEL4 install.  I will change this BZ to reflect that there are obsolete installation options specified in the Installation Guide.

Hope this helps,

P.

Comment 9 Ruediger Landmann 2009-03-30 23:54:48 UTC
Fixed in RHEL5 and Fed11 guides.

Comment 10 Jack Perdue 2012-01-05 19:16:12 UTC
Created attachment 550995 [details]
Script to disable hyperthreading if "noht" is on kernel boot line

Thanks Prarit for the clarification and pointers.  Attached is what I came up with for my most recent cluster (given your, and others, input) that tries to determine which CPUs to disable using the thread_siblings_list file in /sys and then disables them.

Let me know if you see a problem with it (if you don't mind).

Seems to work well here for detecting the 2nd thread for each CPU (Nehalem and Sandy Bridge).  Might be a useful utility to have (if it works right).

YMMV / FWIW

Comment 11 Paul Mansfield 2016-07-27 14:24:51 UTC
This hacky one-liner disables the 2nd thread in each cpu pair, much like Jack Perdue's script

cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | awk -F, '{print $2}' | sort -n | uniq | ( while read X ; do echo $X ; echo 0 > /sys/devices/system/cpu/cpu$X/online ; done )