s/Simply/Simplify/ from the patch title.
On Thu, 2026-05-28 at 10:27 +0200, Nam Cao wrote:
> /*
> @@ -389,14 +357,14 @@ static inline void ha_setup_timer(struct
> ha_monitor *ha_mon)
> static inline void ha_start_timer_jiffy(struct ha_monitor *ha_mon,
> enum envs env,
> u64 expire, u64 time_ns)
> {
> - u64 passed = ha_invariant_passed_jiffy(ha_mon, env, expire,
> time_ns);
> + u64 passed = ha_invariant_passed_jiffy(ha_mon, env,
> time_ns);
>
> mod_timer(&ha_mon->timer, get_jiffies_64() + expire -
> passed);
> }
> static inline void ha_start_timer_ns(struct ha_monitor *ha_mon, enum
> envs env,
> u64 expire, u64 time_ns)
> {
> - u64 passed = ha_invariant_passed_ns(ha_mon, env, expire,
> time_ns);
> + u64 passed = ha_invariant_passed_ns(ha_mon, env, time_ns);
>
> ha_start_timer_jiffy(ha_mon, ENV_MAX_STORED,
> nsecs_to_jiffies(expire - passed +
> TICK_NSEC - 1), time_ns);
> @@ -438,7 +406,7 @@ static inline void ha_start_timer_ns(struct
> ha_monitor *ha_mon, enum envs env,
> u64 expire, u64 time_ns)
> {
> int mode = HRTIMER_MODE_REL_HARD;
> - u64 passed = ha_invariant_passed_ns(ha_mon, env, expire,
> time_ns);
> + u64 passed = ha_invariant_passed_ns(ha_mon, env, time_ns);
>
You need to remove expire also for ha_invariant_passed_jiffy in the
hrtimer flavour (just set HA_TIMER_HRTIMER in stall and you see it
won't compile). Jiffy granularity monitors with hrtimers are an
unlikely usecase but still supported.
Other than that it looks good.
Reviewed-by: Gabriele Monaco <[email protected]>
Thanks,
Gabriele
> if (RV_MON_TYPE == RV_MON_PER_CPU)
> mode |= HRTIMER_MODE_PINNED;
> diff --git a/kernel/trace/rv/monitors/nomiss/nomiss.c
> b/kernel/trace/rv/monitors/nomiss/nomiss.c
> index a0b5641a1858..19d0e9aa4d58 100644
> --- a/kernel/trace/rv/monitors/nomiss/nomiss.c
> +++ b/kernel/trace/rv/monitors/nomiss/nomiss.c
> @@ -57,24 +57,12 @@ static inline bool ha_verify_invariants(struct
> ha_monitor *ha_mon,
> enum states next_state, u64
> time_ns)
> {
> if (curr_state == ready_nomiss)
> - return ha_check_invariant_ns(ha_mon, clk_nomiss,
> time_ns);
> + return ha_check_invariant_ns(ha_mon, clk_nomiss,
> time_ns, DEADLINE_NS(ha_mon));
> else if (curr_state == running_nomiss)
> - return ha_check_invariant_ns(ha_mon, clk_nomiss,
> time_ns);
> + return ha_check_invariant_ns(ha_mon, clk_nomiss,
> time_ns, DEADLINE_NS(ha_mon));
> return true;
> }
>
> -static inline void ha_convert_inv_guard(struct ha_monitor *ha_mon,
> - enum states curr_state, enum
> events event,
> - enum states next_state, u64
> time_ns)
> -{
> - if (curr_state == next_state)
> - return;
> - if (curr_state == ready_nomiss)
> - ha_inv_to_guard(ha_mon, clk_nomiss,
> DEADLINE_NS(ha_mon), time_ns);
> - else if (curr_state == running_nomiss)
> - ha_inv_to_guard(ha_mon, clk_nomiss,
> DEADLINE_NS(ha_mon), time_ns);
> -}
> -
> static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
> enum states curr_state, enum
> events event,
> enum states next_state, u64
> time_ns)
> @@ -122,8 +110,6 @@ static bool ha_verify_constraint(struct
> ha_monitor *ha_mon,
> if (!ha_verify_invariants(ha_mon, curr_state, event,
> next_state, time_ns))
> return false;
>
> - ha_convert_inv_guard(ha_mon, curr_state, event, next_state,
> time_ns);
> -
> if (!ha_verify_guards(ha_mon, curr_state, event, next_state,
> time_ns))
> return false;
>
> diff --git a/kernel/trace/rv/monitors/stall/stall.c
> b/kernel/trace/rv/monitors/stall/stall.c
> index 9ccfda6b0e73..1aa65d7e690d 100644
> --- a/kernel/trace/rv/monitors/stall/stall.c
> +++ b/kernel/trace/rv/monitors/stall/stall.c
> @@ -38,7 +38,7 @@ static inline bool ha_verify_invariants(struct
> ha_monitor *ha_mon,
> enum states next_state, u64
> time_ns)
> {
> if (curr_state == enqueued_stall)
> - return ha_check_invariant_jiffy(ha_mon, clk_stall,
> time_ns);
> + return ha_check_invariant_jiffy(ha_mon, clk_stall,
> time_ns, threshold_jiffies);
> return true;
> }
>