>> ... so on a PASID system, your trivial reproducer would theoretically >> fire the same way and corrupt FPU state just as well. > > This is worse and you can't selftest it because the IPI can just hit in > the middle of _any_ FPU state operation and corrupt state.
That sounds like we should abandon the "IPI all the other threads to force enable the PASID for them" approach. It would just be a nightmare of papering over cracks when the IPI was delivered at some inconvenient moment when the recipient was in the middle of touching xsave state. I've told Fenghua to dig out the previous iteration of this patch where the plan was to lazily fix the PASID_MSR in other threads in the #GP handler. That algorithm is very simple and easy to check. Pseudo-code: #GP if (usermode && current->mm->pasid && rdmsr(PASID_MSR) != valid) { wrmsr(PASID_MSR, current->mm->pasid | PASID_VALID); return; } Worst case is that some thread of a multi-threaded process that is using PASID takes some unrelated #GP ... this code will try to fix it by enabling the PASID_MSR. That will just #GP a second time and this test will see the MSR is already set, so fall into the usual #GP handling code. Seems like a better direction than trying to fix the IPI method. The virtualization folks will like this way more because IPI in guest causes a couple of VMEXIT so is somewhat expensive. -Tony _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu