[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210201193334.GH260413@xz-x1>
Date: Mon, 1 Feb 2021 14:33:34 -0500
From: Peter Xu <peterx@...hat.com>
To: Axel Rasmussen <axelrasmussen@...gle.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Catalin Marinas <catalin.marinas@....com>,
Chinwen Chang <chinwen.chang@...iatek.com>,
Huang Ying <ying.huang@...el.com>,
Ingo Molnar <mingo@...hat.com>, Jann Horn <jannh@...gle.com>,
Jerome Glisse <jglisse@...hat.com>,
Lokesh Gidra <lokeshgidra@...gle.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Koutný <mkoutny@...e.com>,
Michel Lespinasse <walken@...gle.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Nicholas Piggin <npiggin@...il.com>, Shaohua Li <shli@...com>,
Shawn Anastasio <shawn@...stas.io>,
Steven Rostedt <rostedt@...dmis.org>,
Steven Price <steven.price@....com>,
Vlastimil Babka <vbabka@...e.cz>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
Adam Ruprecht <ruprecht@...gle.com>,
Cannon Matthews <cannonmatthews@...gle.com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Oliver Upton <oupton@...gle.com>
Subject: Re: [PATCH v3 9/9] userfaultfd/selftests: add test exercising minor
fault handling
On Thu, Jan 28, 2021 at 02:48:19PM -0800, Axel Rasmussen wrote:
> Fix a dormant bug in userfaultfd_events_test(), where we did
> `return faulting_process(0)` instead of `exit(faulting_process(0))`.
> This caused the forked process to keep running, trying to execute any
> further test cases after the events test in parallel with the "real"
> process.
>
> Add a simple test case which exercises minor faults. In short, it does
> the following:
>
> 1. "Sets up" an area (area_dst) and a second shared mapping to the same
> underlying pages (area_dst_alias).
>
> 2. Register one of these areas with userfaultfd, in minor fault mode.
>
> 3. Start a second thread to handle any minor faults.
>
> 4. Populate the underlying pages with the non-UFFD-registered side of
> the mapping. Basically, memset() each page with some arbitrary
> contents.
>
> 5. Then, using the UFFD-registered mapping, read all of the page
> contents, asserting that the contents match expectations (we expect
> the minor fault handling thread can modify the page contents before
> resolving the fault).
>
> The minor fault handling thread, upon receiving an event, flips all the
> bits (~) in that page, just to prove that it can modify it in some
> arbitrary way. Then it issues a UFFDIO_CONTINUE ioctl, to setup the
> mapping and resolve the fault. The reading thread should wake up and see
> this modification.
>
> Currently the minor fault test is only enabled in hugetlb_shared mode,
> as this is the only configuration the kernel feature supports.
>
> Signed-off-by: Axel Rasmussen <axelrasmussen@...gle.com>
Reviewed-by: Peter Xu <peterx@...hat.com>
--
Peter Xu
Powered by blists - more mailing lists