From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Tomas Glozar <tglozar@redhat.com>, John Kacur <jkacur@redhat.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Gabriele Monaco <gmonaco@redhat.com>,
Nam Cao <namcao@linutronix.de>
Subject: [for-next][PATCH 24/25] rv: Remove rv_reactors reference counter
Date: Fri, 25 Jul 2025 16:34:21 -0400 [thread overview]
Message-ID: <20250725203427.982046449@kernel.org> (raw)
In-Reply-To: 20250725203357.087558746@kernel.org
From: Nam Cao <namcao@linutronix.de>
rv_reactor has a reference counter to ensure it is not removed while
monitors are still using it.
However, this is futile, as __exit functions are not expected to fail and
will proceed normally despite rv_unregister_reactor() returning an error.
At the moment, reactors do not support being built as modules, therefore
they are never removed and the reference counters are not necessary.
If we support building RV reactors as modules in the future, kernel
module's centralized facilities such as try_module_get(), module_put() or
MODULE_SOFTDEP should be used instead of this custom implementation.
Remove this reference counter.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/bb946398436a5e17fb0f5b842ef3313c02291852.1753378331.git.namcao@linutronix.de
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
include/linux/rv.h | 2 --
kernel/trace/rv/rv.c | 1 -
kernel/trace/rv/rv.h | 6 ------
kernel/trace/rv/rv_reactors.c | 33 ++-------------------------------
4 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/include/linux/rv.h b/include/linux/rv.h
index c22c9b8c1567..2f867d6f72ba 100644
--- a/include/linux/rv.h
+++ b/include/linux/rv.h
@@ -91,8 +91,6 @@ struct rv_reactor {
const char *description;
__printf(1, 2) void (*react)(const char *msg, ...);
struct list_head list;
- /* protected by the monitor interface lock */
- int counter;
};
#endif
diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 6c0be2fdc52d..6c8498743b98 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -769,7 +769,6 @@ static const struct file_operations monitoring_on_fops = {
static void destroy_monitor_dir(struct rv_monitor *mon)
{
- reactor_cleanup_monitor(mon);
rv_remove(mon->root_d);
}
diff --git a/kernel/trace/rv/rv.h b/kernel/trace/rv/rv.h
index 8c38f9dd41bc..1485a70c1bf4 100644
--- a/kernel/trace/rv/rv.h
+++ b/kernel/trace/rv/rv.h
@@ -31,7 +31,6 @@ bool rv_is_nested_monitor(struct rv_monitor *mon);
#ifdef CONFIG_RV_REACTORS
int reactor_populate_monitor(struct rv_monitor *mon);
-void reactor_cleanup_monitor(struct rv_monitor *mon);
int init_rv_reactors(struct dentry *root_dir);
#else
static inline int reactor_populate_monitor(struct rv_monitor *mon)
@@ -39,11 +38,6 @@ static inline int reactor_populate_monitor(struct rv_monitor *mon)
return 0;
}
-static inline void reactor_cleanup_monitor(struct rv_monitor *mon)
-{
- return;
-}
-
static inline int init_rv_reactors(struct dentry *root_dir)
{
return 0;
diff --git a/kernel/trace/rv/rv_reactors.c b/kernel/trace/rv/rv_reactors.c
index 2c7909e6d0e7..a8e849e6cd85 100644
--- a/kernel/trace/rv/rv_reactors.c
+++ b/kernel/trace/rv/rv_reactors.c
@@ -172,10 +172,6 @@ static void monitor_swap_reactors_single(struct rv_monitor *mon,
if (monitor_enabled)
rv_disable_monitor(mon);
- /* swap reactor's usage */
- mon->reactor->counter--;
- reactor->counter++;
-
mon->reactor = reactor;
mon->reacting = reacting;
mon->react = reactor->react;
@@ -343,23 +339,10 @@ int rv_register_reactor(struct rv_reactor *reactor)
*/
int rv_unregister_reactor(struct rv_reactor *reactor)
{
- int ret = 0;
-
mutex_lock(&rv_interface_lock);
-
- if (!reactor->counter) {
- list_del(&reactor->list);
- } else {
- printk(KERN_WARNING
- "rv: the rv_reactor %s is in use by %d monitor(s)\n",
- reactor->name, reactor->counter);
- printk(KERN_WARNING "rv: the rv_reactor %s cannot be removed\n",
- reactor->name);
- ret = -EBUSY;
- }
-
+ list_del(&reactor->list);
mutex_unlock(&rv_interface_lock);
- return ret;
+ return 0;
}
/*
@@ -456,23 +439,11 @@ int reactor_populate_monitor(struct rv_monitor *mon)
* Configure as the rv_nop reactor.
*/
mon->reactor = get_reactor_rdef_by_name("nop");
- mon->reactor->counter++;
mon->reacting = false;
return 0;
}
-/**
- * reactor_cleanup_monitor - cleanup a monitor reference
- * @mon: the monitor.
- */
-void reactor_cleanup_monitor(struct rv_monitor *mon)
-{
- lockdep_assert_held(&rv_interface_lock);
- mon->reactor->counter--;
- WARN_ON_ONCE(mon->reactor->counter < 0);
-}
-
/*
* Nop reactor register
*/
--
2.47.2
next prev 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 ` [for-next][PATCH 13/25] verification/rvgen: Support the next operator Steven Rostedt
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 ` Steven Rostedt [this message]
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=20250725203427.982046449@kernel.org \
--to=rostedt@kernel.org \
--cc=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.