From: Li Pengfei <ljdlns1987@gmail.com>
To: mhiramat@kernel.org
Cc: rostedt@goodmis.org, peterz@infradead.org,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v17 00/13] tracing: wprobe: x86: Add wprobe for watchpoint
Date: Mon, 28 Sep 2026 18:07:44 +0800 [thread overview]
Message-ID: <20260928100744.2073454-1-lipengfei28@xiaomi.com> (raw)
In-Reply-To: <179005108298.388919.4535333252892590932.stgit@devnote2>
We have made a preliminary ARM64 port of the v17 wprobe series and
validated the basic paths on a real Android ARM64 device.
The device is:
Kernel: 6.12.69-android16-6-4k
Architecture: arm64
The relevant configuration includes:
CONFIG_HAVE_POST_BREAKPOINT_HOOK=y
CONFIG_HAVE_MODIFY_LOCAL_HW_BREAKPOINT_ADDR=y
CONFIG_WPROBE_EVENTS=y
CONFIG_WPROBE_TRIGGERS=y
The following paths passed on the real device:
- fixed-address read watchpoint;
- fixed-address write watchpoint;
- tracepoint -> set_wprobe;
- dynamic ARM64 watchpoint address update;
- tracepoint -> clear_wprobe;
- no further wprobe records after clear_wprobe.
For the dynamic test, we used the ptr field from the kmem:kmalloc
tracepoint:
set_wprobe:dyn_watch_log:ptr:count=1
The trigger changed the ARM64 hardware watchpoint address to the
dynamically obtained pointer and generated 6 wprobe access records. We
then used a sched_process_exit trigger to execute:
clear_wprobe:dyn_watch_log:count=1
The wprobe state changed from 1* to 0*. The hit count remained 6 after
the clear operation, confirming that no additional wprobe records were
generated after clearing. No BUG, Oops, panic, or wprobe-related warning
was observed during this test.
We also exercised the basic ARM64 watchpoint hit and post-watchpoint
single-step path on QEMU. The real-device result is the more important
validation.
There are two limitations worth mentioning:
1. The current Android device does not enable CONFIG_FPROBE_EVENTS, so
the fprobe -> set_wprobe path has not been tested on this device.
2. kprobe -> set_wprobe is currently rejected by design. The device
reports:
Wprobe trigger is not supported on kprobe event
We understand and respect this restriction, and we are not proposing
to remove it in this series.
Our use case for a possible future extension is more specific than
monitoring every kmalloc return value. A selected kernel function may call
kmalloc() internally, store the returned pointer in a register, stack slot,
local variable, or structure field, and then access fields of the newly
allocated object. We would like to monitor the object produced by that
particular allocation call site, rather than re-arm wprobe for every
kmalloc in the system.
One possible design would be a restricted, call-site-specific
kprobe-to-wprobe interface:
- a kprobe is placed at a selected instruction offset in the caller;
- a user-space frontend resolves the pointer source from the matching
vmlinux, BTF/DWARF, and disassembly;
- the frontend supplies an explicit register/stack/field fetch;
- the kernel arms a wprobe on the resolved object or one of its fields.
In this model, the user-space frontend would handle symbol resolution,
disassembly, call-site selection, pointer-source analysis, structure-field
resolution, and tracefs setup. The kernel would not need to parse arbitrary
compiler local variables. It would only need to provide a restricted and
safe mechanism for consuming an already-resolved pointer and updating the
hardware watchpoint.
We are not suggesting that an arbitrary kprobe handler should directly
perform unrestricted set_wprobe operations. We understand that kprobes,
ARM64 debug exceptions, single-step handling, tracing recursion, and
cross-CPU watchpoint updates require a separate safety design.
As an additional limitation, a high-frequency test that repeatedly
re-armed the watchpoint from kmem:kmalloc showed a non-zero missed count.
The controlled one-shot set/clear test passed, but the high-frequency case
needs further investigation.
The complete real-device log and test script are available if useful.
Best regards,
Pengfei
prev parent reply other threads:[~2026-09-28 10:08 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 4:24 [PATCH v17 00/13] tracing: wprobe: x86: Add wprobe for watchpoint Masami Hiramatsu (Google)
2026-09-22 4:24 ` [PATCH v17 01/13] x86/mce: Fix hardware debug register corruption on task migration Masami Hiramatsu (Google)
2026-09-22 4:40 ` sashiko-bot
2026-09-23 0:27 ` Borislav Petkov
2026-09-23 8:46 ` Peter Zijlstra
2026-09-23 8:56 ` Masami Hiramatsu
2026-09-22 4:25 ` [PATCH v17 02/13] perf/x86, KVM: Prevent host debug register leak into guest OS on NMI Masami Hiramatsu (Google)
2026-09-22 4:40 ` sashiko-bot
2026-09-23 8:51 ` Peter Zijlstra
2026-09-23 14:33 ` Sean Christopherson
2026-09-24 1:31 ` Masami Hiramatsu
2026-09-24 9:18 ` Peter Zijlstra
2026-09-23 9:15 ` Peter Zijlstra
2026-09-23 15:32 ` Sean Christopherson
2026-09-24 0:56 ` Masami Hiramatsu
2026-09-24 9:23 ` Peter Zijlstra
2026-09-22 4:25 ` [PATCH v17 03/13] x86/hw_breakpoints: Make DR7 updates NMI safe Masami Hiramatsu (Google)
2026-09-22 4:40 ` sashiko-bot
2026-09-23 9:13 ` Peter Zijlstra
2026-09-24 12:56 ` Masami Hiramatsu
2026-09-22 4:25 ` [PATCH v17 04/13] x86/hw_breakpoints: Add arch_modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-09-22 4:39 ` sashiko-bot
2026-09-22 4:25 ` [PATCH v17 05/13] HWBP: Add modify_local_hw_breakpoint_addr() API Masami Hiramatsu (Google)
2026-09-22 4:35 ` sashiko-bot
2026-09-22 4:25 ` [PATCH v17 06/13] tracing/wprobe: Add wprobe (watchpoint probe) trace event support Masami Hiramatsu (Google)
2026-09-22 4:41 ` sashiko-bot
2026-09-22 4:26 ` [PATCH v17 07/13] x86: hw_breakpoint: Add a kconfig to clarify when a breakpoint fires Masami Hiramatsu (Google)
2026-09-22 4:32 ` sashiko-bot
2026-09-22 4:26 ` [PATCH v17 08/13] selftests: tracing: Add a basic testcase for wprobe Masami Hiramatsu (Google)
2026-09-22 4:32 ` sashiko-bot
2026-09-22 4:26 ` [PATCH v17 09/13] selftests: tracing: Add syntax " Masami Hiramatsu (Google)
2026-09-22 4:34 ` sashiko-bot
2026-09-22 4:26 ` [PATCH v17 10/13] tracing/wprobe: Add set_wprobe and clear_wprobe event triggers Masami Hiramatsu (Google)
2026-09-22 4:43 ` sashiko-bot
2026-09-25 2:26 ` Masami Hiramatsu
2026-09-22 4:26 ` [PATCH v17 11/13] selftests: tracing: Add wprobe trigger testcases Masami Hiramatsu (Google)
2026-09-22 4:41 ` sashiko-bot
2026-09-25 3:28 ` Masami Hiramatsu
2026-09-22 4:27 ` [PATCH v17 12/13] tracing/wprobe: Support BTF typecast in fetchargs Masami Hiramatsu (Google)
2026-09-22 4:42 ` sashiko-bot
2026-09-22 4:27 ` [PATCH v17 13/13] tracing/wprobe: Support BTF struct offset resolution in set_wprobe trigger Masami Hiramatsu (Google)
2026-09-22 4:43 ` sashiko-bot
2026-09-25 3:00 ` Masami Hiramatsu
2026-09-25 3:42 ` Masami Hiramatsu
2026-09-28 10:07 ` Li Pengfei [this message]
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=20260928100744.2073454-1-lipengfei28@xiaomi.com \
--to=ljdlns1987@gmail.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).