On Tue, May 23, 2023 at 10:59:05AM -0700, Axel Rasmussen wrote:
Actually.. I think maybe we should have 1 patch changing SWAPIN_ERROR from VM_FAULT_SIGBUS to VM_FAULT_HWPOISON.
Let's imagine a VM having anonymous page backing and got a swapin error when faulted on one of the guest page. Instead of crashing the hypervisor with sigbus we should probably make it a MCE injected into the guest too, because there's no page corrupt in bare metal in this specific case, however to the guest it's the same as having one page corrupted just like a real MCE.
This is a great idea, you're right that injecting an MCE into the guest is exactly the end goal, and it seems like VM_FAULT_HWPOISON will "just work". Also the name UFFDIO_POISON resolves any confusion with UFFD_FEATURE_SIGBUS, so that's a nice side benefit.
Hopefully! Please double check it with KVM running altogether to make sure the patch works exactly as expected.
[...]
We'll want hugetlbfs support for this operation too, but it's only really useful (at least for our use case) after HGM is merged. But, there's no strong reason not to just implement both all at once - I'll extend v2 to also work properly with hugetlbfs. Probably it isn't too hard, I just need to do a bit more reading of how swap markers are handled in hugetlbfs.
Sure. We have too many flags separating different types of memory, so I think it'll be nice if when it can still trivially work for everything.
For this specific case, since your goal is definitely having hugetlb hgm supported so it'll be even more trickier if only hgm will be supported but not !hgm hugetlbs, so we'd better target it initially with all mem types.
Thanks,