Skip to contentSkip to conversation

docs: kcsan: document targeted watchpoint sampling

RFC PATCH In review Hui Su 1 participant 1 message Oct 14

Subsystems (3)
lore
Share & tools
lore

Hui Su

author
#0 lore raw

RFC PATCH 4/4 docs: kcsan: document targeted watchpoint sampling

Describe the KCSAN debugfs target interface, including address and kallsyms symbol forms, module symbols, disabling the target, and how it relates to report filters. Clarify CONFIG_KALLSYMS_ALL requirements and that a symbol target selects only the symbol start address. Warn about hot-target overhead and clear the target before unloading a module that owns the address.

---
 Documentation/dev-tools/kcsan.rst | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Documentation/dev-tools/kcsan.rst +17 -0
index 8575178aa87f..53cc3e5bc1f0 100644
@@ -169,6 +169,23 @@ The file ``/sys/kernel/debug/kcsan`` provides the following interface:
   can be used to silence frequently occurring data races; the whitelist feature
   can help with reproduction and testing of fixes.
 
+* Writing ``target=<address>`` or ``target=<symbol>`` to
+  ``/sys/kernel/debug/kcsan`` enables targeted watchpoint sampling for one
+  address. An instrumented access is eligible for watchpoint setup when its
+  byte range contains the selected address. While targeted sampling is active,
+  non-target accesses do not consume the per-CPU ``kcsan.skip_watch`` interval.
+  Symbol targets are resolved using kallsyms. Naming vmlinux data symbols
+  requires ``CONFIG_KALLSYMS_ALL``, and module symbols use ``module:symbol``.
+  A symbol target selects the symbol's start address, not the full object.
+  Marked atomic accesses remain ineligible for watchpoint setup. This controls
+  watchpoint setup and is independent of report whitelist/blacklist filtering.
+  Write ``target=off`` to restore normal sampling.
+  Matching accesses bypass the normal skip interval, so targeting a hot
+  address can significantly increase KCSAN overhead. Use targeted sampling to
+  focus debugging on a known suspicious location.
+  The target does not hold a module reference; clear it before unloading a
+  module that owns the selected address.
+
 Tuning performance
 ~~~~~~~~~~~~~~~~~~
 
Signature · 1 line
2.55.0