From nobody Tue Feb 10 01:19:43 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 467DC3358C7 for ; Mon, 26 Jan 2026 10:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769424284; cv=none; b=qm0fuB0Oi5wguOQp7hsZumzPxbK5UqK8hVh4iSJPKiuOO1nvipvg48sChn8tydtnNQVW0FVUeW6u3Hsyxb6IHYzbCdhUjzZVpqCJd/EzxWua0jqOQVuEE9ETVp6aa42CWjIBf1rOWwtCROxWbPvOwPS5+Bcp2cK0u1j0umIMTkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769424284; c=relaxed/simple; bh=EpZK/BzfjQaUyxEz514oZ/jLm3vGGjz0nMsmnHSNIkI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FFSJBz5jglFS6wVD40ADt0NMcCj3bduZ0Zrvig4FlH5rnLQDfGD93XBy6tkXbSnChq17qP63NGfFYnByuN3uphQY0oA3PrPVC4Bp7p4p/77kjafTxlHdcBrPYp0Jql54oTf7csSOUjuS/bJ3G0WpaEBW6qMXkzeIUOjfl7IeKUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=qxiOrG7p; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qxiOrG7p" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-47ee9a53e8fso36770155e9.0 for ; Mon, 26 Jan 2026 02:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769424280; x=1770029080; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zUro18mbSKiw5/VA7IRp/lLCcUE0ruHzOjVvSoVnLbM=; b=qxiOrG7pmM3te3gdYuIrFXZVC9l+HVAlrVLqdD7RY8KfuTWvt9++PATdu++iQ4nGr2 i1joQtz+QewOr1UUoSlavxrmfGxQramxsHvP55oiHhaY4yP94k79e6/8yTX+U41TJvoA Ea1A5YtfQH2++p09TbLU+POHOMwR5Fbq07v0GXpJXixN+zkLEbRiTQnQiR5+qu4xdahn mKb57P9CqPtBsMDUwxBLqa9E2NjRy3/Y3jrhmwPrJPcj3sXfLToSTkT/Gf8nyB9J2Umg XniXL+GLaz+8cIiISWk/kM2fp1Se8sPYqMd3qxMBoYN/iPXEJfv6140cd+BHnXrrok76 ZeOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769424280; x=1770029080; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zUro18mbSKiw5/VA7IRp/lLCcUE0ruHzOjVvSoVnLbM=; b=UMMNKIQRNvn4IXdilOPFmYrE5aPcS8trEyi1IwkLymwfhe90v4Q1xTkDL8/1Ww1GD4 Cy08HDEvauAwT9cSau3Lrbj1FliA9TJ63+SXu0RrvmjxxrorVPIqOo8rHATDKr4+qi4W 8/xzqyHqhu+OmoqbWA7aCKZRYj0DV4t+n6ogaiFPReFH7fF9OR6udV94YS1+UU/K0kud lvvIWYUcRe0r1P66wZhYOtj8VosaCSUy3perRACFn5SDeEAnMyEhsrFga5x7kt/D5cx0 FKH/7zrS7kA94osDSpPrdWGf+EjQuUTsUqki3/cxgqeeSL95n9QL3MOEEIGd7G8nx5lR V5VQ== X-Forwarded-Encrypted: i=1; AJvYcCXA3H6oKWPALWNqYqEqGVxi3uVQXQ9keBUD5nqZ+5q/ORdIMBmNWgcNd8XZWxKaCpCGX9PtiEN422YlpBc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz93MyuwByDhmKRRtDYLveLgEElwdM7cMDghTgGT+Brik8iAjRe NER8IM5yP0mqwctSPFSan2kTg88ExQf4tBUXpzaIKgCXjDhwCxXhmLZbpcH+0pjoxyACxclT+cu UikOsfNmXKkRMW81y5q0ZzA== X-Received: from wmom18.prod.google.com ([2002:a05:600c:4612:b0:480:4a03:7b80]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:34c7:b0:477:a978:3a7b with SMTP id 5b1f17b1804b1-4805cf5ec2cmr63608005e9.22.1769424280511; Mon, 26 Jan 2026 02:44:40 -0800 (PST) Date: Mon, 26 Jan 2026 10:44:05 +0000 In-Reply-To: <20260126104419.1649811-1-vdonnefort@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260126104419.1649811-1-vdonnefort@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260126104419.1649811-17-vdonnefort@google.com> Subject: [PATCH v10 16/30] Documentation: tracing: Add tracing remotes From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-trace-kernel@vger.kernel.org, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, jstultz@google.com, qperret@google.com, will@kernel.org, aneesh.kumar@kernel.org, kernel-team@android.com, linux-kernel@vger.kernel.org, Vincent Donnefort Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add documentation about the newly introduced tracing remotes framework. Signed-off-by: Vincent Donnefort diff --git a/Documentation/trace/index.rst b/Documentation/trace/index.rst index b4a429dc4f7a..d77ffb7e2d08 100644 --- a/Documentation/trace/index.rst +++ b/Documentation/trace/index.rst @@ -90,6 +90,17 @@ interactions. user_events uprobetracer =20 +Remote Tracing +-------------- + +This section covers the framework to read compatible ring-buffers, written= by +entities outside of the kernel (most likely firmware or hypervisor) + +.. toctree:: + :maxdepth: 1 + + remotes + Additional Resources -------------------- =20 diff --git a/Documentation/trace/remotes.rst b/Documentation/trace/remotes.= rst new file mode 100644 index 000000000000..e7fb3ee96c30 --- /dev/null +++ b/Documentation/trace/remotes.rst @@ -0,0 +1,59 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Tracing Remotes +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +:Author: Vincent Donnefort + +Overview +=3D=3D=3D=3D=3D=3D=3D=3D +A trace remote relies on ring-buffer remotes to read and control compatible +tracing buffers, written by entity such as firmware or hypervisor. + +Once registered, a tracefs instance will appear for this remote in the Tra= cefs +directory **remotes/**. This remote can be read and controlled using the s= ame +files as regular Tracefs instances such as **trace_pipe**, **tracing_on** = or +**trace**. + +Register a remote +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +A remote must provide a set of callbacks `struct trace_remote_callbacks` w= hom +description can be found below. Those callbacks allows Tracefs to enable a= nd +disable tracing and events, to load and unload a tracing buffer (a set of +ring-buffers) and to swap a reader page with the head page, which enables +consuming reading. + +.. kernel-doc:: include/linux/trace_remote.h + +Declare a remote event +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Macros are provided to ease the declaration of remote events, in a similar +fashion to in-kernel events. A declaration must provide an ID, a descripti= on of +the event arguments and how to print the event: + +.. code-block:: c + + REMOTE_EVENT(foo, EVENT_FOO_ID, + RE_STRUCT( + re_field(u64, bar) + ), + RE_PRINTK("bar=3D%lld", __entry->bar) + ); + +Then those events must be declared in a C file with the following: + +.. code-block:: c + + #define REMOTE_EVENT_INCLUDE_FILE foo_events.h + #include + +This will provide a `struct remote_event remote_event_foo` that can be giv= en to +`trace_remote_register`. + +Simple ring-buffer +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +A simple implementation for a ring-buffer writer can be found in +kernel/trace/simple_ring_buffer.c. + +.. kernel-doc:: include/linux/simple_ring_buffer.h --=20 2.52.0.457.g6b5491de43-goog