From patchwork Thu Feb 22 00:18:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 204505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1376215dyc; Wed, 21 Feb 2024 16:19:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKzKhkDPmkZc/CGG6L1fKfDWMGYEeUxDQ2/EqxsQ5jIKwYJnkaLIBv5UxCZByZ0R7vjOp8KqY9UpwXQz0yn+6+i8QZag== X-Google-Smtp-Source: AGHT+IHM1yWBYblw1MhcPoxtsyz2aBHpkx1rtR7J3/mocu9gY3ctfJ8vdwTNX4FqoSuoLzfuvWq4 X-Received: by 2002:a05:6a21:3397:b0:1a0:c843:caf4 with SMTP id yy23-20020a056a21339700b001a0c843caf4mr3105182pzb.30.1708561163473; Wed, 21 Feb 2024 16:19:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708561163; cv=pass; d=google.com; s=arc-20160816; b=llokV8iP4fU/b806lm1mmqed8PaaOD8EiwA8Tkc6TQVd4hZt1MJ93FdCiDE62vp+XL J1qfd7Kjow6oVsCsPLHMpr6WnVCC4r4TRG4xlLjhDrNoO4KSFrlkMpG/rn9W8PE44MKz TjcglU+fK707iVGPZqpMxXgXtbGYmUQ+mBjkbzHtWjWTu7avmySlRvEQ+ey5weQEud+U s7c3liRDFLoc5EROI5pOAx5oqG/wQOnGhcYjhuZL6PbOXBhUsJ9rkhUh9lmOawyawsWz ttv9UiWNaD5x5b889okLwbejlfxzeHfGQpXJzfutMrqK9pLqpgf0tMgaW9s39QTZl6S4 5XKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=9VOCGDdI8wf7ppg3CttBYebJqIACHcsfFVDg2ERPXoo=; fh=IUXlFtcfnvZk04FS3qaK0sXInhvXZlQ3mi5m9ci/vMg=; b=jxA4jE2kA9MinBoPPQJholq4PxBJV7BJ42lnC4KoH42nyWeb/X3ILWx1a/P3mTf/JR vUPXi0P1Hl9/5pmllrOTHLHa08cW/dKPet9D5hFENOTLKwinIv2uwtCkrE1n4CLQmbrM TfAp5x8D7N00y1Ycv8j3ASK/dSvv29kLYDmrtlHNKh0nZ4Rqa/uKdsqPlup1VFVRYqU0 941CmW5jZHg0sTRCoyNFv8LyQRtXfrP60ewC12qX2/7DQEuZVmX7cc5pTTFErjSpdcrT xdzWNJ6cYXP435+0qmZWksl71zoaVxinVXY7zvk/p3DANr/kH0S8WYPMqhpX2HaQqhit z3Yg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UCVpkHpR; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-75714-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75714-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g12-20020a056a0023cc00b006e4ba601b32si1709569pfc.211.2024.02.21.16.19.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 16:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75714-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UCVpkHpR; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-75714-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75714-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BF12284D0C for ; Thu, 22 Feb 2024 00:19:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13A6415EA2; Thu, 22 Feb 2024 00:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="UCVpkHpR" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D2918BF3; Thu, 22 Feb 2024 00:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708561098; cv=none; b=GPFIC9ptmusr29uCi7oZx1lfEaiXOiD9TqXIkNfH8IWGFW4KmhhBBC49YbE0sG9mrdCrjZ9twkKqZ67NzMIwv/sxq/s420agHiXVw4CLtc8ecUx2HXUR3UOTf3f2KE5Wx0yNjP0YXDdW5ObMmlKV8wKYqjUhtT4edN44Mta900w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708561098; c=relaxed/simple; bh=1n+POexB4IxIKN4NogGOvLi6IfL+92Wk9tP/cRbJstg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I57cNivFdTcHCPeB96Rr+6ELdir3M27zdj5f/5XJo3TyjS/WWg8kUfMXTZsTlfokOtHahsXR2Oagt45fVfXecReTJ84LPdQzX2ajr/qhUKcOmZ1P9zsFOIsPDX1R7+cIHvK6/esOfzPK5A22d5woeKlnSFLV/vkqUmDohujPUpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=UCVpkHpR; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from localhost.localdomain (unknown [4.155.48.121]) by linux.microsoft.com (Postfix) with ESMTPSA id 0B54220B2002; Wed, 21 Feb 2024 16:18:13 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0B54220B2002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708561093; bh=9VOCGDdI8wf7ppg3CttBYebJqIACHcsfFVDg2ERPXoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UCVpkHpR1/dpqOsEwf3t2N0XxUXWBevi7SUSvwaWyZrbqtGlbuYzZVYimX6EmzbSm VtxnejH1KcgoHevAe5LUcPRaieons2Boz9M5D8HV1ahaPLmAXHjJpjYv8l1biy3Jxx bvYraccXT8aHAiEkr3mwBzTyp9CTD5c0KeaGp3SY= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com Subject: [PATCH v4 4/4] tracing/user_events: Document multi-format flag Date: Thu, 22 Feb 2024 00:18:07 +0000 Message-Id: <20240222001807.1463-5-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222001807.1463-1-beaub@linux.microsoft.com> References: <20240222001807.1463-1-beaub@linux.microsoft.com> 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: 1791556230424693219 X-GMAIL-MSGID: 1791556230424693219 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. Signed-off-by: Beau Belgrave --- 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 -------------