From nobody Fri Apr 3 12:36:22 2026 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.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 4C7FB346A0D for ; Thu, 19 Feb 2026 15:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771513420; cv=none; b=FdMuIl5t259R6Jl3QAPNfwY3wegPL7MAY60u3HcchHAfPRb1SwaCohNJmBbZ2JqLXUcAj/MYhxBBO2zGGIi6F3u5n5U0MSF9n3lwQv/01XxwsDaWbXL7J6xXTT1zymdtdUKsbNUeZ59t1TcihObzoRFWsJGgjArnLk7wP0LjrZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771513420; c=relaxed/simple; bh=I+pJGIs0Epojic7l7vjIxFwm13eg3s/jxJWStIzBqmU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oJEW9rL8hPunsI1SSo+ZQXkkl1XG/5EbONW5Z+IcCUjICBVy7ZqyY+Vm4pR5CEgACFF+p3o4el3ErjIVBeIi7KBMFUXlaKvvl6SCov8wo5Yv844eIe01IOLa8TPJaf3tBK7mtfa2cCaQGGMpymnp1Fy9hzJLoWZ5T7zYORJn/EQ= 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=N95R+zz2; arc=none smtp.client-ip=209.85.218.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="N95R+zz2" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-b8fbf8701e3so126480566b.0 for ; Thu, 19 Feb 2026 07:03:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771513418; x=1772118218; 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=sPhLrsaL6GHqnFz8k7XCh7wMYB+F4ptERk94umByGuM=; b=N95R+zz2YdPXGKFcOXK6XGyaZrPBiHzCxG4lndIxtpceyuvZWCNqy5Ku5KUi7sg5ZQ SqqAn8XvZ18RprFQN/qj37iAc1xY/Cn/EccKn/NCFlVmI5JuhSj+HRkCV2RY1wcX8rG0 +JdgBU/KBkKRXkTLDLTzEjWYSjfP308SC4QccW6yOJ6KFxEQBMedoVxF+0AN2IO40+0t IvOR2COgiwMvAySYx6970gSs2CYYlocGc2qPCOnOV4j29WjLfbFWPcA5O775LffbRru7 5rWFq13d/+fQvvi5nSFOyUKc2PEB11qruJnka66X81sDMtKfVxEIiCvBPJxRir6jQi3Z 3Vgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771513418; x=1772118218; 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=sPhLrsaL6GHqnFz8k7XCh7wMYB+F4ptERk94umByGuM=; b=cSiBfhijsTaySwNSnpssg04l9ou2yybpWOoMh+z8Kl4rJbRmMR9Hvvui/av0b7Tnw2 UXNj63WSgfsv24V/tdcmGkihkkCE9z/FdiWs8QP31OcFtW6TUhOJsISUXXDAqs8+AyRe BMFku5ATmMBOBD70YcYKiliMh15pajMzXF7aeDvqL0Bab8IE0AnieZ1E3pS64wB2sM5c FwQzKQx2QPyTXd/0G5bh/iNM9ikwYs6Ry8ZfCa6oeo5omHOvwWPqECoBaEF5lEm/zvk+ pP/yeF3S32juzBOD9/uc5/Dt4NAygYUQ0pDHFhRR5MVULkJQ9W8lPyrdvQCg3D6KNmms CBvQ== X-Forwarded-Encrypted: i=1; AJvYcCVkYfHDWI+ynVVX0ZQfLGSUas2ujnnlQRJSJnXSjBf3dQWm0sVBP9eSsOumYiy79Y0nunQTaJ+JsolvG6w=@vger.kernel.org X-Gm-Message-State: AOJu0YxecGOeDsEit4ZEGmDWsfRh3s7HT3sZf84a1rSB+l2xgKIk9Ebv /6nUit+tGud8IA75KVjQlaJ8Kl5w/1IQ1+t6V2+/6X4660dzTPtCacm4ttBwQi6SrZlY9qIC8WQ N4ar4DsW108gjIBpW+RCygg== X-Received: from ejcyl14.prod.google.com ([2002:a17:907:bc8e:b0:b8f:943e:13b9]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:1c82:b0:b88:16dd:d835 with SMTP id a640c23a62f3a-b903da49047mr298923766b.1.1771513417420; Thu, 19 Feb 2026 07:03:37 -0800 (PST) Date: Thu, 19 Feb 2026 15:02:53 +0000 In-Reply-To: <20260219150307.14538-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: <20260219150307.14538-1-vdonnefort@google.com> X-Mailer: git-send-email 2.53.0.335.g19a08e0c02-goog Message-ID: <20260219150307.14538-17-vdonnefort@google.com> Subject: [PATCH v12 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. Reviewed-by: Steven Rostedt (Google) Signed-off-by: Vincent Donnefort diff --git a/Documentation/trace/index.rst b/Documentation/trace/index.rst index 338bc4d7cfab..036db96864d2 100644 --- a/Documentation/trace/index.rst +++ b/Documentation/trace/index.rst @@ -91,6 +91,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.335.g19a08e0c02-goog