To mitigate meltdown and spectre vulnerability, the mode switch cost was increased. mode-switch-stat is a easy infrastructure to measure the cost of mode switch. In here, one mode switch trip contains user mode to kernel mode and kernel to user. At present, this tool supports x86_64 architecture only.
This tool requires Linux kernel headers and NumPy. For Ubuntu/Debian, you can install these packages in advance.
$ sudo apt install linux-headers-$(uname-r)
$ sudo apt install python3-numpyBuild project:
$ git clone https://github.com/eecheng87/mode-switch-stat.git
$ cd mode-switch-stat
$ makeTesting:
$ make testing
sample output:
Model name: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Vulnerability Meltdown: Mitigation; PTI
Avg of mode switch takes 1921.45 cycles and standard deviation is 106.92
-
ERROR: could not insert module msT.ko: Operation not permitted
Solution: Disable SecureBoot (check by
mokutil --sb-state) -
If kernel version lower than
5.7.0, please disable KALSR or modify macroKERNEL_VERSIONto version lower than yours. It's also fine to comment it and force includesystab.hand calculatingsyscall_tableby adding offset to original system call table.
Add your output as comment in issue#1