Theldus / mode-switch-stat

Minimal tool for measuring cost of mode switch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mode switch statistics

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.

Prerequisites

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-numpy

How to build & testing

Build project:

$ git clone https://github.com/eecheng87/mode-switch-stat.git
$ cd mode-switch-stat
$ make

Testing:

$ 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

Common error

  1. ERROR: could not insert module msT.ko: Operation not permitted

    Solution: Disable SecureBoot (check by mokutil --sb-state)

  2. If kernel version lower than 5.7.0, please disable KALSR or modify macro KERNEL_VERSION to version lower than yours. It's also fine to comment it and force include systab.h and calculating syscall_table by adding offset to original system call table.

How to contribute

Add your output as comment in issue#1

About

Minimal tool for measuring cost of mode switch

License:MIT License


Languages

Language:C 72.0%Language:Python 15.7%Language:Makefile 12.2%