On Fri, Apr 23, 2021 at 3:11 PM Jianxiong Gao jxgao@google.com wrote:
+Marc, who can help filling the gaps.
Jianxiong Gao
Oops. Gao over-trimmed. From lkml, here's Gao's last reply.
How? Anything that installed 5.10 when it was released never had this working, they had to move to 5.12 to get that to work.
I wasn't clear. The bug is not specific to SEV virtualization. We simply encountered it while working on SEV virtualization. This is a pre-existing bug.
Briefly, the NVMe spec expects a page offset to be retained from the memory address space to the IO address space.
Before these patches, the SWIOTLB truncates any page offset.
Thus, all NVMe + SWIOTLB systems are broken due to this bug without these patches.
I searched online and found what appeared to be a very similar bug from a few years ago [1]. Ultimately, it was fixed in the device firmware. However, it began with NVMe + SWIOTLB resulting in similar issues to what we observed without these patches.
The bug is not specific to SEV virtualization. We've repro'd the bug on vanilla NVMe + SWIOTLB kernels, and confirmed that these patches fix the issue. We simply first encountered it while working on SEV virtualization.
The bug itself is that on an NVMe + SWIOTLB setup, `mkfs.xfs -f /dev/nvme2n1` triggers the following error "mkfs.xfs: pwrite failed: Input/output error". We observed this on a RHEL system.
An example system where a user might encounter this bug is the following. On a system with NVMe + older 32-bit devices that has been configured with the `swiotlb=force` kernel command line flag to ensure that the 32-bit devices work properly.