[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200727144550.7aa40c61@oasis.local.home>
Date: Mon, 27 Jul 2020 14:45:50 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Tingwei Zhang <tingwei@...eaurora.org>
Cc: Ingo Molnar <mingo@...hat.com>, tsoni@...eaurora.org,
Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Mao Jinlong <jinlmao@...eaurora.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/6] tracing: add flag to control different traces
On Sun, 26 Jul 2020 10:59:27 +0800
Tingwei Zhang <tingwei@...eaurora.org> wrote:
> diff --git a/include/linux/trace.h b/include/linux/trace.h
> index 7fd86d3c691f..d2fdf9be84b5 100644
> --- a/include/linux/trace.h
> +++ b/include/linux/trace.h
> @@ -3,6 +3,9 @@
> #define _LINUX_TRACE_H
>
> #ifdef CONFIG_TRACING
> +
> +#define TRACE_EXPORT_FUNCTION BIT_ULL(0)
All the flags variables below are defined as "int". Why the BIT_ULL()?
BIT(0) should work just fine. The ULL makes one think these flags will
be used for unsigned long variables, which it is not.
-- Steve
> +
> struct trace_export {
> struct trace_export __rcu *next;
> void (*write)(struct trace_export *, const void *, unsigned int);
> + int flags;
> };
>
> int register_ftrace_export(struct trace_export *export);
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index bb62269724d5..8f1e66831e9e 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2747,33 +2747,37 @@ trace_buffer_unlock_commit_nostack(struct trace_buffer *buffer,
>
> static void
> trace_process_export(struct trace_export *export,
> - struct ring_buffer_event *event)
> + struct ring_buffer_event *event, int flag)
> {
> struct trace_entry *entry;
> unsigned int size = 0;
>
> - entry = ring_buffer_event_data(event);
> - size = ring_buffer_event_length(event);
> - export->write(export, entry, size);
> + if (export->flags & flag) {
> + entry = ring_buffer_event_data(event);
> + size = ring_buffer_event_length(event);
> + export->write(export, entry, size);
> + }
> }
Powered by blists - more mailing lists