linux-nvme / nvme-cli

NVMe management command line interface.
https://nvmexpress.org
GNU General Public License v2.0
1.46k stars 654 forks source link

common.h: Avoid using unsupported load/store instructions in arm64 VMs #2397

Closed oupton closed 3 months ago

oupton commented 3 months ago

Using nvme show-regs within a VM on arm64 can sometimes lead to VM termination.

To answer why this happens: one of the deficiencies of the Arm architecture is that there exists a range of load/store instructions that have insufficient decode information for traps taken to the hypervisor. KVM, for example, may raise an external abort or outright terminate the VM depending on the configuration.

This is a known problem on the kernel side, and is fixed by using assembly MMIO accessors w/ 'safe' load/store instructions. So do exactly that, providing arm64-specific accessors and falling back to plain old volatile pointer accesses for other architectures.

Reported-by: William Butler wab@google.com

igaw commented 3 months ago

Thanks!