Gaming VM Post-Install Tweaks

A few tweaks were applied to the VM after the base install, on top of the GPU passthrough setup, to get better and more predictable performance.

CPU pinning

The VM’s vCPUs are pinned to specific host cores so it has full, exclusive control over them instead of competing with the host scheduler for whichever core happens to be free.

  1. List the host’s CPU topology:
    lscpu -e
    On the Gigabyte Gaming A16’s 13th Gen Intel Core i7-13620H, cores 0–5 are the performance cores (with hyperthreading) and 6–9 are the efficiency cores.
  2. Cores 0–11 (all performance-core threads) are pinned to the VM.
  3. In the VM’s CPU configuration, host-passthrough is enabled and the topology is manually set to match: 1 socket, 6 cores, 2 threads.
  4. The pinning itself is added directly in the VM’s raw XML:
    <vcpu placement="static">12</vcpu>
    <cputune>
      <vcpupin vcpu="0" cpuset="0"/>
      <vcpupin vcpu="1" cpuset="1"/>
      <vcpupin vcpu="2" cpuset="2"/>
      <vcpupin vcpu="3" cpuset="3"/>
      <vcpupin vcpu="4" cpuset="4"/>
      <vcpupin vcpu="5" cpuset="5"/>
      <vcpupin vcpu="6" cpuset="6"/>
      <vcpupin vcpu="7" cpuset="7"/>
      <vcpupin vcpu="8" cpuset="8"/>
      <vcpupin vcpu="9" cpuset="9"/>
      <vcpupin vcpu="10" cpuset="10"/>
      <vcpupin vcpu="11" cpuset="11"/>
    </cputune>

Faster drives

  • The drive’s Discard mode is set to unmap for SSD TRIM support — see the virtual disks reference for why this matters and its caveats.
  • The drive’s bus type is set to VirtIO for better performance over SATA/IDE. This requires the VirtIO drivers to be installed in the Windows guest before the drive is detected, plus the VirtIO Serial Controller hardware added to the VM. Installing from the VirtIO ISO during Windows setup only gets the SCSI driver in; the rest still needs installing from inside the already-installed OS.

Looking Glass port and hotkey

  • The VM’s SPICE port is set to 6769 instead of leaving it on the default, so another VM on the same host can’t accidentally hijack Looking Glass’s connection.
  • Looking Glass’s menu/hotkey is changed from the default Scroll Lock to backslash, since this laptop’s keyboard has no Scroll Lock key.
  • The flags used to launch the client: -m KEY_BACKSLASH -p 6769.