mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc
@ 2026-09-09  9:29 Sven Schnelle
  2026-09-09 17:41 ` Steven Rostedt
  2026-09-09 23:41 ` Masami Hiramatsu
  0 siblings, 2 replies; 4+ messages in thread
From: Sven Schnelle @ 2026-09-09  9:29 UTC (permalink / raw)
  To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan
  Cc: linux-kernel, linux-trace-kernel, linux-kselftest

The current regex also matches symbols in modules, which makes the
test fail on s390 where name_show is present only once in the kernel,
but also multiple times in modules:

000001b1401cdc20 t name_show
000001b0c05e6c40 t name_show    [mdev]
000001b0c0495f30 t name_show    [i2c_core]

Fix this by changing the regular expression to only match the function
name.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
---
 .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
index bc9514428dba..07b1177c1634 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
@@ -6,7 +6,7 @@
 SYMBOL='name_show'
 
 # We skip this test on kernel where SYMBOL is unique or does not exist.
-if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then
+if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
 	exit_unsupported
 fi
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc
  2026-09-09  9:29 [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc Sven Schnelle
@ 2026-09-09 17:41 ` Steven Rostedt
  2026-09-10  0:01   ` Masami Hiramatsu
  2026-09-09 23:41 ` Masami Hiramatsu
  1 sibling, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2026-09-09 17:41 UTC (permalink / raw)
  To: Sven Schnelle
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan, linux-kernel,
	linux-trace-kernel, linux-kselftest

On Wed,  9 Sep 2026 11:29:53 +0200
Sven Schnelle <svens@linux.ibm.com> wrote:

> The current regex also matches symbols in modules, which makes the
> test fail on s390 where name_show is present only once in the kernel,
> but also multiple times in modules:
> 
> 000001b1401cdc20 t name_show
> 000001b0c05e6c40 t name_show    [mdev]
> 000001b0c0495f30 t name_show    [i2c_core]
> 
> Fix this by changing the regular expression to only match the function
> name.
> 
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> ---
>  .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> index bc9514428dba..07b1177c1634 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> @@ -6,7 +6,7 @@
>  SYMBOL='name_show'
>  
>  # We skip this test on kernel where SYMBOL is unique or does not exist.
> -if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then
> +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
>  	exit_unsupported
>  fi
>  

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

But I wonder if "type_show" or "init_once" is a better option than
"name_show"?

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc
  2026-09-09  9:29 [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc Sven Schnelle
  2026-09-09 17:41 ` Steven Rostedt
@ 2026-09-09 23:41 ` Masami Hiramatsu
  1 sibling, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2026-09-09 23:41 UTC (permalink / raw)
  To: Sven Schnelle
  Cc: Steven Rostedt, Mathieu Desnoyers, Shuah Khan, linux-kernel,
	linux-trace-kernel, linux-kselftest

On Wed,  9 Sep 2026 11:29:53 +0200
Sven Schnelle <svens@linux.ibm.com> wrote:

> The current regex also matches symbols in modules, which makes the
> test fail on s390 where name_show is present only once in the kernel,
> but also multiple times in modules:
> 
> 000001b1401cdc20 t name_show
> 000001b0c05e6c40 t name_show    [mdev]
> 000001b0c0495f30 t name_show    [i2c_core]
> 
> Fix this by changing the regular expression to only match the function
> name.

Ah, nice catch! I'll add this fixes tag.

Fixes: 03b80ff8023a ("selftests/ftrace: Add new test case which checks non unique symbol")

Thanks,

> 
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> ---
>  .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> index bc9514428dba..07b1177c1634 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> @@ -6,7 +6,7 @@
>  SYMBOL='name_show'
>  
>  # We skip this test on kernel where SYMBOL is unique or does not exist.
> -if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then
> +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
>  	exit_unsupported
>  fi
>  
> -- 
> 2.53.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc
  2026-09-09 17:41 ` Steven Rostedt
@ 2026-09-10  0:01   ` Masami Hiramatsu
  0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2026-09-10  0:01 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Sven Schnelle, Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan,
	linux-kernel, linux-trace-kernel, linux-kselftest

On Wed, 9 Sep 2026 13:41:56 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed,  9 Sep 2026 11:29:53 +0200
> Sven Schnelle <svens@linux.ibm.com> wrote:
> 
> > The current regex also matches symbols in modules, which makes the
> > test fail on s390 where name_show is present only once in the kernel,
> > but also multiple times in modules:
> > 
> > 000001b1401cdc20 t name_show
> > 000001b0c05e6c40 t name_show    [mdev]
> > 000001b0c0495f30 t name_show    [i2c_core]
> > 
> > Fix this by changing the regular expression to only match the function
> > name.
> > 
> > Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> > ---
> >  .../selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc    | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> > index bc9514428dba..07b1177c1634 100644
> > --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> > +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
> > @@ -6,7 +6,7 @@
> >  SYMBOL='name_show'
> >  
> >  # We skip this test on kernel where SYMBOL is unique or does not exist.
> > -if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then
> > +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
> >  	exit_unsupported
> >  fi
> >  
> 
> Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
> 
> But I wonder if "type_show" or "init_once" is a better option than
> "name_show"?

Yeah, we have many other candidates :)

$ grep -E '[[:alnum:]]+ t [[:alpha:]][[:alnum:]_]+$' /proc/kallsyms | cut -d " " -f 3  | sort | uniq -cd | sort -nr | head 
     27 p4d_offset
     20 type_show
     20 dev_attr_name
     17 dev_attr_modalias
     16 pfn_to_mfn
     15 name_show
     14 modalias_show
     14 dev_attr_type
     13 init_once
     13 format_attr_event

Maybe we can just fallback to this logic for finding available symbols?

Thanks,

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-10  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09  9:29 [PATCH] selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc Sven Schnelle
2026-09-09 17:41 ` Steven Rostedt
2026-09-10  0:01   ` Masami Hiramatsu
2026-09-09 23:41 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®