From nobody Mon Feb 9 07:19:09 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BE2180BE3 for ; Fri, 23 Feb 2024 14:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697829; cv=none; b=OCrSnxER5Aai7PvPmlnHKPeOGoDPkRUs/2dTszJ+WSnz42hjj6FmPn7IY3bs0PI/t4lnwTb8a6NU0WEN4f3t54rbOdngnVWzWZv0F6qNKbwCXVQkf/98Js4x2Ycne3Ihjrc/j15pcbSMOpfRwCHlJFY3QMoATXDtpoAY8q6T8xI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697829; c=relaxed/simple; bh=nKcWAWVRnB8xYWN/oRCb/6ODPrdVBFq4pB5n9Mp0FBY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=cZDCSNvcI0DrMUbxldcgcyKfzhULlPsmnTHOxmc0+ccTWnkoiHjw7D0env7jmKAeJjl7lMmr1Op6Z4W6OFoVFqsWFk7g33xJJPXc6VNba1crGedmYA/2FXXBPUEkCFg1PYlxQO20BXPfQQCZ5BzT16vTzT8+MCwRxgGFzf4hys0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B0AEC43390; Fri, 23 Feb 2024 14:17:09 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rdWOE-000000077Mi-0sLR; Fri, 23 Feb 2024 09:19:02 -0500 Message-ID: <20240223141902.070244243@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 23 Feb 2024 09:18:42 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Beau Belgrave Subject: [for-next][PATCH 04/13] tracing/user_events: Document multi-format flag References: <20240223141838.985298316@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Beau Belgrave 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-beau= b@linux.microsoft.com Signed-off-by: Beau Belgrave Signed-off-by: Steven Rostedt (Google) --- 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. =20 ++ 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 use= d the + tracepoint name will be in the new format of "name.unique_id" vs the old= er + format of "name". A tracepoint will be created for each unique pair of n= ame + 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 confli= cting + with any multi-format event names within tracefs. The unique_id is outpu= t as + a hex string. Recording programs should ensure the tracepoint name start= s with + the event name they registered and has a suffix that starts with . and o= nly + 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. =20 + write_index: The index to use for this file descriptor that represents t= his @@ -106,6 +124,9 @@ or perf record -e user_events:[name] when attaching/rec= ording. **NOTE:** The event subsystem name by default is "user_events". Callers sh= ould 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 isola= tion. +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. =20 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 o= f an -event that persists requires CAP_PERFMON, otherwise -EPERM is returned. +event that persists requires CAP_PERFMON, otherwise -EPERM is returned. Wh= en +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. =20 Unregistering ------------- --=20 2.43.0