From: Peter Xu <peterx@redhat.com>
To: James Houghton <jthoughton@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <david@redhat.com>,
Huang Ying <ying.huang@intel.com>,
Hugh Dickins <hughd@google.com>, Jiaqi Yan <jiaqiyan@google.com>,
Jonathan Corbet <corbet@lwn.net>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
"Mike Rapoport (IBM)" <rppt@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Nadav Amit <namit@vmware.com>,
Naoya Horiguchi <naoya.horiguchi@nec.com>,
Shuah Khan <shuah@kernel.org>,
ZhangPeng <zhangpeng362@huawei.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 1/6] mm: userfaultfd: add new UFFDIO_POISON ioctl
Date: Wed, 5 Jul 2023 12:38:24 -0400 [thread overview]
Message-ID: <ZKWcgD1hFFUxeQHg@x1n> (raw)
In-Reply-To: <CADrL8HWO8g2-YdUtyLM6e+f1VJq6YV-b1_rj-beEh2C84kAgEw@mail.gmail.com>
On Wed, Jul 05, 2023 at 09:27:15AM -0700, James Houghton wrote:
> On Wed, Jul 5, 2023 at 9:15 AM Peter Xu <peterx@redhat.com> 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.
Miaohe initially proposed this swapin error facility, let's see whether he
can comment; he's already in the cc list.
AFAICT that's the right thing to do, and it shouldn't affect any existing
user of swapin error if there is.
Or say, VM_FAULT_HWPOISON should be the same as VM_FAULT_SIGBUS when not in
kvm context, so shouldn't change a thing in !kvm, while changing that
should fix kvm from crashing a guest where we shouldn't need to.
--
Peter Xu
next prev parent reply other threads:[~2023-07-05 16:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 20:50 Axel Rasmussen
2023-06-29 20:50 ` [PATCH v2 2/6] mm: userfaultfd: refactor hugetlb folio allocation / lookup code Axel Rasmussen
2023-07-04 20:57 ` Peter Xu
2023-06-29 20:50 ` [PATCH v2 3/6] mm: userfaultfd: support UFFDIO_POISON for hugetlbfs Axel Rasmussen
2023-07-04 20:59 ` Peter Xu
2023-06-29 20:50 ` [PATCH v2 4/6] selftests/mm: refactor uffd_poll_thread to allow custom fault handlers Axel Rasmussen
2023-07-04 21:03 ` Peter Xu
2023-07-05 17:50 ` Axel Rasmussen
2023-07-05 18:17 ` Peter Xu
2023-06-29 20:50 ` [PATCH v2 5/6] selftests/mm: add uffd unit test for UFFDIO_POISON Axel Rasmussen
2023-07-04 21:15 ` Peter Xu
2023-06-29 20:50 ` [PATCH v2 6/6] mm: userfaultfd: add basic documentation " Axel Rasmussen
2023-06-29 21:04 ` Randy Dunlap
2023-07-04 21:16 ` Peter Xu
2023-07-04 20:38 ` [PATCH v2 1/6] mm: userfaultfd: add new UFFDIO_POISON ioctl Peter Xu
2023-07-05 16:09 ` James Houghton
2023-07-05 16:15 ` Peter Xu
2023-07-05 16:27 ` James Houghton
2023-07-05 16:38 ` Peter Xu [this message]
2023-07-05 17:56 ` Axel Rasmussen
2023-07-05 15:58 ` James Houghton
2023-07-05 18:17 ` Jiaqi Yan
2023-07-05 18:23 ` Axel Rasmussen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZKWcgD1hFFUxeQHg@x1n \
--to=peterx@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=jiaqiyan@google.com \
--cc=jthoughton@google.com \
--cc=linmiaohe@huawei.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=namit@vmware.com \
--cc=naoya.horiguchi@nec.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=ying.huang@intel.com \
--cc=zhangpeng362@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox