From patchwork Fri Feb 23 14:18:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 205410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp612992dyb; Fri, 23 Feb 2024 06:17:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXAw1O6OnbYcELgdrzC4QvaFyOWVd3datKdUkDG3i7py44OcnWKVjqBxTfTC9kzGFtxJtUHFkWl2vUjOuoy1BKS7OpITw== X-Google-Smtp-Source: AGHT+IE8e+N7iWHJwJ3x4yGfkBgEYd+7PTjmdsoVjymSUe6UD3qqObKMg0twpnXBfd1K6mB1q4R+ X-Received: by 2002:a0c:df89:0:b0:68f:5c66:a92f with SMTP id w9-20020a0cdf89000000b0068f5c66a92fmr2157417qvl.45.1708697877188; Fri, 23 Feb 2024 06:17:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708697877; cv=pass; d=google.com; s=arc-20160816; b=OSVbdNopmBN/JQ5vHII0b8XJBYRgeqqrV8D/oVPcKaGaDqvZdn5y68uY+gBLYrVduX 2kxSgG80rInLGB/f7fqB+Z6MUcPKtq0OR56scpm8J4OO1WRUVxp/6HVPGqtRJJ2Gqykx ITQuLSwLDqJqG4OZPdlZmP7FZrAahsL2+SJUunqosp/pqKu82KiF3UO4uO8gmqxjiZa1 6V6TnumanXQU1UovQVv4PgE7xH/gBIDbI80qS10p1G5z6mDMcg93cwXScicPOJCbdQ/m dQ8kKItrN7swH3oWmQTvWas+WO+OrD6ytBKsBJdqC+fm3e92Efm6RfU2vf4Sp9438xp4 sm4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=ABIuR4IagH7h0fv6dHHRkvqfSuHoPCi1fKvGZBitVZM=; fh=sbDUv6PuKPAkpuv6zbp1fPCjJZUEufc8KwKtgDDsdwc=; b=Jj029nuLgKWxbIPOSWwmlfV1y9iQu4/M9PEhVklyS13XtVRA9PFdPzwbBFJDlWm2YS sUWiz1MMMKrPKfqzOLRSIA9epUvwZwHzmCD9JtuvUQmFlHn0IGPPY+svnc6L8aIlExpC tfY6njNnIRVbn0WH9dqQyboxpAg59QRWbS82Dz8lZnA53kMB+X8kvQLhDfHOTzF7nChe 2mxDHqmKN20KNttY98iR7dUvd4qjOlUkqspHTNb8VRR4GVpkxXppBwWCBfK319MHNjM0 l84j93Qyajw/JulKc1b5xWfH4Pj09Bats8GS6QYXkEKdvrw2cA7uIwjRttLmWHeWlHap +FFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-78457-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78457-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q4-20020ad45ca4000000b0068f72fd2a17si11215457qvh.352.2024.02.23.06.17.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:17:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78457-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-78457-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78457-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F3CD11C2194A for ; Fri, 23 Feb 2024 14:17:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C2388288F; Fri, 23 Feb 2024 14:17:11 +0000 (UTC) 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791699585336697966 X-GMAIL-MSGID: 1791699585336697966 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-beaub@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. ++ 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 -------------