From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Gabriele Monaco <gmonaco@redhat.com>
Cc: Nam Cao <namcao@linutronix.de>, Wen Yang <wen.yang@linux.dev>,
Juri Lelli <juri.lelli@redhat.com>
Subject: [PATCH 02/10] rv: Remove unused ha_monitor_env_invalid()
Date: Tue, 29 Sep 2026 14:49:00 +0200 [thread overview]
Message-ID: <20260929124908.177676-3-gmonaco@redhat.com> (raw)
In-Reply-To: <20260929124908.177676-1-gmonaco@redhat.com>
After forcing a reset() action when starting HA monitors, environment
variables cannot be invalid, hence ha_monitor_env_invalid() and checks
using it are no longer required.
Remove the function and its usage from library and generation scripts.
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
include/rv/ha_monitor.h | 12 ------------
tools/verification/rvgen/rvgen/dot2k.py | 8 --------
.../rvgen/tests/golden/ha_percpu/ha_percpu.c | 13 +++++--------
.../rvgen/tests/golden/test_ha/test_ha.c | 13 +++++--------
.../tests/golden/test_ha_kunit/test_ha_kunit.c | 13 +++++--------
5 files changed, 15 insertions(+), 44 deletions(-)
diff --git a/include/rv/ha_monitor.h b/include/rv/ha_monitor.h
index 93ac99ff7f1d..87cf91abdf67 100644
--- a/include/rv/ha_monitor.h
+++ b/include/rv/ha_monitor.h
@@ -211,14 +211,6 @@ static inline void ha_monitor_reset_env(struct da_monitor *da_mon)
ha_cancel_timer(ha_mon);
}
-/*
- * ha_monitor_env_invalid - return true if env has not been initialised
- */
-static inline bool ha_monitor_env_invalid(struct ha_monitor *ha_mon, enum envs env)
-{
- return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
-}
-
static inline void ha_get_env_string(struct seq_buf *s,
struct ha_monitor *ha_mon, u64 time_ns)
{
@@ -360,8 +352,6 @@ static inline u64 ha_invariant_passed_ns(struct ha_monitor *ha_mon, enum envs en
{
if (env < 0 || env >= ENV_MAX_STORED)
return 0;
- if (ha_monitor_env_invalid(ha_mon, env))
- return 0;
return ha_get_env(ha_mon, env, time_ns);
}
@@ -388,8 +378,6 @@ static inline u64 ha_invariant_passed_jiffy(struct ha_monitor *ha_mon, enum envs
{
if (env < 0 || env >= ENV_MAX_STORED)
return 0;
- if (ha_monitor_env_invalid(ha_mon, env))
- return 0;
return ha_get_env(ha_mon, env, time_ns);
}
diff --git a/tools/verification/rvgen/rvgen/dot2k.py b/tools/verification/rvgen/rvgen/dot2k.py
index fd3254ea5b4d..0b4e19ad9bd5 100644
--- a/tools/verification/rvgen/rvgen/dot2k.py
+++ b/tools/verification/rvgen/rvgen/dot2k.py
@@ -279,19 +279,11 @@ class ha2k(dot2k):
def __format_guard_rules(self, rules: list[str]) -> list[str]:
"""
Merge guard constraints as a single C return statement.
- If the rules include a stored env, also check its validity.
Break lines in a best effort way that tries to keep readability.
"""
if not rules:
return []
- invalid_checks = [f"ha_monitor_env_invalid(ha_mon, {env}{self.enum_suffix}) ||"
- for env in self.env_stored if any(env in rule for rule in rules)]
- if invalid_checks and len(rules) > 1:
- rules[0] = "(" + rules[0]
- rules[-1] = rules[-1] + ")"
- rules = invalid_checks + rules
-
separator = "\n\t\t " if sum(len(r) for r in rules) > 80 else " "
return ["res = " + separator.join(rules) + ";"]
diff --git a/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c b/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
index 3a72e867122c..7357e182e487 100644
--- a/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
+++ b/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_ha_percpu, time_ns);
} else if (curr_state == S2_ha_percpu && event == event1_ha_percpu)
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- ha_get_env(ha_mon, clk_ha_percpu, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < foo_ns;
else if (curr_state == S3_ha_percpu && event == event0_ha_percpu)
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- (ha_get_env(ha_mon, clk_ha_percpu, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_ha_percpu, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_ha_percpu, time_ns) == 0ull;
else if (curr_state == S3_ha_percpu && event == event1_ha_percpu) {
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- (ha_get_env(ha_mon, clk_ha_percpu, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_ha_percpu, time_ns);
}
return res;
diff --git a/tools/verification/rvgen/tests/golden/test_ha/test_ha.c b/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
index 9047ff725546..a2bd1eb93b03 100644
--- a/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
+++ b/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_test_ha, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_test_ha, time_ns);
} else if (curr_state == S2_test_ha && event == event1_test_ha)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- ha_get_env(ha_mon, clk_test_ha, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < foo_ns;
else if (curr_state == S3_test_ha && event == event0_test_ha)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- (ha_get_env(ha_mon, clk_test_ha, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_test_ha, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_test_ha, time_ns) == 0ull;
else if (curr_state == S3_test_ha && event == event1_test_ha) {
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- (ha_get_env(ha_mon, clk_test_ha, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_test_ha, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_test_ha, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_test_ha, time_ns);
}
return res;
diff --git a/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c b/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
index 239b0539df18..61446e7f32c4 100644
--- a/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
+++ b/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_test_ha_kunit, time_ns);
} else if (curr_state == S2_test_ha_kunit && event == event1_test_ha_kunit)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < foo_ns;
else if (curr_state == S3_test_ha_kunit && event == event0_test_ha_kunit)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- (ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_test_ha_kunit, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_test_ha_kunit, time_ns) == 0ull;
else if (curr_state == S3_test_ha_kunit && event == event1_test_ha_kunit) {
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- (ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_test_ha_kunit, time_ns);
}
return res;
--
2.55.0
next prev parent reply other threads:[~2026-09-29 12:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 12:48 [PATCH 00/10] rv: Add remaining deadline monitors Gabriele Monaco
2026-09-29 12:48 ` [PATCH 01/10] rv: Force environment reset action on HA monitor start Gabriele Monaco
2026-09-29 12:49 ` Gabriele Monaco [this message]
2026-09-29 12:49 ` [PATCH 03/10] rv: Cache timer budget when starting HA timers Gabriele Monaco
2026-09-29 12:49 ` [PATCH 04/10] tools/rvgen: Default to HA_TIMER_WHEEL for jiffy clocks Gabriele Monaco
2026-09-29 12:49 ` [PATCH 05/10] sched: Add task enqueue/dequeue trace points Gabriele Monaco
2026-09-29 12:49 ` [PATCH 06/10] rv: Add enqueue/dequeue to snroc monitor Gabriele Monaco
2026-09-29 12:49 ` [PATCH 07/10] rv: Add throttle deadline monitor Gabriele Monaco
2026-09-29 12:49 ` [PATCH 08/10] rv: Add dl_server specific monitors Gabriele Monaco
2026-09-29 12:49 ` [PATCH 09/10] rv: Add KUnit test for throttle monitor Gabriele Monaco
2026-09-29 12:49 ` [PATCH 10/10] selftests/verification: Lower stressor priority in rv_deadline Gabriele Monaco
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=20260929124908.177676-3-gmonaco@redhat.com \
--to=gmonaco@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=rostedt@goodmis.org \
--cc=wen.yang@linux.dev \
/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®