This script is designed for QubesOS. It makes use of Qubes tags (qvm-tags) to automatically pin VMs to specified CPUs (e.g. e-cores and p-cores).
- Download
cpu-pinning.serviceandcpu-pinning.pyand copy it over todom0 - Inside
dom0copy the service file to/etc/systemd/systemand the Python script to/usr/local/bin - Modify the Python script (
P_CORESandE_CORESvariables) to match your CPU topology. Thesudo xenpm get-cpu-topologycommand can help here. - Also inside
dom0, executesudo chmod +x /usr/local/bin/cpu-pinning.py; sudo systemctl daemon-reload && sudo systemctl enable --now cpu-pinning. - For each VM whose pinnings you want to modify, execute (in
dom0):qvm-tags VMNAME add CORES_TAG.
CORES_TAG can be one of:
e_cores- have VM only execute on your efficient cores.e_cores_soft- have VM try to execute on efficient cores, using other cores if all e-cores are busy.p_cores- have VM only execute on your performance cores.p_cores_soft- have VM try to execute on performance cores, using other cores if all p-cores are busy.
The script is expanded from @noskb's and @renehoj's CPU pinning script.
See the qubes-utils repo for links to other utilities I've written for Qubes.
I recommend also checking out Qubes Window Boost, it works very well in combination with this script.
This project is licensed under the AGPL-3.0-or-later.