Sometimes the Intel Hyper-Threading (HT) mode on your system needs to be turned off. Linux support processor hotplug. You don't have to reboot your system, go to the BIOS/UEFI and turn off HT manually. Instead you can soft-off the HT cores temporarily on Linux at runtime.

Showing CPU list on Linux

Look at the list of processors. You can see details about cpu and core relationship. Watch the CPU and CORE columns.

lscpu --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ    MINMHZ
0   0    0      0    0:0:0:0       yes    3200,0000 800,0000
1   0    0      0    0:0:0:0       yes    3200,0000 800,0000
2   0    0      1    1:1:1:0       yes    3200,0000 800,0000
3   0    0      1    1:1:1:0       yes    3200,0000 800,0000

Disabling HT

Disabling only one cpu. You must have root rights.

echo 0 > /sys/devices/system/cpu/cpu2/online

A small script that turns off all HT cpu. You must have root rights.

for i in $(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | awk -F "[,-]" '{ print $2; }' | tr ',' '\n' | sort -un)
do
  echo 0 > /sys/devices/system/cpu/cpu$i/online
done

Let's explore the changes.

dmesg | grep CPU
...
[439975.285834] IRQ 26: no longer affine to CPU1
[439975.287095] smpboot: CPU 1 is now offline
[439975.301424] IRQ 30: no longer affine to CPU3
[439975.301437] IRQ 32: no longer affine to CPU3
[439975.302453] smpboot: CPU 3 is now offline

lscpu --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE MAXMHZ    MINMHZ
0   0    0      0    0:0:0:0       yes    3200,0000 800,0000
1   -    -      -    :::           no     3200,0000 800,0000
2   0    0      1    1:1:1:0       yes    3200,0000 800,0000
3   -    -      -    :::           no     3200,0000 800,0000

Turn processors on again

The following one-liner turns on all cpu online. You must have root rights.

for i in $(find /sys/devices/system/cpu/cpu* -name online); do echo 1 > $i; done

Migration from BIND/OpenDNSSEC to PowerDNS with DNSSEC

17 August 2016 15:01 | Molnár Péter

Migration of BIND and OpenDNSSEC to PowerDNS 4 with DNSSEC.

read more

Installing Altera Quartus II 14.0 and ModelSim on Ubuntu Linux 14.10 system

01 November 2014 07:49 | Molnár Péter

Installation of Altera Quartus II 14.0 and setting up of ModelSim Altera Edition on Ubuntu 14.10

read more

Remote FPGA JTAG programming via SSH tunnel with Altera Quartus II

23 October 2014 14:43 | Molnár Péter

JTAG programming of an Altera FPGA, through an SSH tunnel with Quartus II. The device is on the network, connected to a remote machine through USB Blaster.

read more

Altera Quartus II and NIOS II command line tutorial

12 October 2014 08:06 | Molnár Péter

Altera Quartus II and NIOS II command line

read more

IT8720F watchdog

23 March 2013 07:37 | Molnár Péter

Setting up IT8720F watchdog on Linux

read more