linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: Nam Cao <namcao@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	 linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: john.ogness@linutronix.de
Subject: Re: [PATCH v2 22/22] rv: Allow to configure the number of per-task monitor
Date: Fri, 11 Apr 2025 14:31:19 +0200	[thread overview]
Message-ID: <3856012ded193df3685d9a11724612896165179a.camel@redhat.com> (raw)
In-Reply-To: <2591d725ec3dddfa27ad1826e7440fca71671770.1744355018.git.namcao@linutronix.de>

On Fri, 2025-04-11 at 09:37 +0200, Nam Cao wrote:
> Now that there are 2 monitors for real-time applications, users may
> want to
> enable both of them simultaneously. Make the number of per-task
> monitor
> configurable. Default it to 2 for now.
> 
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>  include/linux/rv.h      | 2 +-
>  include/linux/sched.h   | 8 +++-----
>  kernel/trace/rv/Kconfig | 9 +++++++++
>  kernel/trace/rv/rv.c    | 8 ++++----
>  4 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/include/linux/rv.h b/include/linux/rv.h
> index c8320fa3a94b..204436a73bee 100644
> --- a/include/linux/rv.h
> +++ b/include/linux/rv.h
> @@ -75,7 +75,7 @@ static inline bool rv_ltl_all_atoms_known(struct
> ltl_monitor *mon)
>   * these are justified.
>   */
>  #define RV_PER_TASK_MONITORS		1

We could get rid of RV_PER_TASK_MONITORS too I guess.

Rest looks good, thanks.

Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>

> -#define RV_PER_TASK_MONITOR_INIT	(RV_PER_TASK_MONITORS)
> +#define
> RV_PER_TASK_MONITOR_INIT	(CONFIG_RV_PER_TASK_MONITORS)
>  
>  union rv_task_monitor {
>  	struct da_monitor	da_mon;
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 45be0fa7a5cc..560782493292 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1623,12 +1623,10 @@ struct task_struct {
>  
>  #ifdef CONFIG_RV
>  	/*
> -	 * Per-task RV monitor. Nowadays fixed in
> RV_PER_TASK_MONITORS.
> -	 * If we find justification for more monitors, we can think
> -	 * about adding more or developing a dynamic method. So far,
> -	 * none of these are justified.
> +	 * Per-task RV monitor, fixed in
> CONFIG_RV_PER_TASK_MONITORS.
> +	 * If memory becomes a concern, we can think about a dynamic
> method.
>  	 */
> -	union rv_task_monitor		rv[RV_PER_TASK_MONITORS];
> +	union
> rv_task_monitor		rv[CONFIG_RV_PER_TASK_MONITORS];
>  #endif
>  
>  #ifdef CONFIG_USER_EVENTS
> diff --git a/kernel/trace/rv/Kconfig b/kernel/trace/rv/Kconfig
> index 942d57575e67..c11bf7e61ebf 100644
> --- a/kernel/trace/rv/Kconfig
> +++ b/kernel/trace/rv/Kconfig
> @@ -32,6 +32,15 @@ menuconfig RV
>  	  For further information, see:
>  	    Documentation/trace/rv/runtime-verification.rst
>  
> +config RV_PER_TASK_MONITORS
> +	int "Maximum number of per-task monitor"
> +	depends on RV
> +	range 1 8
> +	default 2
> +	help
> +	  This option configures the maximum number of per-task RV
> monitors that can run
> +	  simultaneously.
> +
>  source "kernel/trace/rv/monitors/wip/Kconfig"
>  source "kernel/trace/rv/monitors/wwnr/Kconfig"
>  source "kernel/trace/rv/monitors/sched/Kconfig"
> diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
> index d493fddf411f..ebd4b4b228bf 100644
> --- a/kernel/trace/rv/rv.c
> +++ b/kernel/trace/rv/rv.c
> @@ -165,7 +165,7 @@ struct dentry *get_monitors_root(void)
>  LIST_HEAD(rv_monitors_list);
>  
>  static int task_monitor_count;
> -static bool task_monitor_slots[RV_PER_TASK_MONITORS];
> +static bool task_monitor_slots[CONFIG_RV_PER_TASK_MONITORS];
>  
>  int rv_get_task_monitor_slot(void)
>  {
> @@ -173,12 +173,12 @@ int rv_get_task_monitor_slot(void)
>  
>  	lockdep_assert_held(&rv_interface_lock);
>  
> -	if (task_monitor_count == RV_PER_TASK_MONITORS)
> +	if (task_monitor_count == CONFIG_RV_PER_TASK_MONITORS)
>  		return -EBUSY;
>  
>  	task_monitor_count++;
>  
> -	for (i = 0; i < RV_PER_TASK_MONITORS; i++) {
> +	for (i = 0; i < CONFIG_RV_PER_TASK_MONITORS; i++) {
>  		if (task_monitor_slots[i] == false) {
>  			task_monitor_slots[i] = true;
>  			return i;
> @@ -194,7 +194,7 @@ void rv_put_task_monitor_slot(int slot)
>  {
>  	lockdep_assert_held(&rv_interface_lock);
>  
> -	if (slot < 0 || slot >= RV_PER_TASK_MONITORS) {
> +	if (slot < 0 || slot >= CONFIG_RV_PER_TASK_MONITORS) {
>  		WARN_ONCE(1, "RV releasing an invalid slot!: %d\n",
> slot);
>  		return;
>  	}


      reply	other threads:[~2025-04-11 12:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11  7:37 [PATCH v2 00/22] RV: Linear temporal logic monitors for RT application Nam Cao
2025-04-11  7:37 ` [PATCH v2 01/22] rv: Fix out-of-bound memory access in rv_is_container_monitor() Nam Cao
2025-04-11  7:37 ` [PATCH v2 02/22] rv: Add #undef TRACE_INCLUDE_FILE Nam Cao
2025-04-11  7:37 ` [PATCH v2 03/22] rv: Let the reactors take care of buffers Nam Cao
2025-04-11  8:39   ` Gabriele Monaco
2025-04-15  9:32   ` Petr Mladek
2025-04-15  9:53     ` Nam Cao
2025-04-11  7:37 ` [PATCH v2 04/22] verification/dot2k: Make it possible to invoke dot2k without installation Nam Cao
2025-04-11  9:23   ` Gabriele Monaco
2025-04-11 14:04     ` Nam Cao
2025-04-11 14:56       ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 05/22] verification/dot2k: Make a separate dot2k_templates/Kconfig_container Nam Cao
2025-04-11  8:54   ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 06/22] verification/dot2k: Remove __buff_to_string() Nam Cao
2025-04-11  8:53   ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 07/22] verification/dot2k: Replace is_container() hack with subparsers Nam Cao
2025-04-11  8:56   ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 08/22] rv: rename CONFIG_DA_MON_EVENTS to CONFIG_RV_MON_EVENTS Nam Cao
2025-04-11 10:37   ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 09/22] verification/dot2k: Prepare the frontend for LTL inclusion Nam Cao
2025-04-11  7:37 ` [PATCH v2 10/22] Documentation/rv: Prepare monitor synthesis document " Nam Cao
2025-04-11  9:28   ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 11/22] verification/rvgen: Prepare the templates " Nam Cao
2025-04-11  7:37 ` [PATCH v2 12/22] verification/rvgen: Restructure the classes to prepare " Nam Cao
2025-04-11  7:37 ` [PATCH v2 13/22] rv: Add support for LTL monitors Nam Cao
2025-04-11 11:17   ` Gabriele Monaco
2025-04-11 14:15     ` Nam Cao
2025-04-15 13:22   ` Gabriele Monaco
2025-04-16  3:55     ` Nam Cao
2025-04-11  7:37 ` [PATCH v2 14/22] rv: Add rtapp container monitor Nam Cao
2025-04-11  7:37 ` [PATCH v2 15/22] x86/tracing: Remove redundant trace_pagefault_key Nam Cao
2025-04-11  7:37 ` [PATCH v2 16/22] x86/tracing: Move page fault trace points to generic Nam Cao
2025-04-11  7:37 ` [PATCH v2 17/22] arm64: mm: Add page fault trace points Nam Cao
2025-04-11  7:37 ` [PATCH v2 18/22] riscv: " Nam Cao
2025-04-11  7:37 ` [PATCH v2 19/22] rv: Add rtapp_pagefault monitor Nam Cao
2025-04-15 12:31   ` Gabriele Monaco
2025-04-15 12:38     ` Nam Cao
2025-04-15 12:47       ` Gabriele Monaco
2025-04-11  7:37 ` [PATCH v2 20/22] rv: Add rtapp_sleep monitor Nam Cao
2025-04-11  7:37 ` [PATCH v2 21/22] rv: Add documentation for rtapp monitor Nam Cao
2025-04-15 13:12   ` Gabriele Monaco
2025-04-16  4:37     ` Nam Cao
2025-04-11  7:37 ` [PATCH v2 22/22] rv: Allow to configure the number of per-task monitor Nam Cao
2025-04-11 12:31   ` Gabriele Monaco [this message]

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=3856012ded193df3685d9a11724612896165179a.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=namcao@linutronix.de \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).