diff options
| author | Gabriele Monaco <gmonaco@redhat.com> | 2026-03-30 14:10:00 +0300 |
|---|---|---|
| committer | Gabriele Monaco <gmonaco@redhat.com> | 2026-03-31 17:47:16 +0300 |
| commit | f5587d1b6ec938afb2f74fe399a68020d66923e4 (patch) | |
| tree | 971855522eb9ab35ba9291514bdcb482ca8be9a1 /include/linux | |
| parent | 9da38a69da30ae16982f1dcf55890d159cf38cf4 (diff) | |
| download | linux-f5587d1b6ec938afb2f74fe399a68020d66923e4.tar.xz | |
rv: Add Hybrid Automata monitor type
Deterministic automata define which events are allowed in every state,
but cannot define more sophisticated constraint taking into account the
system's environment (e.g. time or other states not producing events).
Add the Hybrid Automata monitor type as an extension of Deterministic
automata where each state transition is validating a constraint on a
finite number of environment variables.
Hybrid automata can be used to implement timed automata, where the
environment variables are clocks.
Also implement the necessary functionality to handle clock constraints
(ns or jiffy granularity) on state and events.
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260330111010.153663-3-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/rv.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/rv.h b/include/linux/rv.h index 58774eb3aecf..0aef9e3c785c 100644 --- a/include/linux/rv.h +++ b/include/linux/rv.h @@ -81,11 +81,49 @@ struct ltl_monitor {}; #endif /* CONFIG_RV_LTL_MONITOR */ +#ifdef CONFIG_RV_HA_MONITOR +/* + * In the future, hybrid automata may rely on multiple + * environment variables, e.g. different clocks started at + * different times or running at different speed. + * For now we support only 1 variable. + */ +#define MAX_HA_ENV_LEN 1 + +/* + * Monitors can pick the preferred timer implementation: + * No timer: if monitors don't have state invariants. + * Timer wheel: lightweight invariants check but far less precise. + * Hrtimer: accurate invariants check with higher overhead. + */ +#define HA_TIMER_NONE 0 +#define HA_TIMER_WHEEL 1 +#define HA_TIMER_HRTIMER 2 + +/* + * Hybrid automaton per-object variables. + */ +struct ha_monitor { + struct da_monitor da_mon; + u64 env_store[MAX_HA_ENV_LEN]; + union { + struct hrtimer hrtimer; + struct timer_list timer; + }; +}; + +#else + +struct ha_monitor { }; + +#endif /* CONFIG_RV_HA_MONITOR */ + #define RV_PER_TASK_MONITOR_INIT (CONFIG_RV_PER_TASK_MONITORS) union rv_task_monitor { struct da_monitor da_mon; struct ltl_monitor ltl_mon; + struct ha_monitor ha_mon; }; #ifdef CONFIG_RV_REACTORS |
