mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
	John Ogness <john.ogness@linutronix.de>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Nam Cao <namcao@linutronix.de>,
	Gabriele Monaco <gmonaco@redhat.com>
Subject: [for-next][PATCH 13/25] verification/rvgen: Support the next operator
Date: Fri, 25 Jul 2025 16:34:10 -0400	[thread overview]
Message-ID: <20250725203426.115179584@kernel.org> (raw)
In-Reply-To: <20250725203357.087558746@kernel.org>

From: Nam Cao <namcao@linutronix.de>

The 'next' operator is a unary operator. It is defined as: "next time, the
operand must be true".

Support this operator. For RV monitors, "next time" means the next
invocation of ltl_validate().

Cc: John Ogness <john.ogness@linutronix.de>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/9c32cec04dd18d2e956fddd84b0e0a2503daa75a.1752239482.git.namcao@linutronix.de
Signed-off-by: Nam Cao <namcao@linutronix.de>
Tested-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../trace/rv/linear_temporal_logic.rst        |  1 +
 tools/verification/rvgen/rvgen/ltl2ba.py      | 26 +++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/Documentation/trace/rv/linear_temporal_logic.rst b/Documentation/trace/rv/linear_temporal_logic.rst
index 57f107fcf6dd..9eee09d9cacf 100644
--- a/Documentation/trace/rv/linear_temporal_logic.rst
+++ b/Documentation/trace/rv/linear_temporal_logic.rst
@@ -41,6 +41,7 @@ Operands (opd):
 Unary Operators (unop):
     always
     eventually
+    next
     not
 
 Binary Operators (binop):
diff --git a/tools/verification/rvgen/rvgen/ltl2ba.py b/tools/verification/rvgen/rvgen/ltl2ba.py
index d11840af7f5f..f14e6760ac3d 100644
--- a/tools/verification/rvgen/rvgen/ltl2ba.py
+++ b/tools/verification/rvgen/rvgen/ltl2ba.py
@@ -19,6 +19,7 @@ from ply.yacc import yacc
 # Unary Operators (unop):
 #       always
 #       eventually
+#       next
 #       not
 #
 # Binary Operators (binop):
@@ -35,6 +36,7 @@ tokens = (
    'UNTIL',
    'ALWAYS',
    'EVENTUALLY',
+   'NEXT',
    'VARIABLE',
    'LITERAL',
    'NOT',
@@ -48,6 +50,7 @@ t_OR = r'or'
 t_IMPLY = r'imply'
 t_UNTIL = r'until'
 t_ALWAYS = r'always'
+t_NEXT = r'next'
 t_EVENTUALLY = r'eventually'
 t_VARIABLE = r'[A-Z_0-9]+'
 t_LITERAL = r'true|false'
@@ -327,6 +330,26 @@ class AlwaysOp(UnaryOp):
         # ![]F == <>(!F)
         return EventuallyOp(self.child.negate()).normalize()
 
+class NextOp(UnaryOp):
+    def normalize(self):
+        return self
+
+    def _is_temporal(self):
+        return True
+
+    def negate(self):
+        # not (next A) == next (not A)
+        self.child = self.child.negate()
+        return self
+
+    @staticmethod
+    def expand(n: ASTNode, node: GraphNode, node_set) -> set[GraphNode]:
+        tmp = GraphNode(node.incoming,
+                        node.new,
+                        node.old | {n},
+                        node.next | {n.op.child})
+        return tmp.expand(node_set)
+
 class NotOp(UnaryOp):
     def __str__(self):
         return "!" + str(self.child)
@@ -452,12 +475,15 @@ def p_unop(p):
     '''
     unop : ALWAYS ltl
          | EVENTUALLY ltl
+         | NEXT ltl
          | NOT ltl
     '''
     if p[1] == "always":
         op = AlwaysOp(p[2])
     elif p[1] == "eventually":
         op = EventuallyOp(p[2])
+    elif p[1] == "next":
+        op = NextOp(p[2])
     elif p[1] == "not":
         op = NotOp(p[2])
     else:
-- 
2.47.2



  parent reply	other threads:[~2025-07-25 20:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 20:33 [for-next][PATCH 00/25] rv/verfication: Updatse for v6.17 Steven Rostedt
2025-07-25 20:33 ` [for-next][PATCH 01/25] objtool: Add vpanic() to the noreturn list Steven Rostedt
2025-07-25 20:33 ` [for-next][PATCH 02/25] panic: Fix up description of vpanic() Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 03/25] rv/ltl: Do not execute the Buchi automaton twice on start condition Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 04/25] verification/dot2k: Make a separate dot2k_templates/Kconfig_container Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 05/25] verification/dot2k: Remove __buff_to_string() Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 06/25] verification/dot2k: Replace is_container() hack with subparsers Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 07/25] verification/dot2k: Prepare the frontend for LTL inclusion Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 08/25] Documentation/rv: Prepare monitor synthesis document " Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 09/25] verification/rvgen: Restructure the templates files Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 10/25] verification/rvgen: Restructure the classes to prepare for LTL inclusion Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 11/25] verification/rvgen: Add support for linear temporal logic Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 12/25] Documentation/rv: Add documentation for linear temporal logic monitors Steven Rostedt
2025-07-25 20:34 ` Steven Rostedt [this message]
2025-07-25 20:34 ` [for-next][PATCH 14/25] verification/rvgen: Generate each variable definition only once Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 15/25] verification/rvgen: Do not generate unused variables Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 16/25] tools/rv: Do not skip idle in trace Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 17/25] tools/rv: Stop gracefully also on SIGTERM Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 18/25] tools/dot2c: Fix generated files going over 100 column limit Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 19/25] verification/rvgen: Organise Kconfig entries for nested monitors Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 20/25] rv: Return init error when registering monitors Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 21/25] rv: Remove unused field in struct rv_monitor_def Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 22/25] rv: Merge struct rv_monitor_def into struct rv_monitor Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 23/25] rv: Merge struct rv_reactor_def into struct rv_reactor Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 24/25] rv: Remove rv_reactors reference counter Steven Rostedt
2025-07-25 20:34 ` [for-next][PATCH 25/25] rv: Remove struct rv_monitor::reacting Steven Rostedt

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=20250725203426.115179584@kernel.org \
    --to=rostedt@kernel.org \
    --cc=gmonaco@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=namcao@linutronix.de \
    --cc=tglozar@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®