Skip to content

Commit fac5493

Browse files
covanamrostedt
authored andcommitted
rv: Allow to configure the number of per-task monitor
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. 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/93e83313fc4ba7f6e66f4abe80ca5f5494d658d0.1752088709.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>
1 parent 670ff94 commit fac5493

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

include/linux/rv.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,7 @@ struct ltl_monitor {};
7575

7676
#endif /* CONFIG_RV_LTL_MONITOR */
7777

78-
/*
79-
* Per-task RV monitors count. Nowadays fixed in RV_PER_TASK_MONITORS.
80-
* If we find justification for more monitors, we can think about
81-
* adding more or developing a dynamic method. So far, none of
82-
* these are justified.
83-
*/
84-
#define RV_PER_TASK_MONITORS 1
85-
#define RV_PER_TASK_MONITOR_INIT (RV_PER_TASK_MONITORS)
78+
#define RV_PER_TASK_MONITOR_INIT (CONFIG_RV_PER_TASK_MONITORS)
8679

8780
union rv_task_monitor {
8881
struct da_monitor da_mon;

include/linux/sched.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,12 +1642,10 @@ struct task_struct {
16421642

16431643
#ifdef CONFIG_RV
16441644
/*
1645-
* Per-task RV monitor. Nowadays fixed in RV_PER_TASK_MONITORS.
1646-
* If we find justification for more monitors, we can think
1647-
* about adding more or developing a dynamic method. So far,
1648-
* none of these are justified.
1645+
* Per-task RV monitor, fixed in CONFIG_RV_PER_TASK_MONITORS.
1646+
* If memory becomes a concern, we can think about a dynamic method.
16491647
*/
1650-
union rv_task_monitor rv[RV_PER_TASK_MONITORS];
1648+
union rv_task_monitor rv[CONFIG_RV_PER_TASK_MONITORS];
16511649
#endif
16521650

16531651
#ifdef CONFIG_USER_EVENTS

kernel/trace/rv/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ menuconfig RV
3232
For further information, see:
3333
Documentation/trace/rv/runtime-verification.rst
3434

35+
config RV_PER_TASK_MONITORS
36+
int "Maximum number of per-task monitor"
37+
depends on RV
38+
range 1 8
39+
default 2
40+
help
41+
This option configures the maximum number of per-task RV monitors that can run
42+
simultaneously.
43+
3544
source "kernel/trace/rv/monitors/wip/Kconfig"
3645
source "kernel/trace/rv/monitors/wwnr/Kconfig"
3746
source "kernel/trace/rv/monitors/sched/Kconfig"

kernel/trace/rv/monitors/rtapp/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
config RV_MON_RTAPP
22
depends on RV
3+
depends on RV_PER_TASK_MONITORS >= 2
34
bool "rtapp monitor"
45
help
56
Collection of monitors to check for common problems with real-time

kernel/trace/rv/rv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,20 @@ struct dentry *get_monitors_root(void)
165165
LIST_HEAD(rv_monitors_list);
166166

167167
static int task_monitor_count;
168-
static bool task_monitor_slots[RV_PER_TASK_MONITORS];
168+
static bool task_monitor_slots[CONFIG_RV_PER_TASK_MONITORS];
169169

170170
int rv_get_task_monitor_slot(void)
171171
{
172172
int i;
173173

174174
lockdep_assert_held(&rv_interface_lock);
175175

176-
if (task_monitor_count == RV_PER_TASK_MONITORS)
176+
if (task_monitor_count == CONFIG_RV_PER_TASK_MONITORS)
177177
return -EBUSY;
178178

179179
task_monitor_count++;
180180

181-
for (i = 0; i < RV_PER_TASK_MONITORS; i++) {
181+
for (i = 0; i < CONFIG_RV_PER_TASK_MONITORS; i++) {
182182
if (task_monitor_slots[i] == false) {
183183
task_monitor_slots[i] = true;
184184
return i;
@@ -194,7 +194,7 @@ void rv_put_task_monitor_slot(int slot)
194194
{
195195
lockdep_assert_held(&rv_interface_lock);
196196

197-
if (slot < 0 || slot >= RV_PER_TASK_MONITORS) {
197+
if (slot < 0 || slot >= CONFIG_RV_PER_TASK_MONITORS) {
198198
WARN_ONCE(1, "RV releasing an invalid slot!: %d\n", slot);
199199
return;
200200
}

0 commit comments

Comments
 (0)