On Wed, Jul 5, 2023 at 9:15 AM Peter Xu <peterx@xxxxxxxxxx> wrote: > > On Wed, Jul 05, 2023 at 09:09:19AM -0700, James Houghton wrote: > > > > diff --git a/include/linux/swapops.h b/include/linux/swapops.h > > > > index 4c932cb45e0b..8259fee32421 100644 > > > > --- a/include/linux/swapops.h > > > > +++ b/include/linux/swapops.h > > > > @@ -394,7 +394,8 @@ typedef unsigned long pte_marker; > > > > > > > > #define PTE_MARKER_UFFD_WP BIT(0) > > > > #define PTE_MARKER_SWAPIN_ERROR BIT(1) > > > > -#define PTE_MARKER_MASK (BIT(2) - 1) > > > > +#define PTE_MARKER_UFFD_POISON BIT(2) > > > > > > One more tab. > > > > > > Though I remembered the last time we discussed IIRC we plan to rename > > > SWAPIN_ERROR and reuse it, could you explain why a new bit is still needed? > > > > > > I think I commented this but I'll do it again: IIUC any existing host > > > swapin errors for guest pages should be reported as MCE too, afaict, > > > happened in kvm context. > > > > I think swapin errors are treated differently than poison. Swapin > > errors get VM_FAULT_SIGBUS, and poison gets VM_FAULT_HWPOISON, so > > UFFDIO_POISON should also get VM_FAULT_HWPOISON (so that's what Axel > > has implemented). And I think that needs a separate PTE marker. > > My question was, should we also make SWAPIN_ERROR return VM_FAULT_HWPOISON > always? > > Just to recap from what I already commented above - if a guest page got > error in swapin due to block sector failures, it should be treated as > VM_FAULT_HWPOISON too, IMHO. IOW, I think current SWAPIN_ERROR is wrong > when in kvm context and we should fix it first. Oh! Yes, I agree, though I'm not familiar enough with the users of SWAPIN_ERROR to know if we can actually make this change.