From nobody Mon Feb 9 08:28:43 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 EF19A353ECE for ; Sat, 31 Jan 2026 13:29:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769866180; cv=none; b=jYivsDlZffm6GXolj6q5kWA1tXOLTYGTFpmbpv6pdoMogqFaakA7z06XM/ztP6OI0aBdV22+o2iZ6TSc/A8N0dmZhPzBWrpRx6T9HyQmBc64Pp8EKkT7GFj3HkaMxlQpleeToLTQjM4qNCMSURM4+hMuHbnfkEO+dhmVD8v9tDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769866180; c=relaxed/simple; bh=KqGQJ3tC3qFnZ/Dn8gtyeUO3Ghwgazfb45Eed7HGhOY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pjkybcKaJ+X66FuoCFWCp6SFdOxI8PgnM2XcGSf7DM1SSR2V7SmoQjr2g3qgMfBI8VAS9/EFRnYkqHYOYjGBknvJTavOZdX4PqTN3IbaYnUNThw3r1TGpUQO70ABAqvTn/MubZkh2ef8iH3zJcvMQ4Am352B/BglopzcdGyLzrc= 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=pQE3I+GP; arc=none smtp.client-ip=209.85.128.73 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="pQE3I+GP" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-47edfdc6c1aso23383865e9.3 for ; Sat, 31 Jan 2026 05:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769866176; x=1770470976; 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=t7Sypasz+bQGyNEk8DfMJjS2f0ZOWyjNay6SOTdco7o=; b=pQE3I+GPEVKRocsRYapeMXi1UdFDBIPGYw7PLdrcZ/UnRaa97Spl3Sxe/Q1r7JldEe alv4vxh5CRuV0tZRQ+uwWBnWkMErEmslxHkqWF7uTLgGIs6HeP46NJkkI3mhenJYHRvH Yx8IErAzdHGJvbtjp2e45ZxbN44C4vX0pijKImmrCrwsZvHQyzRppGHOXbPvzeTJ5nt0 k9/C2Z3cS7Zg/fagIeO074CHQ+QNsmAC8uVE6kCMz6uhZBxC/xbQn9dBlGn0/vJoyedj IKakkh6vezqgE2KVPacj3k8yq0WF+BFT0AgSK6i1b41U55QPqQ+7u6n+D3XbljrLBFFb hKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769866176; x=1770470976; 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=t7Sypasz+bQGyNEk8DfMJjS2f0ZOWyjNay6SOTdco7o=; b=WhjvXYrzA+B2/DCe+7tlNYgMKYwDPueYTNi3naTIFBylZD77Ae7hmn78dN1Se8QlNV j7GSGOHUNRqZEK6jKCmPyhw0OtzWhOcp77TFAmXrbj4OZvLy62OztCetga4xsqAqzm0+ zv7hrlSWKrlGaHylNTqc2gIZ3zDbAY7LUlZLyWFTIT1QWsMlX0L5Gun1WCJh8hnGUy2+ hkl82/GjChZRzg03i+0H++bCATZz8Dsg4mwqIbJZN2Z7acEKv6XqQkfRAD8x6mMNDrN6 COFm4vo0FA6WcAGjNTK1LNuMNMHq2z63t70cNdJUTvgPh7YT+bAB21OxSEglFQjGhVh0 YsaQ== X-Forwarded-Encrypted: i=1; AJvYcCWmcNe02UOVUsOy3BqXOq8AJodOjiqA07V7f0IhWUOQih+uVMlHV8xPDkXdfWudfZ+8J4Za3ayphDD5lDA=@vger.kernel.org X-Gm-Message-State: AOJu0YxAPmIkCBh5TZqpOC3J677bpAdgWlJw/bQDiIdNIPzALFOiJS04 Gxme3q62aJsUxPtMka2VXY3K4TnOHrVwlYOy6SRZ4V8Npq3C3qZkAszggUwykvolxyTsaUCkQuX k1vXQwo2BbWnJ0xu7oc1nDg== X-Received: from wmot11.prod.google.com ([2002:a05:600c:450b:b0:480:6ccb:80fd]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:34cd:b0:480:1a3a:5ce6 with SMTP id 5b1f17b1804b1-482db46b665mr66755355e9.14.1769866176467; Sat, 31 Jan 2026 05:29:36 -0800 (PST) Date: Sat, 31 Jan 2026 13:28:34 +0000 In-Reply-To: <20260131132848.254084-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: <20260131132848.254084-1-vdonnefort@google.com> X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260131132848.254084-17-vdonnefort@google.com> Subject: [PATCH v11 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 Reviewed-by: Steven Rostedt (Google) --- 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..1f9d764f69aa --- /dev/null +++ b/Documentation/trace/remotes.rst @@ -0,0 +1,66 @@ +.. 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 +Firmware and hypervisors are black boxes to the kernel. Having a way to se= e what +they are doing can be useful to debug both. This is where remote tracing b= uffers +come in. A remote tracing buffer is a ring buffer executed by the firmware= or +hypervisor into memory that is memory mapped to the host kernel. This is s= imilar +to how user space memory maps the kernel ring buffer but in this case the = kernel +is acting like user space and the firmware or hypervisor is the "kernel" s= ide. +With a trace remote ring buffer, the firmware and hypervisor can record ev= ents +for which the host kernel can see and expose to user space. + +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 + +Once registered, an instance will appear for this remote in the Tracefs +directory **remotes/**. Buffers can then be read using the usual Tracefs f= iles +**trace_pipe** and **trace**. + +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`. + +Registered events appear in the remote directory under **events/**. + +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.53.0.rc1.225.gd81095ad13-goog