public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Beau Belgrave <beaub@linux.microsoft.com>
Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	mathieu.desnoyers@efficios.com
Subject: Re: [PATCH 2/4] tracing/user_events: Introduce multi-format events
Date: Sat, 27 Jan 2024 00:01:04 +0900	[thread overview]
Message-ID: <20240127000104.7c98b34d295747ab1b084bd2@kernel.org> (raw)
In-Reply-To: <20240123220844.928-3-beaub@linux.microsoft.com>

On Tue, 23 Jan 2024 22:08:42 +0000
Beau Belgrave <beaub@linux.microsoft.com> wrote:

> Add a register_name (reg_name) to the user_event struct which allows for
> split naming of events. We now have the name that was used to register
> within user_events as well as the unique name for the tracepoint. Upon
> registering events ensure matches based on first the reg_name, followed
> by the fields and format of the event. This allows for multiple events
> with the same registered name to have different formats. The underlying
> tracepoint will have a unique name in the format of {reg_name}:[unique_id].
> 
> For example, if both "test u32 value" and "test u64 value" are used with
> the USER_EVENT_REG_MULTI_FORMAT the system would have 2 unique
> tracepoints. The dynamic_events file would then show the following:
>   u:test u64 count
>   u:test u32 count
> 
> The actual tracepoint names look like this:
>   test:[d5874fdac44]
>   test:[d5914662cd4]
> 
> Both would be under the new user_events_multi system name to prevent the
> older ABI from being used to squat on multi-formatted events and block
> their use.
[...]
> @@ -1923,6 +1972,39 @@ static int user_event_trace_register(struct user_event *user)
>  	return ret;
>  }
>  
> +static int user_event_set_tp_name(struct user_event *user)
> +{
> +	lockdep_assert_held(&user->group->reg_mutex);
> +
> +	if (EVENT_MULTI_FORMAT(user->reg_flags)) {
> +		char *multi_name;
> +		int len;
> +
> +		len = snprintf(NULL, 0, "%s:[%llx]", user->reg_name,
> +			       user->group->multi_id) + 1;
> +
> +		multi_name = kzalloc(len, GFP_KERNEL_ACCOUNT);
> +
> +		if (!multi_name)
> +			return -ENOMEM;
> +
> +		snprintf(multi_name, len, "%s:[%llx]", user->reg_name,
> +			 user->group->multi_id);

OK, so the each different event has suffixed name. But this will
introduce non C-variable name.

Steve, do you think your library can handle these symbols? It will
be something like "event:[1]" as the event name.
Personally I like "event.1" style. (of course we need to ensure the
user given event name is NOT including such suffix numbers)

Thank you.

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2024-01-26 15:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 22:08 [PATCH 0/4] tracing/user_events: Introduce multi-format events Beau Belgrave
2024-01-23 22:08 ` [PATCH 1/4] tracing/user_events: Prepare find/delete for same name events Beau Belgrave
2024-01-25  0:59   ` Masami Hiramatsu
2024-01-25 17:26     ` Beau Belgrave
2024-01-23 22:08 ` [PATCH 2/4] tracing/user_events: Introduce multi-format events Beau Belgrave
2024-01-26 15:01   ` Masami Hiramatsu [this message]
2024-01-26 19:10     ` Beau Belgrave
2024-01-26 20:04       ` Steven Rostedt
2024-01-29 17:29         ` Beau Belgrave
2024-01-30  2:24           ` Steven Rostedt
2024-01-30 18:05             ` Beau Belgrave
2024-01-30 18:52               ` Steven Rostedt
2024-01-30 22:42                 ` Beau Belgrave
2024-01-30 14:12           ` Masami Hiramatsu
2024-01-30 18:14             ` Beau Belgrave
2024-01-23 22:08 ` [PATCH 3/4] selftests/user_events: Test " Beau Belgrave
2024-01-23 22:08 ` [PATCH 4/4] tracing/user_events: Document multi-format flag Beau Belgrave
2024-01-25 21:37 ` [PATCH 0/4] tracing/user_events: Introduce multi-format events Beau Belgrave
2024-01-30  2:09 ` Masami Hiramatsu
2024-01-30 18:25   ` Beau Belgrave
2024-02-02  5:50     ` Masami Hiramatsu

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=20240127000104.7c98b34d295747ab1b084bd2@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=beaub@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.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