| 8cf6ecb1 | 28-Apr-2025 |
Nysal Jan K.A. <[email protected]> |
selftests/mm: fix a build failure on powerpc
The compiler is unaware of the size of code generated by the ".rept" assembler directive. This results in the compiler emitting branch instructions wher
selftests/mm: fix a build failure on powerpc
The compiler is unaware of the size of code generated by the ".rept" assembler directive. This results in the compiler emitting branch instructions where the offset to branch to exceeds the maximum allowed value, resulting in build failures like the following:
CC protection_keys /tmp/ccypKWAE.s: Assembler messages: /tmp/ccypKWAE.s:2073: Error: operand out of range (0x0000000000020158 is not between 0xffffffffffff8000 and 0x0000000000007ffc) /tmp/ccypKWAE.s:2509: Error: operand out of range (0x0000000000020130 is not between 0xffffffffffff8000 and 0x0000000000007ffc)
Fix the issue by manually adding nop instructions using the preprocessor.
Link: https://lkml.kernel.org/r/[email protected] Fixes: 46036188ea1f ("selftests/mm: build with -O2") Reported-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Nysal Jan K.A. <[email protected]> Tested-by: Venkat Rao Bagalkote <[email protected]> Reviewed-by: Donet Tom <[email protected]> Tested-by: Donet Tom <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 22adb528 | 28-Apr-2025 |
Madhavan Srinivasan <[email protected]> |
selftests/mm: fix build break when compiling pkey_util.c
Commit 50910acd6f615 ("selftests/mm: use sys_pkey helpers consistently") added a pkey_util.c to refactor some of the protection_keys function
selftests/mm: fix build break when compiling pkey_util.c
Commit 50910acd6f615 ("selftests/mm: use sys_pkey helpers consistently") added a pkey_util.c to refactor some of the protection_keys functions accessible by other tests. But this broken the build in powerpc in two ways,
pkey-powerpc.h: In function `arch_is_powervm': pkey-powerpc.h:73:21: error: storage size of `buf' isn't known 73 | struct stat buf; | ^~~ pkey-powerpc.h:75:14: error: implicit declaration of function `stat'; did you mean `strcat'? [-Wimplicit-function-declaration] 75 | if ((stat("/sys/firmware/devicetree/base/ibm,partition-name", &buf) == 0) && | ^~~~ | strcat
Since pkey_util.c includes pkeys-helper.h, which in turn includes pkeys-powerpc.h, stat.h including is missing for "struct stat". This is fixed by adding "sys/stat.h" in pkeys-powerpc.h
Secondly,
pkey-powerpc.h:55:18: warning: format `%llx' expects argument of type `long long unsigned int', but argument 3 has type `u64' {aka `long unsigned int'} [-Wformat=] 55 | dprintf4("%s() changing %016llx to %016llx\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | __func__, __read_pkey_reg(), pkey_reg); | ~~~~~~~~~~~~~~~~~ | | | u64 {aka long unsigned int} pkey-helpers.h:63:32: note: in definition of macro `dprintf_level' 63 | sigsafe_printf(args); \ | ^~~~
These format specifier related warning are removed by adding "__SANE_USERSPACE_TYPES__" to pkeys_utils.c.
Link: https://lkml.kernel.org/r/[email protected] Fixes: 50910acd6f61 ("selftests/mm: use sys_pkey helpers consistently") Signed-off-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Nysal Jan K.A. <[email protected]> Tested-by: Venkat Rao Bagalkote <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| a8efadda | 25-Apr-2025 |
Lorenzo Stoakes <[email protected]> |
tools/testing/selftests: fix guard region test tmpfs assumption
The current implementation of the guard region tests assume that /tmp is mounted as tmpfs, that is shmem.
This isn't always the case,
tools/testing/selftests: fix guard region test tmpfs assumption
The current implementation of the guard region tests assume that /tmp is mounted as tmpfs, that is shmem.
This isn't always the case, and at least one instance of a spurious test failure has been reported as a result.
This assumption is unsafe, rushed and silly - and easily remedied by simply using memfd, so do so.
We also have to fixup the readonly_file test to explicitly only be applicable to file-backed cases.
Link: https://lkml.kernel.org/r/[email protected] Fixes: 272f37d3e99a ("tools/selftests: expand all guard region tests to file-backed") Signed-off-by: Lorenzo Stoakes <[email protected]> Reported-by: Ryan Roberts <[email protected]> Closes: https://lore.kernel.org/linux-mm/[email protected]/ Reviewed-by: Ryan Roberts <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| a2c6f9c3 | 18-Mar-2025 |
Ryan Roberts <[email protected]> |
selftests/mm: speed up split_huge_page_test
create_pagecache_thp_and_fd() was previously writing a file sized at twice the PMD size by making a per-byte write syscall. This was quite slow when the
selftests/mm: speed up split_huge_page_test
create_pagecache_thp_and_fd() was previously writing a file sized at twice the PMD size by making a per-byte write syscall. This was quite slow when the PMD size is 4M, but completely intolerable for 32M (PMD size for arm64's 16K page size), and 512M (PMD size for arm64's 64K page size).
The byte pattern has a 256 byte period, so let's create a 1K buffer and fill it with exactly 4 periods. Then we can write the buffer as many times as is required to fill the file. This makes things much more tolerable.
The test now passes for 16K page size. It still fails for 64K page size because MAX_PAGECACHE_ORDER is too small for 512M folio size (I think).
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryan Roberts <[email protected]> Acked-by: Peter Xu <[email protected]> Acked-by: Rafael Aquini <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 735b3f7e | 18-Mar-2025 |
Ryan Roberts <[email protected]> |
selftests/mm: uffd-unit-tests support for hugepages > 2M
uffd-unit-tests uses a memory area with a fixed 32M size. Then it calculates the number of pages by dividing by page_size, which itself is e
selftests/mm: uffd-unit-tests support for hugepages > 2M
uffd-unit-tests uses a memory area with a fixed 32M size. Then it calculates the number of pages by dividing by page_size, which itself is either the base page size or the PMD huge page size depending on the test config. For the latter, we end up with nr_pages=1 for arm64 16K base pages, and nr_pages=0 for 64K base pages. This doesn't end well.
So let's make the 32M size a floor and also ensure that we have at least 2 pages given the PMD size. With this change, the tests pass on arm64 64K base page size configuration.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryan Roberts <[email protected]> Acked-by: Peter Xu <[email protected]> Acked-by: Rafael Aquini <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| f3b92176 | 21-Feb-2025 |
Lorenzo Stoakes <[email protected]> |
tools/selftests: add guard region test for /proc/$pid/pagemap
Add a test to the guard region self tests to assert that the /proc/$pid/pagemap information now made availabile to the user correctly id
tools/selftests: add guard region test for /proc/$pid/pagemap
Add a test to the guard region self tests to assert that the /proc/$pid/pagemap information now made availabile to the user correctly identifies and reports guard regions.
As a part of this change, update vm_util.h to add the new bit (note there is no header file in the kernel where this is exposed, the user is expected to provide their own mask) and utilise the helper functions there for pagemap functionality.
[[email protected]: fixup define name] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/164feb0a43ae72650e6b20c3910213f469566311.1740139449.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Jann Horn <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Kalesh Singh <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Matthew Wilcow (Oracle) <[email protected]> Cc: "Paul E . McKenney" <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 5d2146a3 | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: skip mlock tests if nobody user can't read it
If running from a directory that can't be read by unprivileged users, executing on-fault-test via the nobody user will fail.
The kselftes
selftests/mm: skip mlock tests if nobody user can't read it
If running from a directory that can't be read by unprivileged users, executing on-fault-test via the nobody user will fail.
The kselftest build does give the file the correct permissions, but after being installed it might be in a directory without global execute permissions.
Since the script can't safely fix that, just skip if it happens. Note that the stderr of the `ls` command is unfiltered meaning the user sees a "permission denied" error that can help inform them why the test was skipped.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Cc: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| f896c6de | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: ensure uffd-wp-mremap gets pages of each size
This test allocates a page of every available size and doesn't have any SKIP logic if the allocation fails. So, ensure it's available and
selftests/mm: ensure uffd-wp-mremap gets pages of each size
This test allocates a page of every available size and doesn't have any SKIP logic if the allocation fails. So, ensure it's available and skip the test if we can't do so.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Cc: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 32b42970 | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: skip gup_longterm tests on weird filesystems
Some filesystems don't support ftruncate()ing unlinked files. They return ENOENT. In that case, skip the test.
Link: https://lkml.kernel
selftests/mm: skip gup_longterm tests on weird filesystems
Some filesystems don't support ftruncate()ing unlinked files. They return ENOENT. In that case, skip the test.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Cc: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 571a4b62 | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: skip map_populate on weird filesystems
It seems that 9pfs does not allow truncating unlinked files, Mark Brown has noted that NFS may also behave this way.
It doesn't seem quite right
selftests/mm: skip map_populate on weird filesystems
It seems that 9pfs does not allow truncating unlinked files, Mark Brown has noted that NFS may also behave this way.
It doesn't seem quite right to call this a "bug" but it's probably a special enough case that it makes sense for the test to just SKIP if it happens.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Cc: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| f4b3e6c7 | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: skip uffd-wp-mremap if userfaultfd not available
It's obvious that this should fail in that case, but still, save the reader the effort of figuring out that they've run into this by ju
selftests/mm: skip uffd-wp-mremap if userfaultfd not available
It's obvious that this should fail in that case, but still, save the reader the effort of figuring out that they've run into this by just SKIPping
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Reviewed-by: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 0046dbed | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: skip uffd-stress if userfaultfd not available
It's pretty obvious that the test wouldn't work if you don't have the feature enabled. But, it's still useful to SKIP instead of failing
selftests/mm: skip uffd-stress if userfaultfd not available
It's pretty obvious that the test wouldn't work if you don't have the feature enabled. But, it's still useful to SKIP instead of failing so the reader can immediately tell that this is the reason why.
Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Reviewed-by: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|
| 800ddf3c | 11-Mar-2025 |
Brendan Jackman <[email protected]> |
selftests/mm: report errno when things fail in gup_longterm
Patch series "selftests/mm: Some cleanups from trying to run them", v4.
I never had much luck running mm selftests so I spent a few hours
selftests/mm: report errno when things fail in gup_longterm
Patch series "selftests/mm: Some cleanups from trying to run them", v4.
I never had much luck running mm selftests so I spent a few hours digging into why.
Looks like most of the reason is missing SKIP checks, so this series is just adding a bunch of those that I found. I did not do anything like all of them, just the ones I spotted in gup_longterm, gup_test, mmap, userfaultfd and memfd_secret.
It's a bit unfortunate to have to skip those tests when ftruncate() fails, but I don't have time to dig deep enough into it to actually make them pass. I have observed the issue on 9pfs and heard rumours that NFS has a similar problem.
I'm now able to run these test groups successfully:
- mmap - gup_test - compaction - migration - page_frag - userfaultfd - mlock
I've never gone past "Waiting for hugetlb memory to get depleted", in the hugetlb tests. I don't know if they are stuck or if they would eventually work if I was patient enough (testing on a 1G machine). I have not investigated further.
I had some issues with mlock tests failing due to -ENOSRCH from mlock2(), I can no longer reproduce that though, things work OK now.
Of the remaining tests there may be others that work fine, but there's no convenient way to survey the whole output of run_vmtests.sh so I'm just going test by test here.
In my spare moments I am slowly chipping away at a setup to run these tests continuously in a reasonably hermetic QEMU environment via virtme-ng:
https://github.com/bjackman/linux/blob/5fad4b9c592290f38e0f8bc73c9abb9c99d8787c/README.md
Hopefully that will eventually offer a way to provide a "canned" environment where the tests are known to work, which can be fairly easily reproduced by any developer.
This patch (of 12):
Just reporting failure doesn't tell you what went wrong. This can fail in different ways so report errno to help the reader get started debugging.
Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Brendan Jackman <[email protected]> Reviewed-by: Dev Jain <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Mateusz Guzik <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
show more ...
|