From nobody Mon Feb 9 04:14:18 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A9BB2DAFB0 for ; Fri, 23 Jan 2026 15:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769183009; cv=none; b=HZHERrFl7SmxvosnCQ41gP5SesDzrCluPxiPcazVs68kcLNvYv05URhbsrN0K9FGYVA1pGuYh+5D3g8RFIlVxblmBOU/ECyrWl6HZ+boaOyTVzAkM8Ho2P9QFesTqGmy/6r9lCoOLT79MQvF4RMKDpALn9Ze3nmNtquHUZyP42k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769183009; c=relaxed/simple; bh=B1apLdGdbSeS7TZ9uWJagJsoGYG3fb4E+Tmcww/wsEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k2wJz0I5Q7lmvYMGmyAi7QTePZaNTpmD00F02rg69Q+okmmnfRdJ4s4NOa3aSweLy0HiTDF8w6RTTxNUvva3m1RnP8ZGADwWo/SYgYvYeEmiJk1UWW3FL9+QeZu1V/FONbXE9afKB4/AkNYbPfq3hklBFHsQVef5Nz4eD/yVUJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aA9hjnu/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aA9hjnu/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769183007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XChOJQVNTKzLAzN/OE5pi3ush6z4OzNOlNgezYKdP9s=; b=aA9hjnu/YDHz2B0X51NqkabKzrRI0lxvCU04S1YwDOyR96/IiDKKp/BEmG7jsWGW7Py7wn Cb6YtYyH1P/LiRQdzwoe7R4Fo1kY4HgUvAtnSypvrRB3VQAzOFMdifwuB3J8JR6DrInwXk RxUcoBZmA+IIcE1UtYsqd2QasXfrotc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-9-zzfGPp-TNKqfiHwHjfYDUA-1; Fri, 23 Jan 2026 10:43:23 -0500 X-MC-Unique: zzfGPp-TNKqfiHwHjfYDUA-1 X-Mimecast-MFC-AGG-ID: zzfGPp-TNKqfiHwHjfYDUA_1769183002 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B1ACC1956094; Fri, 23 Jan 2026 15:43:22 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.33.59]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8DA9018004D8; Fri, 23 Jan 2026 15:43:19 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt , Masami Hiramatsu Cc: Mathieu Desnoyers , Crystal Wood , John Kacur , Luis Goncalves , LKML , Linux Trace Kernel , Tomas Glozar Subject: [RFC PATCH 1/3] tracing/osnoise: Record timerlat instance counts Date: Fri, 23 Jan 2026 16:25:32 +0100 Message-ID: <20260123152534.1036533-2-tglozar@redhat.com> In-Reply-To: <20260123152534.1036533-1-tglozar@redhat.com> References: <20260123152534.1036533-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" 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 --- 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, =20 - TP_PROTO(struct timerlat_sample *s), + TP_PROTO(struct timerlat_sample *s, int instances_registered, int instanc= es_on), =20 - TP_ARGS(s), + TP_ARGS(s, instances_registered, instances_on), =20 TP_STRUCT__entry( __field( u64, timer_latency ) __field( unsigned int, seqnum ) __field( int, context ) + __field( int, instances_registered ) + __field( int, instances_on ) ), =20 TP_fast_assign( __entry->timer_latency =3D s->timer_latency; __entry->seqnum =3D s->seqnum; __entry->context =3D s->context; + __entry->instances_registered =3D instances_registered; + __entry->instances_on =3D instances_on; ), =20 - TP_printk("timer_latency=3D%llu seqnum=3D%u context=3D%d", + TP_printk("timer_latency=3D%llu seqnum=3D%u context=3D%d instances_regist= ered=3D%d instances_on=3D%d", __entry->timer_latency, __entry->seqnum, - __entry->context) + __entry->context, + __entry->instances_registered, + __entry->instances_on) ); #endif // CONFIG_TIMERLAT_TRACER =20 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_sa= mple *sample) { struct osnoise_instance *inst; struct trace_buffer *buffer; - - trace_timerlat_sample(sample); + int instances_registered =3D 0; + int instances_on =3D 0; =20 rcu_read_lock(); list_for_each_entry_rcu(inst, &osnoise_instances, list) { + if (tracer_tracing_is_on(inst->tr)) + instances_on++; + instances_registered++; + buffer =3D inst->tr->array_buffer.buffer; __record_timerlat_sample(sample, buffer); } rcu_read_unlock(); + + trace_timerlat_sample(sample, instances_registered, instances_on); } =20 #ifdef CONFIG_STACKTRACE --=20 2.52.0