linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Roberts <ryan.roberts@arm.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Suren Baghdasaryan <surenb@google.com>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Matthew Wilcox <willy@infradead.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Jann Horn <jannh@google.com>,
	David Hildenbrand <david@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org,
	John Hubbard <jhubbard@nvidia.com>,
	Juan Yescas <jyescas@google.com>,
	Kalesh Singh <kaleshsingh@google.com>
Subject: Re: [PATCH 3/4] tools/selftests: expand all guard region tests to file-backed
Date: Tue, 22 Apr 2025 11:37:57 +0100	[thread overview]
Message-ID: <a2d2766b-0ab4-437b-951a-8595a7506fe9@arm.com> (raw)
In-Reply-To: <ab42228d2bd9b8aa18e9faebcd5c88732a7e5820.1739469950.git.lorenzo.stoakes@oracle.com>

On 13/02/2025 18:17, Lorenzo Stoakes wrote:
> Extend the guard region tests to allow for test fixture variants for anon,
> shmem, and local file files.
> 
> This allows us to assert that each of the expected behaviours of anonymous
> memory also applies correctly to file-backed (both shmem and an a file
> created locally in the current working directory) and thus asserts the same
> correctness guarantees as all the remaining tests do.
> 
> The fixture teardown is now performed in the parent process rather than
> child forked ones, meaning cleanup is always performed, including unlinking
> any generated temporary files.
> 
> Additionally the variant fixture data type now contains an enum value
> indicating the type of backing store and the mmap() invocation is
> abstracted to allow for the mapping of whichever backing store the variant
> is testing.
> 
> We adjust tests as necessary to account for the fact they may now reference
> files rather than anonymous memory.

Hi Lorenzo,

I'm getting a test failure in v6.15-rc3 on arm64:

----8<----
#  RUN           guard_regions.shmem.uffd ...
# guard-regions.c:1467:uffd:Expected ioctl(uffd, UFFDIO_REGISTER, &reg) (-1) ==
0 (0)
# uffd: Test terminated by assertion
#          FAIL  guard_regions.shmem.uffd
not ok 45 guard_regions.shmem.uffd
----8<----

The ioctl is returning EINVAL.

[...]

> @@ -1281,6 +1398,9 @@ TEST_F(guard_regions, uffd)
>  	struct uffdio_register reg;
>  	struct uffdio_range range;
>  
> +	if (!is_anon_backed(variant))

Perhaps this should be filtering out shmem too? Although the manual for
userfaultfd implies that shmem is supported:

"""
Up to Linux 4.11, userfaultfd can be used only with anonymous private memory
mappings.  Since Linux 4.11, userfaultfd can be also used with hugetlbfs and
shared memory mappings.
"""

But I'm not sure if that's referring specifically to UFFDIO_REGISTER_MODE_MISSING?

Any ideas before I start debugging further?

Thanks,
Ryan

> +		SKIP(return, "uffd only works on anon backing");
> +
>  	/* Set up uffd. */
>  	uffd = userfaultfd(0);
>  	if (uffd == -1 && errno == EPERM)
> @@ -1290,8 +1410,8 @@ TEST_F(guard_regions, uffd)
>  	ASSERT_EQ(ioctl(uffd, UFFDIO_API, &api), 0);
>  
>  	/* Map 10 pages. */
> -	ptr = mmap(NULL, 10 * page_size, PROT_READ | PROT_WRITE,
> -		   MAP_ANON | MAP_PRIVATE, -1, 0);
> +	ptr = mmap_(self, variant, NULL, 10 * page_size,
> +		    PROT_READ | PROT_WRITE, 0, 0);
>  	ASSERT_NE(ptr, MAP_FAILED);
>  
>  	/* Register the range with uffd. */



  parent reply	other threads:[~2025-04-22 10:38 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 18:16 [PATCH 0/4] mm: permit guard regions for file-backed/shmem mappings Lorenzo Stoakes
2025-02-13 18:17 ` [PATCH 1/4] mm: allow guard regions in file-backed and read-only mappings Lorenzo Stoakes
2025-02-18 14:15   ` Vlastimil Babka
2025-02-18 16:01   ` David Hildenbrand
2025-02-18 16:12     ` Lorenzo Stoakes
2025-02-18 16:17       ` David Hildenbrand
2025-02-18 16:21         ` Lorenzo Stoakes
2025-02-18 16:27           ` David Hildenbrand
2025-02-18 16:49             ` Lorenzo Stoakes
2025-02-18 17:00               ` David Hildenbrand
2025-02-18 17:04                 ` Lorenzo Stoakes
2025-02-24 14:02   ` Lorenzo Stoakes
2025-02-13 18:17 ` [PATCH 2/4] selftests/mm: rename guard-pages to guard-regions Lorenzo Stoakes
2025-02-18 14:15   ` Vlastimil Babka
2025-03-02  8:35   ` Lorenzo Stoakes
2025-02-13 18:17 ` [PATCH 3/4] tools/selftests: expand all guard region tests to file-backed Lorenzo Stoakes
2025-02-18 14:17   ` Vlastimil Babka
2025-04-22 10:37   ` Ryan Roberts [this message]
2025-04-22 10:47     ` Lorenzo Stoakes
2025-04-22 11:03       ` Ryan Roberts
2025-04-22 11:07         ` Lorenzo Stoakes
2025-04-22 11:11           ` Ryan Roberts
2025-02-13 18:17 ` [PATCH 4/4] tools/selftests: add file/shmem-backed mapping guard region tests Lorenzo Stoakes
2025-02-18 14:18   ` Vlastimil Babka
2025-02-18 12:12 ` [PATCH 0/4] mm: permit guard regions for file-backed/shmem mappings Vlastimil Babka
2025-02-18 13:05   ` Lorenzo Stoakes
2025-02-18 14:35     ` David Hildenbrand
2025-02-18 14:53       ` Lorenzo Stoakes
2025-02-18 15:20         ` David Hildenbrand
2025-02-18 16:43           ` Lorenzo Stoakes
2025-02-18 17:14             ` David Hildenbrand
2025-02-18 17:20               ` Lorenzo Stoakes
2025-02-18 17:25                 ` David Hildenbrand
2025-02-18 17:28                   ` Lorenzo Stoakes
2025-02-18 17:31                     ` David Hildenbrand
2025-02-25 15:54                     ` Vlastimil Babka
2025-02-25 16:31                       ` David Hildenbrand
2025-02-25 16:37                       ` Lorenzo Stoakes
2025-02-25 16:48                         ` David Hildenbrand
2025-02-19  8:25 ` Kalesh Singh
2025-02-19  8:35   ` Kalesh Singh
2025-02-19  9:15     ` Lorenzo Stoakes
2025-02-19 17:32     ` Liam R. Howlett
2025-02-19  9:03   ` Lorenzo Stoakes
2025-02-19  9:15     ` David Hildenbrand
2025-02-19  9:17       ` Lorenzo Stoakes
2025-02-19 18:52         ` Kalesh Singh
2025-02-19 19:20           ` Lorenzo Stoakes
2025-02-19 20:56             ` Kalesh Singh
2025-02-20  8:51               ` Lorenzo Stoakes
2025-02-20  8:57                 ` David Hildenbrand
2025-02-20  9:04                   ` Lorenzo Stoakes
2025-02-20  9:23                     ` David Hildenbrand
2025-02-20  9:47                       ` Lorenzo Stoakes
2025-02-20 10:03                         ` David Hildenbrand
2025-02-20 10:15                           ` Lorenzo Stoakes
2025-02-20 12:44                             ` David Hildenbrand
2025-02-20 13:18                               ` Lorenzo Stoakes
2025-02-20 16:21                                 ` Suren Baghdasaryan
2025-02-20 18:08                                   ` Kalesh Singh
2025-02-21 11:04                                     ` Lorenzo Stoakes
2025-02-21 17:24                                       ` Kalesh Singh
2025-02-20  9:22                 ` Vlastimil Babka
2025-02-20  9:53                   ` Lorenzo Stoakes

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=a2d2766b-0ab4-437b-951a-8595a7506fe9@arm.com \
    --to=ryan.roberts@arm.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=jyescas@google.com \
    --cc=kaleshsingh@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=paulmck@kernel.org \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /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