Skip to contentSkip to conversation

selftests/mm: Add CONFIG_FTRACE to config

PATCH In review Dev Jain 6 participants 10 messages Jun 11, 2025 – Jun 12, 2025

Subsystems (3)
lore
Share & tools
lore

Dev Jain

author
#0 lore raw

PATCH 1/1 selftests/mm: Add CONFIG_FTRACE to config

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

  7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
  7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
  7153 12:46:54.639306  # # fopen: No such file or directory
  7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
  7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
  7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
  7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

Fixes efe99fabeb11b ("selftests/mm: add test about uprobe pte be orphan during vma merge")
---
 tools/testing/selftests/mm/config | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mm/config +1 -0
index a28baa536332..e600b41030c1 100644
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_MEM_SOFT_DIRTY=y
 CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y
Signature · 1 line
2.30.2
Tested-by on v1 1/1
#1 lore raw

Tested the patch on v6.16-rc1.

After applying the patch, I re-ran the kselftest-mm test suite. The specific test 'merge.handle_uprobe_upon_merged_vma' now passes successfully, and the issue is no longer observed.

#2 lore raw
In reply to Dev Jain
Quoted 12 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

  7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
  7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
  7153 12:46:54.639306  # # fopen: No such file or directory
  7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
  7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
  7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
  7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma
Quoted 3 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

While I did consider this before sending my patch, not every architecture supports uprobes :/ So this isn't a complete fix.

Also, does every architecture support ftrace? If not (and it does not seem so, e.g there's an ARM variant that does not), I would guess this config fragment blows up.

Signature · 1 line
Pedro
author
#3 lore raw
Quoted 16 lines · Pedro Falcato
Quoted 12 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

   7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
   7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
   7153 12:46:54.639306  # # fopen: No such file or directory
   7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
   7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
   7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
   7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma
Quoted 3 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

Quoted 6 lines

While I did consider this before sending my patch, not every architecture supports uprobes :/ So this isn't a complete fix.

Also, does every architecture support ftrace? If not (and it does not seem so, e.g there's an ARM variant that does not), I would guess this config fragment blows up.

Sorry forgot to reply.

What do you mean by "config fragment blows up"? I think scripts will just pull these configs and build the kernel, and if the config is not supported, it will be thrown out of .config, and after applying your patch, the test will be skipped, so everyone is happy I guess?

Quoted 1 line

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#4 lore raw
Quoted 25 lines · Dev Jain
Quoted 16 lines · Pedro Falcato
Quoted 12 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

   7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
   7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
   7153 12:46:54.639306  # # fopen: No such file or directory
   7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
   7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
   7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
   7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma
Quoted 3 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

Quoted 6 lines

While I did consider this before sending my patch, not every architecture supports uprobes :/ So this isn't a complete fix.

Also, does every architecture support ftrace? If not (and it does not seem so, e.g there's an ARM variant that does not), I would guess this config fragment blows up.

Quoted 6 lines

Sorry forgot to reply.

What do you mean by "config fragment blows up"? I think scripts will just pull these configs and build the kernel, and if the config is not supported, it will be thrown out of .config, and after applying your patch, the test will be skipped, so everyone is happy I guess?

Right, I spoke with Mark Brown off-list and apparently it should be safe to add unsupported config options there (and I wasn't sure about that, maybe it could fail, or maybe kbuild would fail, or<...>). So yeah, I'm fully supportive of a patch adding CONFIG_UPROBES.

-
Pedro

Reviewed-by on v1 1/1
#5 lore raw
In reply to Dev Jain

Thanks for this!

Quoted 12 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

  7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
  7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
  7153 12:46:54.639306  # # fopen: No such file or directory
  7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
  7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
  7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
  7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma
Quoted 3 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

OK I see the dependency chain here:

menuconfig FTRACE
bool "Tracers"
depends on TRACING_SUPPORT
default y if DEBUG_KERNEL
help
Enable the kernel tracing infrastructure.

if FTRACE

...

endif # FTRACE

..

config UPROBE_EVENTS
bool "Enable uprobes-based dynamic events" depends on ARCH_SUPPORTS_UPROBES depends on MMU
depends on PERF_EVENTS
select UPROBES
select PROBE_EVENTS
select DYNAMIC_EVENTS
select TRACING
default y

...

However we also need PERF_EVENTS w, which is defaulted to y if CONFIG_PROFILING is set:

config PERF_EVENTS
bool "Kernel performance events and counters" default y if PROFILING
depends on HAVE_PERF_EVENTS
select IRQ_WORK

...

config PROFILING
bool "Profiling support"
help
Say Y here to enable the extended profiling support mechanisms used by profilers.

So maybe to be totally and completely pedantic we should add CONFIG_PROFILING here too.

Quoted 4 lines
Fixes efe99fabeb11b ("selftests/mm: add test about uprobe pte be orphan during vma merge")

This is already (semi-)addressed by
https://lore.kernel.org/linux-mm/[email protected]/,
perhaps worth mentioning?

Pedro's patch is still important, as for any system that hasn't happened to set this up, we get a skip + information rather than a failure.

Quoted 1 line

This looks correct, see above for nits etc. but:

Quoted 16 lines
---
 tools/testing/selftests/mm/config | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/mm/config +1 -1
index a28baa536332..e600b41030c1 100644
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_MEM_SOFT_DIRTY=y
 CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y
--

2.30.2

author
#6 lore raw
Quoted 61 lines · Lorenzo Stoakes

Thanks for this!

Quoted 12 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

   7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
   7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
   7153 12:46:54.639306  # # fopen: No such file or directory
   7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
   7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
   7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
   7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma
Quoted 3 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

OK I see the dependency chain here:

menuconfig FTRACE
bool "Tracers"
depends on TRACING_SUPPORT
default y if DEBUG_KERNEL
help
Enable the kernel tracing infrastructure.

if FTRACE

...

endif # FTRACE

..

config UPROBE_EVENTS
bool "Enable uprobes-based dynamic events"
depends on ARCH_SUPPORTS_UPROBES
depends on MMU
depends on PERF_EVENTS
select UPROBES
select PROBE_EVENTS
select DYNAMIC_EVENTS
select TRACING
default y

...

However we also need PERF_EVENTS w, which is defaulted to y if CONFIG_PROFILING is set:

config PERF_EVENTS
bool "Kernel performance events and counters" default y if PROFILING
depends on HAVE_PERF_EVENTS
select IRQ_WORK

...

Quoted 8 lines

config PROFILING
bool "Profiling support"
help
Say Y here to enable the extended profiling support mechanisms used by profilers.

So maybe to be totally and completely pedantic we should add CONFIG_PROFILING here too.

I don't totally understand this config stuff but I will trust you and update this in v2 : )

Quoted 8 lines
Quoted 4 lines
Fixes efe99fabeb11b ("selftests/mm: add test about uprobe pte be orphan during vma merge")

This is already (semi-)addressed by
https://lore.kernel.org/linux-mm/[email protected]/,
perhaps worth mentioning?

Quoted 7 lines

Pedro's patch is still important, as for any system that hasn't happened to set this up, we get a skip + information rather than a failure.

Quoted 1 line

This looks correct, see above for nits etc. but:

Thanks.

Quoted 5 lines
Quoted 5 lines
---
  tools/testing/selftests/mm/config | 1 +
  1 file changed, 1 insertion(+)
Quoted 12 lines
Quoted 10 lines
tools/testing/selftests/mm/config +1 -1
index a28baa536332..e600b41030c1 100644
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
  CONFIG_TRANSPARENT_HUGEPAGE=y
  CONFIG_MEM_SOFT_DIRTY=y
  CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y
--
Quoted 2 lines

2.30.2

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#7 lore raw
In reply to Dev Jain
Quoted 1 line · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

...

tools/testing/selftests/mm/config CONFIG_GUP_TEST=y · line 11

Quoted 10 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

+++ b/tools/testing/selftests/mm/config

tools/testing/selftests/mm/config +1 -0
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_MEM_SOFT_DIRTY=y
 CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y

If we need UPROBES we should enable UPROBES explicitly, otherwise it looks like we're just randomly enabling FTRACE even though it's not used itself. If it's a dependency for UPROBES and we also enable UPROBES that's a bit more obvious.

author
#8 lore raw
Quoted 5 lines · Mark Brown
Quoted 1 line · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

...

Quoted 13 lines

tools/testing/selftests/mm/config CONFIG_GUP_TEST=y · line 11

Quoted 9 lines

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.
+++ b/tools/testing/selftests/mm/config

tools/testing/selftests/mm/config +1 -0
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
  CONFIG_TRANSPARENT_HUGEPAGE=y
  CONFIG_MEM_SOFT_DIRTY=y
  CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y

If we need UPROBES we should enable UPROBES explicitly, otherwise it looks like we're just randomly enabling FTRACE even though it's not used itself. If it's a dependency for UPROBES and we also enable UPROBES that's a bit more obvious.

Fair point actually; I'll send a v2 if no other objections are there.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Tested-by on v1 1/1
#9 lore raw
In reply to Dev Jain
Quoted 29 lines · Dev Jain

If CONFIG_UPROBES is not set, a merge subtest fails:

Failure log:

   7151 12:46:54.627936  # # #  RUN           merge.handle_uprobe_upon_merged_vma ...
   7152 12:46:54.639014  # # f /sys/bus/event_source/devices/uprobe/type
   7153 12:46:54.639306  # # fopen: No such file or directory
   7154 12:46:54.650451  # # # merge.c:473:handle_uprobe_upon_merged_vma:Expected read_sysfs("/sys/bus/event_source/devices/uprobe/type", &type) (1) == 0 (0)
   7155 12:46:54.650730  # # # handle_uprobe_upon_merged_vma: Test terminated by assertion
   7156 12:46:54.661750  # # #          FAIL  merge.handle_uprobe_upon_merged_vma
   7157 12:46:54.662030  # # not ok 8 merge.handle_uprobe_upon_merged_vma

CONFIG_UPROBES is enabled by CONFIG_UPROBE_EVENTS, which gets enabled by CONFIG_FTRACE. Therefore add this config to selftests/mm/config so that CI systems can include this config in the kernel build.

Fixes efe99fabeb11b ("selftests/mm: add test about uprobe pte be orphan during vma merge")
---
  tools/testing/selftests/mm/config | 1 +
  1 file changed, 1 insertion(+)
tools/testing/selftests/mm/config +0 -0
index a28baa536332..e600b41030c1 100644

tools/testing/selftests/mm/config CONFIG_GUP_TEST=y · line 11

Quoted 4 lines
tools/testing/selftests/mm/config +1 -0
@@ -8,3 +8,4 @@ CONFIG_GUP_TEST=y
  CONFIG_TRANSPARENT_HUGEPAGE=y
  CONFIG_MEM_SOFT_DIRTY=y
  CONFIG_ANON_VMA_NAME=y
+CONFIG_FTRACE=y

I have tested this patch, and it is working fine.

ok 7 merge.forked_source_vma
#  RUN           merge.handle_uprobe_upon_merged_vma ... #            OK  merge.handle_uprobe_upon_merged_vma ok 8 merge.handle_uprobe_upon_merged_vma
# PASSED: 8 / 8 tests passed.