mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Nam Cao <namcao@linutronix.de>
Cc: Wander Lairson Costa <wander@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-trace-kernel@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 07/13] rv: Simply hybrid automata monitors's clock variables
Date: Wed, 03 Jun 2026 11:27:32 +0200	[thread overview]
Message-ID: <fcb3cf13b1ffdca34354b6f9642c41968030c605.camel@redhat.com> (raw)
In-Reply-To: <ed1719ebe4af8872673af4264fdbf9ad96425b7f.1779956342.git.namcao@linutronix.de>

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 <gmonaco@redhat.com>

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;
>  }
>  


  reply	other threads:[~2026-06-03  9:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  8:27 [PATCH v2 00/13] rv: Convert rvgen to Lark Nam Cao
2026-05-28  8:27 ` [PATCH v2 01/13] verification/rvgen: Switch LTL parser " Nam Cao
2026-06-03 14:49   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 02/13] verification/rvgen: Introduce a parse tree for automata using Lark Nam Cao
2026-06-03 14:55   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 03/13] verification/rvgen: Implement state and transition parser based on Lark Nam Cao
2026-06-03 14:55   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 04/13] verification/rvgen: Convert __fill_verify_invariants_func() to Lark Nam Cao
2026-06-03 14:56   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 05/13] verification/rvgen: Convert __fill_setup_invariants_func() " Nam Cao
2026-06-03 15:24   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 06/13] verification/rvgen: Convert __fill_verify_guards_func() " Nam Cao
2026-06-03 16:00   ` Gabriele Monaco
2026-05-28  8:27 ` [PATCH v2 07/13] rv: Simply hybrid automata monitors's clock variables Nam Cao
2026-06-03  9:27   ` Gabriele Monaco [this message]
2026-05-28  8:27 ` [PATCH v2 08/13] verification/rvgen: Simplify the generation for " Nam Cao
2026-05-28  8:27 ` [PATCH v2 09/13] verification/rvgen: Delete __parse_constraint() Nam Cao
2026-05-28  8:27 ` [PATCH v2 10/13] verification/rvgen: Switch __get_event_variables() to Lark Nam Cao
2026-05-28  8:27 ` [PATCH v2 11/13] verification/rvgen: Switch __create_matrix() " Nam Cao
2026-05-28  8:28 ` [PATCH v2 12/13] verification/rvgen: Remove the old state variables Nam Cao
2026-05-28  8:28 ` [PATCH v2 13/13] verification/rvgen: Remove dead code Nam Cao
2026-06-03 15:36   ` Gabriele Monaco
2026-06-08  8:29     ` Nam Cao

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=fcb3cf13b1ffdca34354b6f9642c41968030c605.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=namcao@linutronix.de \
    --cc=rostedt@goodmis.org \
    --cc=wander@redhat.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

all inboxes | Powered by JetHome®