From: Tomas Glozar <tglozar@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Crystal Wood <crwood@redhat.com>, John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
Tomas Glozar <tglozar@redhat.com>
Subject: [RFC PATCH 1/3] tracing/osnoise: Record timerlat instance counts
Date: Fri, 23 Jan 2026 16:25:32 +0100 [thread overview]
Message-ID: <20260123152534.1036533-2-tglozar@redhat.com> (raw)
In-Reply-To: <20260123152534.1036533-1-tglozar@redhat.com>
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@redhat.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
next prev parent reply other threads:[~2026-01-23 15:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 15:25 [RFC PATCH 0/3] rtla: Synchronize sample collection methods Tomas Glozar
2026-01-23 15:25 ` Tomas Glozar [this message]
2026-01-23 15:25 ` [RFC PATCH 2/3] rtla/timerlat_bpf: Filter samples unseen by tracer Tomas Glozar
2026-01-23 15:25 ` [RFC PATCH 3/3] rtla/timerlat: Attach BPF program before tracers Tomas Glozar
2026-01-24 18:50 ` [RFC PATCH 0/3] rtla: Synchronize sample collection methods Steven Rostedt
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=20260123152534.1036533-2-tglozar@redhat.com \
--to=tglozar@redhat.com \
--cc=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--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