From: sashiko-bot@kernel.org
To: "Tobias Schaffner" <tobias.schaffner@siemens.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] rv: collect per-edge dwell time for per-cpu DA/HA monitors
Date: Tue, 20 Oct 2026 10:06:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-178792@kernel.org> (raw)
In-Reply-To: <20261020095512.863754-4-tobias.schaffner@siemens.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] rv: bogus initial dwell time in __da_handle_start_run_event()
--
commit 296c211b8b28be395fee98f1ad59896cd58a9336
Author: Tobias Schaffner <tobias.schaffner@siemens.com>
rv: collect per-edge dwell time for per-cpu DA/HA monitors
This commit hooks the edge-stat facility into the DA and HA monitor layers
to record per-edge state dwell times for per-CPU automaton monitors and
documents the resulting stats file in runtime-verification.rst.
> diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h
> index 6fc5ef8142aca..c8f7497800d07 100644
> --- a/include/rv/da_monitor.h
> +++ b/include/rv/da_monitor.h
[ ... ]
> @@ -113,7 +114,7 @@ static inline void da_monitor_reset(struct da_monitor *da_mon)
> */
> static inline void da_monitor_start(struct da_monitor *da_mon)
> {
> - da_mon->curr_state = model_get_initial_state();
> + da_mon->curr_state = da_state_entered(model_get_initial_state());
> da_monitor_init_hook(da_mon);
> /* Pairs with smp_load_acquire in da_monitoring(). */
> smp_store_release(&da_mon->monitoring, 1);
[ ... ]
> @@ -689,9 +696,11 @@ static inline void da_trace_error(struct da_monitor *da_mon,
> static inline bool da_event(struct da_monitor *da_mon, enum events event, da_id_type id)
> {
> enum states curr_state, next_state;
> + da_state_t old;
>
> - curr_state = READ_ONCE(da_mon->curr_state);
> + old = READ_ONCE(da_mon->curr_state);
> for (int i = 0; i < MAX_DA_RETRY_RACING_EVENTS; i++) {
> + curr_state = da_state_of(old);
> next_state = model_get_next_state(curr_state, event);
> if (next_state == INVALID_STATE) {
> react(curr_state, event);
> @@ -699,7 +708,8 @@ static inline bool da_event(struct da_monitor *da_mon, enum events event, da_id_
> model_get_event_name(event), id);
> return false;
> }
> - if (likely(da_state_try_commit(&da_mon->curr_state, &old,
> - next_state, event))) {
> + if (likely(da_state_try_commit(&da_mon->curr_state, &old,
> + next_state, event))) {
> if (!da_monitor_event_hook(da_mon, curr_state, event, next_state, id))
> return false;
> da_trace_event(da_mon, model_get_state_name(curr_state),
[Severity: Medium]
Does stamping da_mon->curr_state with da_state_entered() in
da_monitor_start() record a bogus dwell time when starting a monitor via
__da_handle_start_run_event()?
Unlike __da_handle_start_event(), which calls da_monitor_start() and
returns immediately when entering the initial state,
__da_handle_start_run_event() is used when the system is already in the
initial state for an unknown duration and an outgoing transition occurs:
include/rv/da_monitor.h:__da_handle_start_run_event() {
if (!da_monitor_enabled())
return 0;
if (unlikely(!da_monitoring(da_mon)))
da_monitor_start(da_mon);
__da_handle_event_common(da_mon, event, id);
return 1;
}
When !da_monitoring(da_mon) is true (such as in the opid monitor on the
first handle_sched_need_resched() or handle_sched_waking() event after
enabling or resetting), da_monitor_start() stamps curr_state with a
non-zero local_clock() timestamp via da_state_entered().
Immediately afterwards, __da_handle_event_common() calls da_event(), where
da_state_try_commit() takes a second local_clock() timestamp and calls
rv_edge_account(). Because the timestamp in old is non-zero, won't
rv_edge_account() record the few nanoseconds spent between
da_monitor_start() and da_state_try_commit() as the dwell time for the
initial state's outgoing edge?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261020095512.863754-1-tobias.schaffner@siemens.com?part=3
next prev parent reply other threads:[~2026-10-20 10:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 9:55 [PATCH v3 0/4] rv: per-edge dwell-time statistics for per-cpu monitors Tobias Schaffner
2026-10-20 9:55 ` [PATCH v3 1/4] rv: guard rv.h against double inclusion Tobias Schaffner
2026-10-20 9:55 ` [PATCH v3 2/4] rv: add per-edge dwell-time statistics Tobias Schaffner
2026-11-17 15:17 ` Gabriele Monaco
2026-10-20 9:55 ` [PATCH v3 3/4] rv: collect per-edge dwell time for per-cpu DA/HA monitors Tobias Schaffner
2026-10-20 10:06 ` sashiko-bot [this message]
2026-10-20 9:55 ` [PATCH v3 4/4] selftests/verification: test per-edge dwell-time statistics Tobias Schaffner
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-178792@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tobias.schaffner@siemens.com \
/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