From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Beau Belgrave <beaub@linux.microsoft.com>
Subject: [for-next][PATCH 04/13] tracing/user_events: Document multi-format flag
Date: Fri, 23 Feb 2024 09:18:42 -0500 [thread overview]
Message-ID: <20240223141902.070244243@goodmis.org> (raw)
In-Reply-To: 20240223141838.985298316@goodmis.org
From: Beau Belgrave <beaub@linux.microsoft.com>
User programs can now ask user_events to handle the synchronization of
multiple different formats for an event with the same name via the new
USER_EVENT_REG_MULTI_FORMAT flag.
Add a section for USER_EVENT_REG_MULTI_FORMAT that explains the intended
purpose and caveats of using it. Explain how deletion works in these
cases and how to use /sys/kernel/tracing/dynamic_events for per-version
deletion.
Link: https://lore.kernel.org/linux-trace-kernel/20240222001807.1463-5-beaub@linux.microsoft.com
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Documentation/trace/user_events.rst | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/Documentation/trace/user_events.rst b/Documentation/trace/user_events.rst
index d8f12442aaa6..1d5a7626e6a6 100644
--- a/Documentation/trace/user_events.rst
+++ b/Documentation/trace/user_events.rst
@@ -92,6 +92,24 @@ The following flags are currently supported.
process closes or unregisters the event. Requires CAP_PERFMON otherwise
-EPERM is returned.
++ USER_EVENT_REG_MULTI_FORMAT: The event can contain multiple formats. This
+ allows programs to prevent themselves from being blocked when their event
+ format changes and they wish to use the same name. When this flag is used the
+ tracepoint name will be in the new format of "name.unique_id" vs the older
+ format of "name". A tracepoint will be created for each unique pair of name
+ and format. This means if several processes use the same name and format,
+ they will use the same tracepoint. If yet another process uses the same name,
+ but a different format than the other processes, it will use a different
+ tracepoint with a new unique id. Recording programs need to scan tracefs for
+ the various different formats of the event name they are interested in
+ recording. The system name of the tracepoint will also use "user_events_multi"
+ instead of "user_events". This prevents single-format event names conflicting
+ with any multi-format event names within tracefs. The unique_id is output as
+ a hex string. Recording programs should ensure the tracepoint name starts with
+ the event name they registered and has a suffix that starts with . and only
+ has hex characters. For example to find all versions of the event "test" you
+ can use the regex "^test\.[0-9a-fA-F]+$".
+
Upon successful registration the following is set.
+ write_index: The index to use for this file descriptor that represents this
@@ -106,6 +124,9 @@ or perf record -e user_events:[name] when attaching/recording.
**NOTE:** The event subsystem name by default is "user_events". Callers should
not assume it will always be "user_events". Operators reserve the right in the
future to change the subsystem name per-process to accommodate event isolation.
+In addition if the USER_EVENT_REG_MULTI_FORMAT flag is used the tracepoint name
+will have a unique id appended to it and the system name will be
+"user_events_multi" as described above.
Command Format
^^^^^^^^^^^^^^
@@ -156,7 +177,11 @@ to request deletes than the one used for registration due to this.
to the event. If programs do not want auto-delete, they must use the
USER_EVENT_REG_PERSIST flag when registering the event. Once that flag is used
the event exists until DIAG_IOCSDEL is invoked. Both register and delete of an
-event that persists requires CAP_PERFMON, otherwise -EPERM is returned.
+event that persists requires CAP_PERFMON, otherwise -EPERM is returned. When
+there are multiple formats of the same event name, all events with the same
+name will be attempted to be deleted. If only a specific version is wanted to
+be deleted then the /sys/kernel/tracing/dynamic_events file should be used for
+that specific format of the event.
Unregistering
-------------
--
2.43.0
next prev parent reply other threads:[~2024-02-23 14:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 14:18 [for-next][PATCH 00/13] tracing: Updates for 6.9 Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 01/13] tracing/user_events: Prepare find/delete for same name events Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 02/13] tracing/user_events: Introduce multi-format events Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 03/13] selftests/user_events: Test " Steven Rostedt
2024-02-23 14:18 ` Steven Rostedt [this message]
2024-02-23 14:18 ` [for-next][PATCH 05/13] tracing: Use init_utsname()->release Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 06/13] NFSD: Fix nfsd_clid_class use of __string_len() macro Steven Rostedt
2024-02-23 14:36 ` Jeff Layton
2024-02-23 15:14 ` Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 07/13] drm/i915: Add missing ; to __assign_str() macros in tracepoint code Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 08/13] tracing: Rework __assign_str() and __string() to not duplicate getting the string Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 09/13] tracing: Do not calculate strlen() twice for __string() fields Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 10/13] tracing: Use ? : shortcut in trace macros Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 11/13] tracing: Use EVENT_NULL_STR macro instead of open coding "(null)" Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 12/13] tracing: Fix snapshot counter going between two tracers that use it Steven Rostedt
2024-02-23 14:18 ` [for-next][PATCH 13/13] tracing: Decrement the snapshot if the snapshot trigger fails to register Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240223141902.070244243@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=beaub@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox