[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260123152534.1036533-2-tglozar@redhat.com>
Date: Fri, 23 Jan 2026 16:25:32 +0100
From: Tomas Glozar <tglozar@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Crystal Wood <crwood@...hat.com>,
John Kacur <jkacur@...hat.com>,
Luis Goncalves <lgoncalv@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>,
Tomas Glozar <tglozar@...hat.com>
Subject: [RFC PATCH 1/3] tracing/osnoise: Record timerlat instance counts
While recording a timerlat sample, track how many timerlat instances are
registered at the moment and how many instances have tracing on.
This enables a user of the timerlat_sample threshold to synchronize with
any users of the timerlat tracer instance buffer.
Note that this also reverses the order in which the trace buffer record
and the tracepoint are processed: the tracepoint now fires after the
trace buffer entries are recorded.
Signed-off-by: Tomas Glozar <tglozar@...hat.com>
---
include/trace/events/osnoise.h | 14 ++++++++++----
kernel/trace/trace_osnoise.c | 10 ++++++++--
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/trace/events/osnoise.h b/include/trace/events/osnoise.h
index 3f4273623801..50beaf8fbb52 100644
--- a/include/trace/events/osnoise.h
+++ b/include/trace/events/osnoise.h
@@ -79,26 +79,32 @@ TRACE_EVENT(osnoise_sample,
#ifdef CONFIG_TIMERLAT_TRACER
TRACE_EVENT(timerlat_sample,
- TP_PROTO(struct timerlat_sample *s),
+ TP_PROTO(struct timerlat_sample *s, int instances_registered, int instances_on),
- TP_ARGS(s),
+ TP_ARGS(s, instances_registered, instances_on),
TP_STRUCT__entry(
__field( u64, timer_latency )
__field( unsigned int, seqnum )
__field( int, context )
+ __field( int, instances_registered )
+ __field( int, instances_on )
),
TP_fast_assign(
__entry->timer_latency = s->timer_latency;
__entry->seqnum = s->seqnum;
__entry->context = s->context;
+ __entry->instances_registered = instances_registered;
+ __entry->instances_on = instances_on;
),
- TP_printk("timer_latency=%llu seqnum=%u context=%d",
+ TP_printk("timer_latency=%llu seqnum=%u context=%d instances_registered=%d instances_on=%d",
__entry->timer_latency,
__entry->seqnum,
- __entry->context)
+ __entry->context,
+ __entry->instances_registered,
+ __entry->instances_on)
);
#endif // CONFIG_TIMERLAT_TRACER
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 827104d00bc0..65ddc1f49c19 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -574,15 +574,21 @@ static void record_timerlat_sample(struct timerlat_sample *sample)
{
struct osnoise_instance *inst;
struct trace_buffer *buffer;
-
- trace_timerlat_sample(sample);
+ int instances_registered = 0;
+ int instances_on = 0;
rcu_read_lock();
list_for_each_entry_rcu(inst, &osnoise_instances, list) {
+ if (tracer_tracing_is_on(inst->tr))
+ instances_on++;
+ instances_registered++;
+
buffer = inst->tr->array_buffer.buffer;
__record_timerlat_sample(sample, buffer);
}
rcu_read_unlock();
+
+ trace_timerlat_sample(sample, instances_registered, instances_on);
}
#ifdef CONFIG_STACKTRACE
--
2.52.0
Powered by blists - more mailing lists