From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v20 09/11] selftests: tracing: Add wprobe trigger testcases
Date: Mon, 16 Nov 2026 05:52:02 +0000 [thread overview]
Message-ID: <sashiko-outbox-216232@kernel.org> (raw)
In-Reply-To: <179480685671.38065.18275795234795685673.stgit@devnote2>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests: ftrace: race checking count=1 on active timer in
trigger-wprobe.tc
- [Low] selftests: ftrace: race truncating dynamic_events after wprobe
trigger removal
--
commit 99426394cee3a23084f980a46322a802a391dabe
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>
selftests: tracing: Add wprobe trigger testcases
This commit adds ftrace selftests covering set_wprobe and clear_wprobe
event triggers, including CPU hotplug and trigger syntax error checks.
Link: https://lore.kernel.org/all/59637b96946653393a7ad3c7de094094796b39c2.1785067572.git.wangjinchao600@gmail.com/
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-wprobe.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-wprobe.tc
> new file mode 100644
> index 0000000000000..13cacfd376e79
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-wprobe.tc
[ ... ]
> +:;: "Test field offset, count limit, and conditional clear_wprobe" ;:
> +clear_trace
> +echo 'set_wprobe:watch:timer+16:1' >> events/fprobes/testevent/trigger
> +if ! grep -q '^set_wprobe:watch:timer+16:count=1' events/fprobes/testevent/trigger; then
> + fail "Failed to set counted set_wprobe trigger with offset"
> +fi
[Severity: Low]
Can sample_timer_cb() fire before grep reads events/fprobes/testevent/trigger
here?
events/fprobes/testevent/enable is already set to 1 while sample_timer_cb()
runs every second on a timer. If the timer expires between registering the
trigger and spawning grep, wprobe_trigger() decrements data->count from 1 to
0:
shell <softirq>
write()
wprobe_register_trigger()
sample_timer_cb()
wprobe_trigger()
data->count-- (1 -> 0)
grep
wprobe_trigger_print()
prints count=0 <-- grep for count=1 fails
Disabling testevent while registering and checking count=1, or matching
count=[01] before the post-sleep count=0 check, would avoid a spurious test
failure.
> +
> +sleep 2
> +if ! grep -q watch trace; then
> + fail "Failed to trigger watchpoint with field offset and count"
> +fi
> +if ! grep -q '^set_wprobe:watch:timer+16:count=0' events/fprobes/testevent/trigger; then
> + fail "Counted set_wprobe trigger did not decrement count to 0"
> +fi
> +
> +echo 'clear_wprobe:watch:timer+16' >> events/fprobes/testevent/trigger
> +echo '!set_wprobe:watch:timer+16' >> events/fprobes/testevent/trigger
> +sleep 2
> +clear_trace
> +sleep 1
> +if ! grep -q '^0\*' events/wprobes/watch/enable; then
> + fail "Conditional clear_wprobe did not soft-disable watchpoint"
> +fi
> +if grep -q watch trace; then
> + fail "Failed to clear watchpoint with conditional clear_wprobe"
> +fi
> +echo '!clear_wprobe:watch:timer+16' >> events/fprobes/testevent/trigger
> +
> +:;: "Disable events and remove dynamic events" ;:
> +echo 0 > events/enable
> +echo > dynamic_events
[Severity: Low]
Can truncating dynamic_events immediately after removing clear_wprobe fail
with -EBUSY?
When a wprobe trigger is registered, wprobe_trigger_cmd_parse() takes a
reference on the target wprobe event via trace_event_try_get_ref().
Unregistering the trigger calls wprobe_trigger_free() -> trigger_data_free(),
which defers release_private_wprobe_trigger_data() -> trace_event_put_ref()
to trigger_kthread after tracepoint_synchronize_unregister() finishes:
shell trigger_kthread
write("!clear_wprobe:...")
wprobe_unregister_trigger()
trigger_data_free()
write("" > dynamic_events)
dyn_events_release_all()
unregister_trace_wprobe()
trace_event_dyn_busy() <-- returns -EBUSY
tracepoint_synchronize_unregister()
release_private_wprobe_trigger_data()
trace_event_put_ref()
The same race applies to cleanup_wprobe_triggers() and to
trigger-wprobe-hotplug.tc where echo > dynamic_events runs immediately after
removing the triggers; calling clear_dynamic_events (which retries in a loop)
or sleeping before truncating dynamic_events would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179480675130.38065.3086970856119381693.stgit@devnote2?part=9
next prev parent reply other threads:[~2026-11-16 5:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 5:25 [PATCH v20 00/11] tracing: wprobe: x86: Add wprobe for watchpoint Masami Hiramatsu (Google)
2026-11-16 5:26 ` [PATCH v20 01/11] x86/hw_breakpoints: Add arch_modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-11-16 5:47 ` sashiko-bot
2026-11-16 5:26 ` [PATCH v20 02/11] HWBP: Add modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-11-16 5:57 ` sashiko-bot
2026-11-16 5:26 ` [PATCH v20 03/11] perf/hw_breakpoint: Add register_wide_hw_breakpoint_cpuslocked() API Masami Hiramatsu (Google)
2026-11-16 5:44 ` sashiko-bot
2026-11-16 5:26 ` [PATCH v20 04/11] tracing/wprobe: Add wprobe (watchpoint probe) trace event support Masami Hiramatsu (Google)
2026-11-16 5:56 ` sashiko-bot
2026-11-16 5:26 ` [PATCH v20 05/11] x86: hw_breakpoint: Add a kconfig to clarify when a breakpoint fires Masami Hiramatsu (Google)
2026-11-16 5:34 ` sashiko-bot
2026-11-16 5:27 ` [PATCH v20 06/11] selftests: tracing: Add a basic testcase for wprobe Masami Hiramatsu (Google)
2026-11-16 5:34 ` sashiko-bot
2026-11-16 5:27 ` [PATCH v20 07/11] selftests: tracing: Add syntax " Masami Hiramatsu (Google)
2026-11-16 5:42 ` sashiko-bot
2026-11-16 5:27 ` [PATCH v20 08/11] tracing/wprobe: Add set_wprobe and clear_wprobe event triggers Masami Hiramatsu (Google)
2026-11-16 6:20 ` sashiko-bot
2026-11-16 5:27 ` [PATCH v20 09/11] selftests: tracing: Add wprobe trigger testcases Masami Hiramatsu (Google)
2026-11-16 5:52 ` sashiko-bot [this message]
2026-11-16 5:27 ` [PATCH v20 10/11] tracing/wprobe: Support BTF typecast in fetchargs Masami Hiramatsu (Google)
2026-11-16 5:52 ` sashiko-bot
2026-11-16 5:27 ` [PATCH v20 11/11] tracing/wprobe: Support BTF struct offset resolution in set_wprobe trigger Masami Hiramatsu (Google)
2026-11-16 5:50 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-216232@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.