From nobody Wed Dec 17 08:05:15 2025 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.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 56896313287 for ; Tue, 2 Dec 2025 09:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764668212; cv=none; b=LG6L3XIsq7gjVszPe5xYoyJasZLirrzwCcCH80CU76iPVcM0QVpQqgSUC8W5wqVUxkCnNqQFNCdIz41SpuUU21Gr7ARyTzLYrbc/lkDhSJMizxLeli8n8H41QWj3V+aRz4vCYpvt7W7EdRAhQv9j5tX1nPTtP0MvNheywtHENl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764668212; c=relaxed/simple; bh=6F+v6J+CWN//r6wGF64D0I/BsKCCCENIMewP2BSYDLg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ix4+EqCXsPBWtd6gs3k/PfUKdiqZQNTI7QdMN0nfxR+7Ha+FD/pGHnf8Jny9IZnkf5hPWY75ja8ziZQPGdLOiWKGtZocbXoqPFWJGjX00MInVipF1QVngD5kD4c1I66smjKos9m4cVLaPuNXqnyoXG8Ad5I77C+2jvEJ/2/xtQE= 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=FdWqjEbb; arc=none smtp.client-ip=209.85.218.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="FdWqjEbb" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-b72a95dc6d9so176239066b.0 for ; Tue, 02 Dec 2025 01:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764668207; x=1765273007; 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=1k9lnCa35g0aTUreNVQa2rVX+IRvV+YbWj70G3JIso4=; b=FdWqjEbbttq9XDRoWaZEkGWCgUdk2+7AQ8G1jVz9OxDrlHaYxU1S6XiUUu9J1ioDl+ AGusPGhpE+9xm292+qvcuTYUKwyw7kvY7TS4PbZL9ZhdoNMgUr8AsqP1RRvOg0xhHf5y /l0goyhdNwSC2JSeJvHRBiwRAvp+ZNab3CB+ygz5L8VlHvDBK8wGpD6HVoZDlhUEYoAy BWUDK/H3Pzr3YBI19jgMQ49qhdaS4DcToXfpS+2S8V9jgkEoO3FJV1rKbGsdifEFH+W2 iMD+GUL6qekFWKIbEHO5J0MOP+IuhmcQuOB77162SFP5dfMnPq97kwlTF000TswSA1JD Kwfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764668207; x=1765273007; 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=1k9lnCa35g0aTUreNVQa2rVX+IRvV+YbWj70G3JIso4=; b=Ly4BO7JY0gt/1S4TjIkXQB4uDWNSNPJMVDoPk/sPGFPtIaN6KImI4iZ6qAqgHvZXB+ 57DlRv8BHnFR2rmUbiwhW8DqoUzu1rEJPkGZgjAWDrBASoa9wNreKfQR6Q4Que7x9Htu ORU+QeaCkmUx0yi1/Yga2mqMbiXTbZgW2WT7xpuKEMHh7yV+NZcpt3K/paTmOv9t1nko oLboMgCndwO8J3vHDOMx+K7ou7l+k/AyBwi/S/SlxQQvKYuzbPoi9m4ROwOGbO7FRK2t RxUwkDpGxfs6OimsppBb42r/E88EjqSiGdJ4lpxiHVBuukz5XdSjqBeZUWSGKQk9YTVq rlZQ== X-Forwarded-Encrypted: i=1; AJvYcCX5qTwtu7bNhtjvGh3ok+RXAgu9rjOA/AqTcHZbstvaL71nC38WC1deNS6JM3Qg3pFIJ17Qa057ym8oKWc=@vger.kernel.org X-Gm-Message-State: AOJu0YwBs2111L1x9nm3RDFPK3+559KMmjj9H/TOe/TgYOGDVYEaqh9g hrWsOXTxTO9mOCn3KjBVX+U+JUNRDT+gV2k+mvcYmUbIG7W2bNmehsOdGF6F0/uRK3k+oh8wmSb I50B71WA5UwX4uyDvsPjTng== X-Google-Smtp-Source: AGHT+IH6ccFpR0WrW+/F3kealA6pNGmuZbYCFARi/n7zyIqU+hpmNdIgKjNmor9NcQZqnGFg0KMHEyXXFtwtLCUK X-Received: from ejcse13.prod.google.com ([2002:a17:907:a38d:b0:b73:580c:b277]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a17:906:eec2:b0:b76:69d6:f9fe with SMTP id a640c23a62f3a-b76c566bfaemr3010632366b.60.1764668207371; Tue, 02 Dec 2025 01:36:47 -0800 (PST) Date: Tue, 2 Dec 2025 09:36:09 +0000 In-Reply-To: <20251202093623.2337860-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: <20251202093623.2337860-1-vdonnefort@google.com> X-Mailer: git-send-email 2.52.0.107.ga0afd4fd5b-goog Message-ID: <20251202093623.2337860-17-vdonnefort@google.com> Subject: [PATCH v9 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.107.ga0afd4fd5b-goog