Qubes OS and CPU affinity

You can automate this by using libvirt hook:

# cat /etc/libvirt/hooks/libxl
#!/bin/bash
guest_name="$1"
libvirt_operation="$2"

if [ "$libvirt_operation" = "started" ]; then
    (
        exec 0</dev/null
        exec 1>/dev/null
        exec 2>/dev/null
        if [ $(qvm-prefs $guest_name virt_mode) = "hvm" ]; then
            xl vcpu-pin $guest_name-dm all all
        fi
    ) & disown
fi

I think it’s ok to do this.

1 Like