* [PATCH 1/4] selftest/arm64: Print TAP header
2026-08-20 15:33 [PATCH 0/4] selftest/arm64: Fix MTE test setup and TAP reporting Muhammad Usama Anjum
@ 2026-08-20 15:33 ` Muhammad Usama Anjum
2026-08-20 15:43 ` Mark Brown
2026-08-20 15:33 ` [PATCH 2/4] selftest/arm64: Treat KSM merge_across_nodes as optional Muhammad Usama Anjum
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-20 15:33 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Mark Brown, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
Cc: Muhammad Usama Anjum
The test sets a TAP plan and emits a result but does not print the TAP
version header. Direct execution therefore starts with:
1..1
instead of "TAP version 13", leaving the output malformed for TAP
consumers.
Print the kselftest header before the plan, matching the other arm64 MTE
tests.
Fixes: 29f080881601 ("kselftest/arm64: check GCR_EL1 after context switch")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
index 325bca0de0f6e..d23f154d3288c 100644
--- a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
+++ b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
@@ -131,6 +131,7 @@ int main(int argc, char *argv[])
if (err)
return err;
+ ksft_print_header();
ksft_set_plan(1);
evaluate_test(mte_gcr_fork_test(),
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 1/4] selftest/arm64: Print TAP header
2026-08-20 15:33 ` [PATCH 1/4] selftest/arm64: Print TAP header Muhammad Usama Anjum
@ 2026-08-20 15:43 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2026-08-20 15:43 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
[-- Attachment #1: Type: text/plain, Size: 443 bytes --]
On Thu, Aug 20, 2026 at 04:33:23PM +0100, Muhammad Usama Anjum wrote:
> The test sets a TAP plan and emits a result but does not print the TAP
> version header. Direct execution therefore starts with:
>
> 1..1
>
> instead of "TAP version 13", leaving the output malformed for TAP
> consumers.
>
> Print the kselftest header before the plan, matching the other arm64 MTE
> tests.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/4] selftest/arm64: Treat KSM merge_across_nodes as optional
2026-08-20 15:33 [PATCH 0/4] selftest/arm64: Fix MTE test setup and TAP reporting Muhammad Usama Anjum
2026-08-20 15:33 ` [PATCH 1/4] selftest/arm64: Print TAP header Muhammad Usama Anjum
@ 2026-08-20 15:33 ` Muhammad Usama Anjum
2026-08-20 16:09 ` Mark Brown
2026-08-20 15:33 ` [PATCH 3/4] selftest/arm64: Fix MTE prctl TAP plan Muhammad Usama Anjum
2026-08-20 15:33 ` [PATCH 4/4] selftest/arm64: Add MTE test config fragment Muhammad Usama Anjum
3 siblings, 1 reply; 11+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-20 15:33 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Mark Brown, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
Cc: Muhammad Usama Anjum
The MTE KSM test unconditionally saves, enables and restores the
merge_across_nodes sysfs attribute. The kernel only creates this
attribute when CONFIG_NUMA=y. A non-NUMA kernel consequently prints the
following message three times even though all KSM subtests pass:
# ERR: missing /sys/kernel/mm/ksm/merge_across_nodes
Check whether the attribute exists and only access it when present. This
preserves the existing setup and restore behavior on NUMA kernels without
requiring NUMA or reducing KSM coverage on single-node systems.
Fixes: f981d8fa2646 ("kselftest/arm64: Verify KSM page merge for MTE pages")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
.../testing/selftests/arm64/mte/check_ksm_options.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/arm64/mte/check_ksm_options.c b/tools/testing/selftests/arm64/mte/check_ksm_options.c
index 0cf5faef17248..b36945fc883d3 100644
--- a/tools/testing/selftests/arm64/mte/check_ksm_options.c
+++ b/tools/testing/selftests/arm64/mte/check_ksm_options.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -22,6 +23,7 @@
static size_t page_sz;
static unsigned long ksm_sysfs[5];
+static bool has_merge_across_nodes;
static unsigned long read_sysfs(char *str)
{
@@ -56,8 +58,11 @@ static void write_sysfs(char *str, unsigned long val)
static void mte_ksm_setup(void)
{
- ksm_sysfs[0] = read_sysfs(PATH_KSM "merge_across_nodes");
- write_sysfs(PATH_KSM "merge_across_nodes", 1);
+ has_merge_across_nodes = !access(PATH_KSM "merge_across_nodes", F_OK);
+ if (has_merge_across_nodes) {
+ ksm_sysfs[0] = read_sysfs(PATH_KSM "merge_across_nodes");
+ write_sysfs(PATH_KSM "merge_across_nodes", 1);
+ }
ksm_sysfs[1] = read_sysfs(PATH_KSM "sleep_millisecs");
write_sysfs(PATH_KSM "sleep_millisecs", 0);
ksm_sysfs[2] = read_sysfs(PATH_KSM "run");
@@ -70,7 +75,8 @@ static void mte_ksm_setup(void)
static void mte_ksm_restore(void)
{
- write_sysfs(PATH_KSM "merge_across_nodes", ksm_sysfs[0]);
+ if (has_merge_across_nodes)
+ write_sysfs(PATH_KSM "merge_across_nodes", ksm_sysfs[0]);
write_sysfs(PATH_KSM "sleep_millisecs", ksm_sysfs[1]);
write_sysfs(PATH_KSM "run", ksm_sysfs[2]);
write_sysfs(PATH_KSM "max_page_sharing", ksm_sysfs[3]);
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 2/4] selftest/arm64: Treat KSM merge_across_nodes as optional
2026-08-20 15:33 ` [PATCH 2/4] selftest/arm64: Treat KSM merge_across_nodes as optional Muhammad Usama Anjum
@ 2026-08-20 16:09 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2026-08-20 16:09 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
[-- Attachment #1: Type: text/plain, Size: 775 bytes --]
On Thu, Aug 20, 2026 at 04:33:24PM +0100, Muhammad Usama Anjum wrote:
> The MTE KSM test unconditionally saves, enables and restores the
> merge_across_nodes sysfs attribute. The kernel only creates this
> attribute when CONFIG_NUMA=y. A non-NUMA kernel consequently prints the
> following message three times even though all KSM subtests pass:
> static void mte_ksm_setup(void)
> {
> - ksm_sysfs[0] = read_sysfs(PATH_KSM "merge_across_nodes");
> - write_sysfs(PATH_KSM "merge_across_nodes", 1);
> + has_merge_across_nodes = !access(PATH_KSM "merge_across_nodes", F_OK);
Don't we need the file to be readable and writable, not just extant?
Looking quickly at the test I'm actually not spotting where it checks
that it's running as root which I think it needs in general.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/4] selftest/arm64: Fix MTE prctl TAP plan
2026-08-20 15:33 [PATCH 0/4] selftest/arm64: Fix MTE test setup and TAP reporting Muhammad Usama Anjum
2026-08-20 15:33 ` [PATCH 1/4] selftest/arm64: Print TAP header Muhammad Usama Anjum
2026-08-20 15:33 ` [PATCH 2/4] selftest/arm64: Treat KSM merge_across_nodes as optional Muhammad Usama Anjum
@ 2026-08-20 15:33 ` Muhammad Usama Anjum
2026-08-20 16:14 ` Mark Brown
2026-08-20 15:33 ` [PATCH 4/4] selftest/arm64: Add MTE test config fragment Muhammad Usama Anjum
3 siblings, 1 reply; 11+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-20 15:33 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Mark Brown, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
Cc: Muhammad Usama Anjum
The MTE prctl test emits one result from check_basic_read() followed by
one result for each of the seven entries in mte_modes[]. However, the TAP
plan only accounts for the array entries, producing:
# Planned tests != run tests (7 != 8)
Include the basic read check in the plan so that all eight emitted results
are declared.
Fixes: 1f488fb91378 ("kselftest/arm64/mte: Add MTE_STORE_ONLY testcases")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/arm64/mte/check_prctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/arm64/mte/check_prctl.c b/tools/testing/selftests/arm64/mte/check_prctl.c
index f7f320defa7b9..d16a91117eef9 100644
--- a/tools/testing/selftests/arm64/mte/check_prctl.c
+++ b/tools/testing/selftests/arm64/mte/check_prctl.c
@@ -119,7 +119,7 @@ int main(void)
int i;
ksft_print_header();
- ksft_set_plan(ARRAY_SIZE(mte_modes));
+ ksft_set_plan(ARRAY_SIZE(mte_modes) + 1);
check_basic_read();
for (i = 0; i < ARRAY_SIZE(mte_modes); i++)
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 3/4] selftest/arm64: Fix MTE prctl TAP plan
2026-08-20 15:33 ` [PATCH 3/4] selftest/arm64: Fix MTE prctl TAP plan Muhammad Usama Anjum
@ 2026-08-20 16:14 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2026-08-20 16:14 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
[-- Attachment #1: Type: text/plain, Size: 473 bytes --]
On Thu, Aug 20, 2026 at 04:33:25PM +0100, Muhammad Usama Anjum wrote:
> The MTE prctl test emits one result from check_basic_read() followed by
> one result for each of the seven entries in mte_modes[]. However, the TAP
> plan only accounts for the array entries, producing:
>
> # Planned tests != run tests (7 != 8)
>
> Include the basic read check in the plan so that all eight emitted results
> are declared.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/4] selftest/arm64: Add MTE test config fragment
2026-08-20 15:33 [PATCH 0/4] selftest/arm64: Fix MTE test setup and TAP reporting Muhammad Usama Anjum
` (2 preceding siblings ...)
2026-08-20 15:33 ` [PATCH 3/4] selftest/arm64: Fix MTE prctl TAP plan Muhammad Usama Anjum
@ 2026-08-20 15:33 ` Muhammad Usama Anjum
2026-08-20 15:38 ` Mark Brown
3 siblings, 1 reply; 11+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-20 15:33 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Mark Brown, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
Cc: Muhammad Usama Anjum
The arm64 selftest collection has no Kconfig fragment, so kernels built
with the selftest requirements are not guaranteed to provide the support
used by the MTE tests.
Add a fragment covering the userspace MTE and tagged-address ABIs, KSM
and its sysfs interface, explicit HugeTLB mappings and their proc/sysctl
interfaces, and tmpfs-backed file mappings.
Do not request NUMA solely for the optional KSM merge_across_nodes.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
---
tools/testing/selftests/arm64/mte/config | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 tools/testing/selftests/arm64/mte/config
diff --git a/tools/testing/selftests/arm64/mte/config b/tools/testing/selftests/arm64/mte/config
new file mode 100644
index 0000000000000..8587ce70c294a
--- /dev/null
+++ b/tools/testing/selftests/arm64/mte/config
@@ -0,0 +1,8 @@
+CONFIG_ARM64_MTE=y
+CONFIG_ARM64_TAGGED_ADDR_ABI=y
+CONFIG_HUGETLBFS=y
+CONFIG_KSM=y
+CONFIG_PROC_FS=y
+CONFIG_SYSCTL=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
--
2.47.3
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH 4/4] selftest/arm64: Add MTE test config fragment
2026-08-20 15:33 ` [PATCH 4/4] selftest/arm64: Add MTE test config fragment Muhammad Usama Anjum
@ 2026-08-20 15:38 ` Mark Brown
2026-08-20 15:42 ` Muhammad Usama Anjum
0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2026-08-20 15:38 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
On Thu, Aug 20, 2026 at 04:33:26PM +0100, Muhammad Usama Anjum wrote:
> The arm64 selftest collection has no Kconfig fragment, so kernels built
> with the selftest requirements are not guaranteed to provide the support
> used by the MTE tests.
> tools/testing/selftests/arm64/mte/config | 8 ++++++++
Is tooling going to pick this up or should this be at the arm64/ level?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] selftest/arm64: Add MTE test config fragment
2026-08-20 15:38 ` Mark Brown
@ 2026-08-20 15:42 ` Muhammad Usama Anjum
2026-08-20 16:42 ` Mark Brown
0 siblings, 1 reply; 11+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-20 15:42 UTC (permalink / raw)
To: Mark Brown
Cc: usama.anjum, Catalin Marinas, Will Deacon, Mark Rutland,
Shuah Khan, Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
On 20/08/2026 4:38 pm, Mark Brown wrote:
> On Thu, Aug 20, 2026 at 04:33:26PM +0100, Muhammad Usama Anjum wrote:
>> The arm64 selftest collection has no Kconfig fragment, so kernels built
>> with the selftest requirements are not guaranteed to provide the support
>> used by the MTE tests.
>
>> tools/testing/selftests/arm64/mte/config | 8 ++++++++
>
> Is tooling going to pick this up or should this be at the arm64/ level?
Yes, it will be picked up. The top-level kselftest-merge target recursively
finds every file named config under tools/testing/selftests, so
arm64/mte/config is included.
--
Thanks,
Usama
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] selftest/arm64: Add MTE test config fragment
2026-08-20 15:42 ` Muhammad Usama Anjum
@ 2026-08-20 16:42 ` Mark Brown
0 siblings, 0 replies; 11+ messages in thread
From: Mark Brown @ 2026-08-20 16:42 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Catalin Marinas, Will Deacon, Mark Rutland, Shuah Khan,
Andrey Konovalov, Andrew Morton, Vincenzo Frascino,
Amit Daniel Kachhap, Yeoreum Yun, open list,
moderated list:ARM64 PORT (AARCH64 ARCHITECTURE),
open list:KERNEL SELFTEST FRAMEWORK
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
On Thu, Aug 20, 2026 at 04:42:16PM +0100, Muhammad Usama Anjum wrote:
> On 20/08/2026 4:38 pm, Mark Brown wrote:
> > Is tooling going to pick this up or should this be at the arm64/ level?
> Yes, it will be picked up. The top-level kselftest-merge target recursively
> finds every file named config under tools/testing/selftests, so
> arm64/mte/config is included.
That's good, though looking at the list we have requirements for
CONFIG_SYSFS in other tests, probably some of the other stuff as well so
we should either do something at the top level or decide we're going to
do this independently for all the subdirectories. Top level seems
easier TBH.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread