Intel CPU, Hyper-Threading and Spectre STIBP mitigation · uwot.eu
another meaningless subtitle

Intel CPU, Hyper-Threading and Spectre STIBP mitigation

· by fabio · Read in about 2 min · (277 Words)
Fedora Linux Meltdown Spectre Intel Sandy Bridge

Yesterday I was reading phoronix 0 and phoronix 1 articles on STIBP mitigation impact on CPU performance, since I run a pretty old laptop equiped with a Sandy Bridge CPU I figured that I should do my own tests to see how bad things really are or aren’t.

CPU:            Intel Core i3-2310M - 2 cores / 4 threads
Motherboard:    Lenovo Thinkpad
RAM:            2x4 GB DDR3 @1333 MHz
HDD:            Plextor M5pro

OS:             Fedora 29 x86_64 with stock kernels

My benchmark of choice is compiling the Linux kernel (version 4.19.2).
What I do is download the kernel version to /dev/shm ramdisk and compile it using the defconfig configuration while checking how many seconds it takes to complete the task.

#!/bin/sh

WORKDIR="/dev/shm/"
KERNEL_SRC="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.2.tar.xz"

################################################################################

cd $WORKDIR
wget $KERNEL_SRC -O leenux.tar.xz
mkdir leenux
tar --extract --file=leenux.tar.xz --strip-components=1 --directory=leenux
cd leenux
make defconfig
time make -j3

Results are quite interesting:

----------------------------------------------------------------
|kernel version   |  STIBP  |  HT  |  make -j*  |  result      |
----------------------------------------------------------------
|4.19.2-300.fc29  |  on     |  on  |  5	        |  12m23.889s  |
|4.19.2-300.fc29  |  on     |  off |  2	        |  16m23.810s  |
|4.19.2-300.fc29  |  on     |  off |  3	        |  14m44.205s  |
|4.18.18-300.fc29 |  off    |  on  |  5	        |  12m24.569s  |
|4.18.18-300.fc29 |	 off    |  off |  3	        |  14m42.137s  |
----------------------------------------------------------------

Apparently, contrarily to what people think, at least with this specific CPU and in this specific case, Hyper Threading does make quite some difference.
STIBP vulnerability mitigation also doesn’t seem to impact performance at all, which isn’t what I expected.
At the end of the day we can conclude that the best performing configuration is the one with HT enabled and Spectre/Meltdown mitigations enabled at kernel level.