linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: y.karadz@gmail.com, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v5 01/12] libtracefs: New APIs for dynamic events
Date: Fri, 5 Nov 2021 11:03:10 -0400	[thread overview]
Message-ID: <20211105110310.429d58e8@gandalf.local.home> (raw)
In-Reply-To: <20211105121624.398717-2-tz.stoyanov@gmail.com>

On Fri,  5 Nov 2021 14:16:13 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> +static void init_devent_desc(void)
> +{
> +	int i;
> +
> +	BUILD_BUG_ON(ARRAY_SIZE(dynevents) != max_dyn_index);
> +
> +	/* Use  ftrace dynamic_events, if available */
> +	if (tracefs_file_exists(NULL, DYNEVENTS_EVENTS)) {
> +		for (i = 0; i < max_dyn_index; i++)
> +			dynevents[i].file = DYNEVENTS_EVENTS;
> +		return;
> +	}
> +
> +	if (tracefs_file_exists(NULL, KPROBE_EVENTS)) {
> +		dynevents[ffs(TRACEFS_DYNEVENT_KPROBE) - 1].file = KPROBE_EVENTS;
> +		dynevents[ffs(TRACEFS_DYNEVENT_KRETPROBE) - 1].file = KPROBE_EVENTS;
> +	}
> +	if (tracefs_file_exists(NULL, UPROBE_EVENTS)) {
> +		dynevents[ffs(TRACEFS_DYNEVENT_UPROBE) - 1].file = UPROBE_EVENTS;
> +		dynevents[ffs(TRACEFS_DYNEVENT_URETPROBE) - 1].file = UPROBE_EVENTS;
> +	}
> +	if (tracefs_file_exists(NULL, SYNTH_EVENTS)) {
> +		dynevents[ffs(TRACEFS_DYNEVENT_SYNTH) - 1].file = SYNTH_EVENTS;
> +		dynevents[ffs(TRACEFS_DYNEVENT_SYNTH) - 1].prefix = "";
> +	}
> +}
> +

I would have kept your bit_index() function to simplify the above. I just
meant to use ffs in that function.

static inline bit_index(unsigned int bits)
{
	return ffs(bits) - 1;
}

-- Steve


  reply	other threads:[~2021-11-05 15:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 12:16 [PATCH v5 00/12] libtracefs dynamic events support Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 01/12] libtracefs: New APIs for dynamic events Tzvetomir Stoyanov (VMware)
2021-11-05 15:03   ` Steven Rostedt [this message]
2021-11-05 15:21     ` Tzvetomir Stoyanov
2021-11-05 15:27       ` Steven Rostedt
2021-11-05 15:08   ` Steven Rostedt
2021-11-05 15:12     ` Steven Rostedt
2021-11-05 12:16 ` [PATCH v5 02/12] libtracefs: New APIs for kprobe allocation Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 03/12] libtracefs: Remove redundant kprobes APIs Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 04/12] libtracefs: Reimplement kprobe raw APIs Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 05/12] libtracefs: Extend kprobes unit test Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 06/12] libtracefs: Rename tracefs_synth_init API Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 07/12] libtracefs: Use the internal dynamic events API when creating synthetic events Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 08/12] libtracefs: Add unit test for " Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 09/12] libtracefs: Update kprobes man pages Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 10/12] libtracefs: Document dynamic events APIs Tzvetomir Stoyanov (VMware)
2021-11-05 12:16 ` [PATCH v5 11/12] libtracefs: Remove man page compile artifact Tzvetomir Stoyanov (VMware)
2021-11-05 14:24   ` Steven Rostedt
2021-11-05 14:34     ` Tzvetomir Stoyanov
2021-11-05 14:40       ` Tzvetomir Stoyanov
2021-11-05 14:45         ` Steven Rostedt
2021-11-05 14:44       ` Steven Rostedt
2021-11-05 12:16 ` [PATCH v5 12/12] libtracefs: Fix duplication in synthetic events man page Tzvetomir Stoyanov (VMware)

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=20211105110310.429d58e8@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    --cc=y.karadz@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).