lkml.org 
[lkml]   [2020]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/6] tracing: add flag to control different traces
On Sun, 26 Jul 2020 10:59:27 +0800
Tingwei Zhang <tingwei@codeaurora.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);
> + }
> }

\
 
 \ /
  Last update: 2020-07-27 20:47    [W:0.077 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site