2023-01-07 14:02:41

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 0/3] selftests/tracing: Fix some testcases for recent change

This includes some patches to fix 2 issues on ftrace selftests.

- eprobe filter and eprobe syntax test case were introduced but it
doesn't check whether the kernel supports eprobe filter. Thus the
new test case fails on the kernel which has eprobe but not support
eprobe filter. To solve this issue, add a filter description to
README file [1/3] and run the filter syntax error test only if the
description is found in the README file [2/3].

- Recently objtool adds prefix symbols for the function padding nops,
and the probepoint test case fails because this probepoint test case
tests whether the kprobe event can probe the target function and the
functions next to the target function. But the prefix symbols can not
be probed. Thus these prefix symbols must be skipped [3/3].

Thank you,

---

Masami Hiramatsu (Google) (3):
tracing/eprobe: Fix to add filter on eprobe description in README file
selftests/ftrace: Fix eprobe syntax test case to check filter support
selftests/ftrace: Fix probepoint testcase to ignore __pfx_* symbols


kernel/trace/trace.c | 2 +-
.../test.d/dynevent/eprobes_syntax_errors.tc | 4 +++-
.../selftests/ftrace/test.d/kprobe/probepoint.tc | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)

--
Masami Hiramatsu (Google) <[email protected]>


2023-01-07 14:04:41

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 1/3] tracing/eprobe: Fix to add filter on eprobe description in README file

From: Masami Hiramatsu (Google) <[email protected]>

Fix to add a description of the filter on eprobe in README file. This
is required to identify the kernel supports the filter on eprobe or not.

Fixes: 752be5c5c910 ("tracing/eprobe: Add eprobe filter support")
Cc: [email protected]
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
---
kernel/trace/trace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a555a861b978..d0c22766dc26 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5598,7 +5598,7 @@ static const char readme_msg[] =
#ifdef CONFIG_HIST_TRIGGERS
"\t s:[synthetic/]<event> <field> [<field>]\n"
#endif
- "\t e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>]\n"
+ "\t e[:[<group>/][<event>]] <attached-group>.<attached-event> [<args>] [if <filter>]\n"
"\t -:[<group>/][<event>]\n"
#ifdef CONFIG_KPROBE_EVENTS
"\t place: [<module>:]<symbol>[+<offset>]|<memaddr>\n"

2023-01-07 14:06:57

by Masami Hiramatsu

[permalink] [raw]
Subject: [PATCH 3/3] selftests/ftrace: Fix probepoint testcase to ignore __pfx_* symbols

From: Masami Hiramatsu (Google) <[email protected]>

Fix kprobe probepoint testcase to ignore __pfx_* prefix symbols. Those are
introduced by commit b341b20d648b ("x86: Add prefix symbols for function
padding") for identifying PADDING_BYTES of NOPs. Since kprobe events can
not probe these prefix symbols, this testcase has to skip those symbols.

Fixes: b341b20d648b ("x86: Add prefix symbols for function padding")
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
---
.../selftests/ftrace/test.d/kprobe/probepoint.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc b/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
index 624269c8d534..68425987a5dd 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
@@ -21,7 +21,7 @@ set_offs() { # prev target next

# We have to decode symbol addresses to get correct offsets.
# If the offset is not an instruction boundary, it cause -EILSEQ.
-set_offs `grep -A1 -B1 ${TARGET_FUNC} /proc/kallsyms | cut -f 1 -d " " | xargs`
+set_offs `grep -v __pfx_ /proc/kallsyms | grep -A1 -B1 ${TARGET_FUNC} | cut -f 1 -d " " | xargs`

UINT_TEST=no
# printf "%x" -1 returns (unsigned long)-1.

2023-01-08 21:49:33

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 0/3] selftests/tracing: Fix some testcases for recent change

On Sat, 7 Jan 2023 22:32:08 +0900
"Masami Hiramatsu (Google)" <[email protected]> wrote:

> This includes some patches to fix 2 issues on ftrace selftests.
>
> - eprobe filter and eprobe syntax test case were introduced but it
> doesn't check whether the kernel supports eprobe filter. Thus the
> new test case fails on the kernel which has eprobe but not support
> eprobe filter. To solve this issue, add a filter description to
> README file [1/3] and run the filter syntax error test only if the
> description is found in the README file [2/3].
>
> - Recently objtool adds prefix symbols for the function padding nops,
> and the probepoint test case fails because this probepoint test case
> tests whether the kprobe event can probe the target function and the
> functions next to the target function. But the prefix symbols can not
> be probed. Thus these prefix symbols must be skipped [3/3].
>
> Thank you,
>
> ---
>
> Masami Hiramatsu (Google) (3):
> tracing/eprobe: Fix to add filter on eprobe description in README file
> selftests/ftrace: Fix eprobe syntax test case to check filter support
> selftests/ftrace: Fix probepoint testcase to ignore __pfx_* symbols
>
>

Reviewed-by: Steven Rostedt (Google) <[email protected]>

-- Steve

2023-01-26 20:43:22

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 0/3] selftests/tracing: Fix some testcases for recent change

On 1/8/23 14:31, Steven Rostedt wrote:
> On Sat, 7 Jan 2023 22:32:08 +0900
> "Masami Hiramatsu (Google)" <[email protected]> wrote:
>
>> This includes some patches to fix 2 issues on ftrace selftests.
>>
>> - eprobe filter and eprobe syntax test case were introduced but it
>> doesn't check whether the kernel supports eprobe filter. Thus the
>> new test case fails on the kernel which has eprobe but not support
>> eprobe filter. To solve this issue, add a filter description to
>> README file [1/3] and run the filter syntax error test only if the
>> description is found in the README file [2/3].
>>
>> - Recently objtool adds prefix symbols for the function padding nops,
>> and the probepoint test case fails because this probepoint test case
>> tests whether the kprobe event can probe the target function and the
>> functions next to the target function. But the prefix symbols can not
>> be probed. Thus these prefix symbols must be skipped [3/3].
>>
>> Thank you,
>>
>> ---
>>
>> Masami Hiramatsu (Google) (3):
>> tracing/eprobe: Fix to add filter on eprobe description in README file
>> selftests/ftrace: Fix eprobe syntax test case to check filter support
>> selftests/ftrace: Fix probepoint testcase to ignore __pfx_* symbols
>>
>>
>
> Reviewed-by: Steven Rostedt (Google) <[email protected]>
>
> -- Steve
>

For selftest patches in the series: (Assuming patches 2&3 depend on patch 1.)

Acked-by: Shuah Khan <[email protected]>

thanks,
-- Shuah