This then configures Nova to add an alias for passing through the GPU. nova.conf:
[pci]
device_spec = { "vendor_id":"1002", "product_id":"740f" }
alias = { "vendor_id":"1002", "product_id":"740f", "device_type":"type-PF", "name":"mi210" }
PCI Passthrough isn't playing ball
We used this support to configure PCI Passthrough of some AMD MI210s at a client site. Initially it seemed to work great, we deployed VMs onto these hypervisors and the MI210s were showing up and ready to use. But then we wanted to test using a different operating system, so we deleted the VM and suddenly:
Oops, the whole hypervisor crashed. Libvirt logs said Unknown PCI header type '127' for device '0000:82:00.0'. In this context 127 (1111111 in binary) means a failed PCIe bus read: the GPU wasn't resetting itself correctly. Journal logs showed the kernel gets stuck waiting for the PCIe port to become ready after reset, before locking up as the hypervisor then crashes. This looked to be some issue with these specific GPUs, as we hadn't seen the same at other sites. We tried updating to the latest GPU firmware, latest drivers, and the latest OS kernel; all to no avail. Without any more avenues to pursue, this called for a workaround.
AMD MI210s have limited SR-IOV support, with just one single virtual function. Normally this wouldn't be particularly useful for us, as this would still only let one VM use a given GPU at a time. But importantly, this lets us give VMs access to the GPU without handing over the underlying PCI device to libvirt. The hypothesis is that we can avoid the host lockups by never needing to reset the GPU after use. Rolling this out via Kayobe was simple, it just involved changing product_id and device_type in stackhpc-compute.yml:
stackhpc_gpu_data:
...<previous device configs>
# AMD MI210
mi210:
resource_name: "{{ mi210_resource_name | default('mi210') }}"
vendor_id: "1002"
- product_id: "740f"
- device_type: "type-PF"
+ product_id: "7410"
+ device_type: "type-VF"
So in nova.conf we get:
[pci]
device_spec = { "vendor_id":"1002", "product_id":"7410" }
alias = { "vendor_id":"1002", "product_id":"7410", "device_type":"type-VF", "name":"mi210" }
After applying these changes the creation and deletion of VMs is performing as expected. We were free to continue scheduling more GPU-enabled VMs.