[PATCH v10 14/19] rv: Add rtapp container monitor

Nam Cao posted 19 patches 4 months ago
There is a newer version of this series
[PATCH v10 14/19] rv: Add rtapp container monitor
Posted by Nam Cao 4 months ago
Add the container "rtapp" which is the monitor collection for detecting
problems with real-time applications. The monitors will be added in the
follow-up commits.

Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 kernel/trace/rv/Kconfig                |  1 +
 kernel/trace/rv/Makefile               |  1 +
 kernel/trace/rv/monitors/rtapp/Kconfig | 14 +++++++++++
 kernel/trace/rv/monitors/rtapp/rtapp.c | 33 ++++++++++++++++++++++++++
 kernel/trace/rv/monitors/rtapp/rtapp.h |  3 +++
 5 files changed, 52 insertions(+)
 create mode 100644 kernel/trace/rv/monitors/rtapp/Kconfig
 create mode 100644 kernel/trace/rv/monitors/rtapp/rtapp.c
 create mode 100644 kernel/trace/rv/monitors/rtapp/rtapp.h

diff --git a/kernel/trace/rv/Kconfig b/kernel/trace/rv/Kconfig
index 6e157f9649915..5c407d2916614 100644
--- a/kernel/trace/rv/Kconfig
+++ b/kernel/trace/rv/Kconfig
@@ -41,6 +41,7 @@ source "kernel/trace/rv/monitors/snroc/Kconfig"
 source "kernel/trace/rv/monitors/scpd/Kconfig"
 source "kernel/trace/rv/monitors/snep/Kconfig"
 source "kernel/trace/rv/monitors/sncid/Kconfig"
+source "kernel/trace/rv/monitors/rtapp/Kconfig"
 # Add new monitors here
 
 config RV_REACTORS
diff --git a/kernel/trace/rv/Makefile b/kernel/trace/rv/Makefile
index f9b2cd0483c3c..9b28c24199955 100644
--- a/kernel/trace/rv/Makefile
+++ b/kernel/trace/rv/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_RV_MON_SNROC) += monitors/snroc/snroc.o
 obj-$(CONFIG_RV_MON_SCPD) += monitors/scpd/scpd.o
 obj-$(CONFIG_RV_MON_SNEP) += monitors/snep/snep.o
 obj-$(CONFIG_RV_MON_SNCID) += monitors/sncid/sncid.o
+obj-$(CONFIG_RV_MON_RTAPP) += monitors/rtapp/rtapp.o
 # Add new monitors here
 obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
 obj-$(CONFIG_RV_REACT_PRINTK) += reactor_printk.o
diff --git a/kernel/trace/rv/monitors/rtapp/Kconfig b/kernel/trace/rv/monitors/rtapp/Kconfig
new file mode 100644
index 0000000000000..658bb78e733a0
--- /dev/null
+++ b/kernel/trace/rv/monitors/rtapp/Kconfig
@@ -0,0 +1,14 @@
+config RV_MON_RTAPP
+	depends on RV
+	bool "rtapp monitor"
+	help
+	  Collection of monitors to check for common problems with real-time
+	  application that may cause unexpected latency.
+
+	  If you are developing a real-time system and not entirely sure whether
+	  the applications are designed correctly for real-time, you want to say
+	  Y here.
+
+	  Beware that enabling this may have impact on performance, even if the
+	  monitors are not running. Therefore you probably should say N for
+	  production kernel.
diff --git a/kernel/trace/rv/monitors/rtapp/rtapp.c b/kernel/trace/rv/monitors/rtapp/rtapp.c
new file mode 100644
index 0000000000000..fd75fc927d654
--- /dev/null
+++ b/kernel/trace/rv/monitors/rtapp/rtapp.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/rv.h>
+
+#define MODULE_NAME "rtapp"
+
+#include "rtapp.h"
+
+struct rv_monitor rv_rtapp;
+
+struct rv_monitor rv_rtapp = {
+	.name = "rtapp",
+	.description = "Collection of monitors for detecting problems with real-time applications",
+};
+
+static int __init register_rtapp(void)
+{
+	return rv_register_monitor(&rv_rtapp, NULL);
+}
+
+static void __exit unregister_rtapp(void)
+{
+	rv_unregister_monitor(&rv_rtapp);
+}
+
+module_init(register_rtapp);
+module_exit(unregister_rtapp);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Nam Cao <namcao@linutronix.de>");
+MODULE_DESCRIPTION("Collection of monitors for detecting problems with real-time applications");
diff --git a/kernel/trace/rv/monitors/rtapp/rtapp.h b/kernel/trace/rv/monitors/rtapp/rtapp.h
new file mode 100644
index 0000000000000..4c200d67c7f67
--- /dev/null
+++ b/kernel/trace/rv/monitors/rtapp/rtapp.h
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+extern struct rv_monitor rv_rtapp;
-- 
2.39.5
Re: [PATCH v10 14/19] rv: Add rtapp container monitor
Posted by Steven Rostedt 3 months, 1 week ago
On Tue, 10 Jun 2025 11:43:39 +0200
Nam Cao <namcao@linutronix.de> wrote:

> Add the container "rtapp" which is the monitor collection for detecting
> problems with real-time applications. The monitors will be added in the
> follow-up commits.
> 
> Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>  kernel/trace/rv/Kconfig                |  1 +
>  kernel/trace/rv/Makefile               |  1 +
>  kernel/trace/rv/monitors/rtapp/Kconfig | 14 +++++++++++
>  kernel/trace/rv/monitors/rtapp/rtapp.c | 33 ++++++++++++++++++++++++++
>  kernel/trace/rv/monitors/rtapp/rtapp.h |  3 +++
>  5 files changed, 52 insertions(+)
>  create mode 100644 kernel/trace/rv/monitors/rtapp/Kconfig
>  create mode 100644 kernel/trace/rv/monitors/rtapp/rtapp.c
>  create mode 100644 kernel/trace/rv/monitors/rtapp/rtapp.h
> 
> diff --git a/kernel/trace/rv/Kconfig b/kernel/trace/rv/Kconfig
> index 6e157f9649915..5c407d2916614 100644
> --- a/kernel/trace/rv/Kconfig
> +++ b/kernel/trace/rv/Kconfig
> @@ -41,6 +41,7 @@ source "kernel/trace/rv/monitors/snroc/Kconfig"
>  source "kernel/trace/rv/monitors/scpd/Kconfig"
>  source "kernel/trace/rv/monitors/snep/Kconfig"
>  source "kernel/trace/rv/monitors/sncid/Kconfig"
> +source "kernel/trace/rv/monitors/rtapp/Kconfig"
>  # Add new monitors here
>  
>  config RV_REACTORS
> diff --git a/kernel/trace/rv/Makefile b/kernel/trace/rv/Makefile
> index f9b2cd0483c3c..9b28c24199955 100644
> --- a/kernel/trace/rv/Makefile
> +++ b/kernel/trace/rv/Makefile
> @@ -12,6 +12,7 @@ obj-$(CONFIG_RV_MON_SNROC) += monitors/snroc/snroc.o
>  obj-$(CONFIG_RV_MON_SCPD) += monitors/scpd/scpd.o
>  obj-$(CONFIG_RV_MON_SNEP) += monitors/snep/snep.o
>  obj-$(CONFIG_RV_MON_SNCID) += monitors/sncid/sncid.o
> +obj-$(CONFIG_RV_MON_RTAPP) += monitors/rtapp/rtapp.o
>  # Add new monitors here
>  obj-$(CONFIG_RV_REACTORS) += rv_reactors.o
>  obj-$(CONFIG_RV_REACT_PRINTK) += reactor_printk.o
> diff --git a/kernel/trace/rv/monitors/rtapp/Kconfig b/kernel/trace/rv/monitors/rtapp/Kconfig
> new file mode 100644
> index 0000000000000..658bb78e733a0
> --- /dev/null
> +++ b/kernel/trace/rv/monitors/rtapp/Kconfig
> @@ -0,0 +1,14 @@
> +config RV_MON_RTAPP
> +	depends on RV
> +	bool "rtapp monitor"
> +	help
> +	  Collection of monitors to check for common problems with real-time
> +	  application that may cause unexpected latency.
> +
> +	  If you are developing a real-time system and not entirely sure whether
> +	  the applications are designed correctly for real-time, you want to say
> +	  Y here.
> +
> +	  Beware that enabling this may have impact on performance, even if the
> +	  monitors are not running. Therefore you probably should say N for
> +	  production kernel.

I'm trying to figure out from the patch how exactly does this cause
performance issues?

Can you elaborate?

Thanks,

-- Steve


> diff --git a/kernel/trace/rv/monitors/rtapp/rtapp.c b/kernel/trace/rv/monitors/rtapp/rtapp.c
> new file mode 100644
> index 0000000000000..fd75fc927d654
> --- /dev/null
> +++ b/kernel/trace/rv/monitors/rtapp/rtapp.c
> @@ -0,0 +1,33 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/rv.h>
> +
> +#define MODULE_NAME "rtapp"
> +
> +#include "rtapp.h"
> +
> +struct rv_monitor rv_rtapp;
> +
> +struct rv_monitor rv_rtapp = {
> +	.name = "rtapp",
> +	.description = "Collection of monitors for detecting problems with real-time applications",
> +};
> +
> +static int __init register_rtapp(void)
> +{
> +	return rv_register_monitor(&rv_rtapp, NULL);
> +}
> +
> +static void __exit unregister_rtapp(void)
> +{
> +	rv_unregister_monitor(&rv_rtapp);
> +}
> +
> +module_init(register_rtapp);
> +module_exit(unregister_rtapp);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Nam Cao <namcao@linutronix.de>");
> +MODULE_DESCRIPTION("Collection of monitors for detecting problems with real-time applications");
> diff --git a/kernel/trace/rv/monitors/rtapp/rtapp.h b/kernel/trace/rv/monitors/rtapp/rtapp.h
> new file mode 100644
> index 0000000000000..4c200d67c7f67
> --- /dev/null
> +++ b/kernel/trace/rv/monitors/rtapp/rtapp.h
> @@ -0,0 +1,3 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +extern struct rv_monitor rv_rtapp;
Re: [PATCH v10 14/19] rv: Add rtapp container monitor
Posted by Nam Cao 3 months, 1 week ago
On Mon, Jun 30, 2025 at 04:04:30PM -0400, Steven Rostedt wrote:
> On Tue, 10 Jun 2025 11:43:39 +0200
> Nam Cao <namcao@linutronix.de> wrote:
> > diff --git a/kernel/trace/rv/monitors/rtapp/Kconfig b/kernel/trace/rv/monitors/rtapp/Kconfig
> > new file mode 100644
> > index 0000000000000..658bb78e733a0
> > --- /dev/null
> > +++ b/kernel/trace/rv/monitors/rtapp/Kconfig
> > @@ -0,0 +1,14 @@
> > +config RV_MON_RTAPP
> > +	depends on RV
> > +	bool "rtapp monitor"
> > +	help
> > +	  Collection of monitors to check for common problems with real-time
> > +	  application that may cause unexpected latency.
> > +
> > +	  If you are developing a real-time system and not entirely sure whether
> > +	  the applications are designed correctly for real-time, you want to say
> > +	  Y here.
> > +
> > +	  Beware that enabling this may have impact on performance, even if the
> > +	  monitors are not running. Therefore you probably should say N for
> > +	  production kernel.
> 
> I'm trying to figure out from the patch how exactly does this cause
> performance issues?
> 
> Can you elaborate?

Sorry for the confusion, this patch alone doesn't affect performance.

It is its child monitor which turns on CONFIG_TRACE_IRQFLAGS, which is
added in a later patch.

Let me move this paragraph to that patch instead.

Nam