Skip to content

Commit 65daaca

Browse files
committed
tracing: Allow wakeup tracers to be used by instances
The wakeup and wakeup_rt tracers can now be used by instances. But they may only be used by one instance at a time (including the top level directory). This allows multiple tracers to run while the wakeup tracer is running simultaneously. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 0b9b12c commit 65daaca

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎kernel/trace/trace_sched_wakeup.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ static void stop_wakeup_tracer(struct trace_array *tr)
601601
unregister_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL);
602602
}
603603

604+
static bool wakeup_busy;
605+
604606
static int __wakeup_tracer_init(struct trace_array *tr)
605607
{
606608
save_flags = trace_flags;
@@ -613,25 +615,36 @@ static int __wakeup_tracer_init(struct trace_array *tr)
613615
wakeup_trace = tr;
614616
ftrace_init_array_ops(tr, wakeup_tracer_call);
615617
start_wakeup_tracer(tr);
618+
619+
wakeup_busy = true;
616620
return 0;
617621
}
618622

619623
static int wakeup_tracer_init(struct trace_array *tr)
620624
{
625+
if (wakeup_busy)
626+
return -EBUSY;
627+
621628
wakeup_dl = 0;
622629
wakeup_rt = 0;
623630
return __wakeup_tracer_init(tr);
624631
}
625632

626633
static int wakeup_rt_tracer_init(struct trace_array *tr)
627634
{
635+
if (wakeup_busy)
636+
return -EBUSY;
637+
628638
wakeup_dl = 0;
629639
wakeup_rt = 1;
630640
return __wakeup_tracer_init(tr);
631641
}
632642

633643
static int wakeup_dl_tracer_init(struct trace_array *tr)
634644
{
645+
if (wakeup_busy)
646+
return -EBUSY;
647+
635648
wakeup_dl = 1;
636649
wakeup_rt = 0;
637650
return __wakeup_tracer_init(tr);
@@ -649,6 +662,7 @@ static void wakeup_tracer_reset(struct trace_array *tr)
649662
set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, lat_flag);
650663
set_tracer_flag(tr, TRACE_ITER_OVERWRITE, overwrite_flag);
651664
ftrace_reset_array_ops(tr);
665+
wakeup_busy = false;
652666
}
653667

654668
static void wakeup_tracer_start(struct trace_array *tr)
@@ -680,6 +694,7 @@ static struct tracer wakeup_tracer __read_mostly =
680694
#endif
681695
.open = wakeup_trace_open,
682696
.close = wakeup_trace_close,
697+
.allow_instances = true,
683698
.use_max_tr = true,
684699
};
685700

@@ -702,6 +717,7 @@ static struct tracer wakeup_rt_tracer __read_mostly =
702717
#endif
703718
.open = wakeup_trace_open,
704719
.close = wakeup_trace_close,
720+
.allow_instances = true,
705721
.use_max_tr = true,
706722
};
707723

0 commit comments

Comments
 (0)