On Wed, 2026-07-08 at 23:38 +0800, [email protected] wrote: > From: Wen Yang <[email protected]>
Usually, within tracing, we try to make the commit titles consistent by capitalising them after the tag (as you did only for the cover letter). Also try not to introduce new tags, we have poor consistency, but I prefer only to keep rv: when you modify kernel-side code (all your patches besides the selftests one, which is correct). Try to follow what you see with git log --oneline <modified files> Overall: rv/da: introduce DA_MON_ALLOCATION_STRATEGY rv: add generic uprobe infrastructure for RV monitors rv/tlob: add tlob model DOT file ... becomes rv: Introduce DA_MON_ALLOCATION_STRATEGY rv: Add generic uprobe infrastructure for RV monitors rv: Add tlob model DOT file ... (note the uppercase A and I and the use of rv: , please apply these to other commits too). Thanks, Gabriele > This series introduces tlob (task latency over budget), a per-task > hybrid automaton RV monitor that measures elapsed wall-clock time across > a user-delimited code section and emits an error when the elapsed time > exceeds a configurable budget. > > The monitor tracks three states (running, waiting, sleeping) driven by > sched_switch and sched_wakeup tracepoints. A single clock invariant, > clk_elapsed < BUDGET_NS(), is enforced by a per-task hrtimer > (HRTIMER_MODE_REL_HARD). On expiry, error_env_tlob is emitted, > followed by detail_env_tlob carrying a per-state time breakdown > (running_ns, waiting_ns, sleeping_ns). > > Tasks are registered for monitoring by writing to the tracefs monitor > file: > > echo "p /path/to/binary:OFFSET_START OFFSET_STOP threshold=NS" \ > > /sys/kernel/tracing/rv/monitors/tlob/monitor > > Two uprobes delimit the measured section without modifying the target > binary. Multiple uprobe pairs can be active simultaneously. > > Series structure > ---------------- > Patch 1: rv/da: introduce DA_MON_ALLOCATION_STRATEGY > Compile-time allocation strategy selector for per-object DA storage. > Three strategies: DA_ALLOC_AUTO (default kmalloc), DA_ALLOC_POOL > (pre-allocated llist pool), DA_ALLOC_MANUAL (caller-managed). > > Patch 2: rv: add generic uprobe infrastructure for RV monitors > Thin wrapper over uprobe_consumer for path resolution, registration, > and safe synchronous teardown. > > Patch 3: rv/tlob: add tlob model DOT file > Graphviz DOT specification of the tlob hybrid automaton. > > Patch 4: rv/ha: fix ha_invariant_passed_ns silent bypass > Without this fix, ha_invariant_passed_ns() returns 0 on first call and > leaves env_store at U64_MAX. Every subsequent state transition resets > the hrtimer to the full budget instead of the remaining time, so the > budget never expires for tasks that transition between states. This > causes tlob's detail_sleeping and detail_waiting selftests to hang. > > This patch is a minimal fix in the current dual-representation framework. > Nam's series [1] refactors ha_monitor.h to a single-representation > model; once it lands, tlob will need to be updated to the new API and > this patch will be superseded by Gabriele's planned framework-level > initialisation improvement. We carry it here to keep the series > self-contained and testable. > > [1] > https://lore.kernel.org/lkml/08188c28f274da63a3f8549add3086a92aef45e5.1780908661.git.nam...@linutronix.de > > Patches 5: rv/ha: make da_monitor_reset_hook and EVENT_NONE_LBL > #ifndef guards for da_monitor_reset_hook and EVENT_NONE_LBL. > > Patch 6: rv/tlob: add tlob hybrid automaton monitor > Main tlob implementation. > > Patches 7-8: Tests > KUnit tests for the uprobe-line parser; seven ftrace-style selftests. > > Changes since v3 > ---------------- > Patch 1 (rv/da): > - Pool redesigned from spinlock+pointer-stack to lock-free llist > (cmpxchg-based): pool release from RCU callback context is now safe > without acquiring a lock > - DA_MON_POOL_SIZE alone selects pool mode; no separate > DA_MON_ALLOCATION_STRATEGY define required for monitors > - All strategy dispatch uses plain C if() (no ifdeffery in functions) > - da_monitor_destroy_pool() calls da_monitor_reset_all() and > da_monitor_sync_hook() before the hash iteration, preventing hrtimer > UAF when timer callbacks are still in flight > > Patch 2 (rv_uprobe): > - struct rv_uprobe now embeds struct uprobe_consumer directly; no > separate heap allocation per probe, no rv_uprobe_free() > - path_put() moved after uprobe_register() to keep the inode > referenced across the call as required by the uprobe API > > Patch 6 (tlob monitor): > - da_get_target_by_id() wrapped in scoped_guard(rcu) in > tlob_start_task(): hash_for_each_possible_rcu() requires an explicit > RCU read-side CS on PREEMPT_RT where spinlock_t does not provide one > - tlob_monitor_read() releases mutex before simple_read_from_buffer() > to avoid holding the mutex across copy_to_user() > - kmem_cache replaced with a pre-allocated llist pool for > tlob_task_state, eliminating GFP_ATOMIC in the measurement window > - EXPORT_SYMBOL_IF_KUNIT added for tlob_parse_uprobe_line() and > tlob_parse_remove_line() (required when CONFIG_TLOB_KUNIT_TEST=m) > - tlob_parse_remove_line() rejects negative offsets > - Unnecessary includes removed; Kconfig entry placed after the > deadline monitors marker > > Patch 7 (KUnit): > - Tests now call tlob_parse_uprobe_line() and tlob_parse_remove_line() > directly; no tracepoint enrollment, no uprobe or filesystem state > > Patch 8 (selftests): > - ftracetest walk-up algorithm (Gabriele's suggestion) incorporated; > the separate verificationtest-ktap fix patch is dropped and the > series shrinks from 9 to 8 patches > - All test scripts use "! cmd || false" throughout > > Testing > ------- > Tested on x86_64 with CONFIG_PREEMPT_RT=y (kernel 7.1 + virtme-ng): > - All KUnit tests pass > - All 7 selftests pass (uprobe_bind, uprobe_violation, uprobe_no_event, > uprobe_multi, uprobe_detail_{running,sleeping,waiting}) > > > Wen Yang (8): > rv/da: introduce DA_MON_ALLOCATION_STRATEGY > rv: add generic uprobe infrastructure for RV monitors > rv/tlob: add tlob model DOT file > rv/ha: fix ha_invariant_passed_ns silent bypass of invariant check > rv/ha: make da_monitor_reset_hook and EVENT_NONE_LBL overridable > rv/tlob: add tlob hybrid automaton monitor > rv/tlob: add KUnit tests for the tlob monitor > selftests/verification: add tlob selftests > > Documentation/trace/rv/index.rst | 1 + > Documentation/trace/rv/monitor_tlob.rst | 177 ++++ > include/rv/da_monitor.h | 247 ++++- > include/rv/ha_monitor.h | 24 +- > include/rv/rv_uprobe.h | 93 ++ > kernel/trace/rv/Kconfig | 8 + > kernel/trace/rv/Makefile | 3 + > kernel/trace/rv/monitors/nomiss/nomiss.c | 6 +- > kernel/trace/rv/monitors/tlob/.kunitconfig | 8 + > kernel/trace/rv/monitors/tlob/Kconfig | 19 + > kernel/trace/rv/monitors/tlob/tlob.c | 970 ++++++++++++++++++ > kernel/trace/rv/monitors/tlob/tlob.h | 153 +++ > kernel/trace/rv/monitors/tlob/tlob_kunit.c | 139 +++ > kernel/trace/rv/monitors/tlob/tlob_trace.h | 52 + > kernel/trace/rv/rv_trace.h | 1 + > kernel/trace/rv/rv_uprobe.c | 104 ++ > tools/testing/selftests/ftrace/ftracetest | 18 +- > .../testing/selftests/verification/.gitignore | 2 + > tools/testing/selftests/verification/Makefile | 19 +- > .../verification/test.d/tlob/Makefile | 28 + > .../test.d/tlob/run_tlob_tests.sh | 90 ++ > .../verification/test.d/tlob/tlob_sym.c | 209 ++++ > .../verification/test.d/tlob/tlob_target.c | 138 +++ > .../verification/test.d/tlob/uprobe_bind.tc | 37 + > .../test.d/tlob/uprobe_detail_running.tc | 51 + > .../test.d/tlob/uprobe_detail_sleeping.tc | 50 + > .../test.d/tlob/uprobe_detail_waiting.tc | 66 ++ > .../verification/test.d/tlob/uprobe_multi.tc | 64 ++ > .../test.d/tlob/uprobe_no_event.tc | 19 + > .../test.d/tlob/uprobe_violation.tc | 67 ++ > tools/verification/models/tlob.dot | 22 + > 31 files changed, 2839 insertions(+), 46 deletions(-) > create mode 100644 Documentation/trace/rv/monitor_tlob.rst > create mode 100644 include/rv/rv_uprobe.h > create mode 100644 kernel/trace/rv/monitors/tlob/.kunitconfig > create mode 100644 kernel/trace/rv/monitors/tlob/Kconfig > create mode 100644 kernel/trace/rv/monitors/tlob/tlob.c > create mode 100644 kernel/trace/rv/monitors/tlob/tlob.h > create mode 100644 kernel/trace/rv/monitors/tlob/tlob_kunit.c > create mode 100644 kernel/trace/rv/monitors/tlob/tlob_trace.h > create mode 100644 kernel/trace/rv/rv_uprobe.c > create mode 100644 tools/testing/selftests/verification/test.d/tlob/Makefile > create mode 100755 > tools/testing/selftests/verification/test.d/tlob/run_tlob_tests.sh > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/tlob_sym.c > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/tlob_target.c > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_bind.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_detail_running.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_detail_sleeping.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_detail_waiting.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_multi.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_no_event.tc > create mode 100644 > tools/testing/selftests/verification/test.d/tlob/uprobe_violation.tc > create mode 100644 tools/verification/models/tlob.dot
