[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200728002922.GB10290@codeaurora.org>
Date: Tue, 28 Jul 2020 08:29:22 +0800
From: Tingwei Zhang <tingweiz@...eaurora.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Tingwei Zhang <tingwei@...eaurora.org>,
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
Hi Steve,
On Tue, Jul 28, 2020 at 02:45:50AM +0800, Steven Rostedt wrote:
> 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.
>
That's my mistake. Thanks for point that out. I'll fix it in next
revision.
> -- 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