Re: [PATCH v4 10/13] trace: Common code for kprobes/uprobes traceevents

From: Masami Hiramatsu
Date: Tue May 18 2010 - 13:21:19 EST


Srikar Dronamraju wrote:
> Move common parts of trace_kprobe.c and adjust
> kernel/trace/trace_kprobe.c after moving common code to
> kernel/trace/trace_probe.h
>
> Signed-off-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>

Looks good!
I have just a few comments.

> diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
> new file mode 100644
> index 0000000..66a4498
> --- /dev/null
> +++ b/kernel/trace/trace_probe.h
> @@ -0,0 +1,111 @@
> +/*
> + * Uprobes-based tracing events

Isn't it a common header for kprobes and uprobes? :)

Maybe "Probe-based dynamic events common header" ?

> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + *
> + * Copyright (C) IBM Corporation, 2010
> + * Author: Srikar Dronamraju
> + */
> +
> +#include <linux/seq_file.h>
> +#include <linux/slab.h>
> +#include <linux/smp.h>
> +#include <linux/debugfs.h>
> +#include <linux/types.h>
> +#include <linux/string.h>
> +#include <linux/ctype.h>
> +#include <linux/ptrace.h>
> +#include <linux/perf_event.h>
> +
> +#include "trace.h"
> +#include "trace_output.h"
> +
> +#define MAX_TRACE_ARGS 128
> +#define MAX_ARGSTR_LEN 63
> +#define MAX_EVENT_NAME_LEN 64
> +#define UPROBE_EVENT_SYSTEM "uprobes"

You should *just move* the common code in this patch.
Additional uprobes code can be introduced in next patch.

> +#define KPROBE_EVENT_SYSTEM "kprobes"
> +
> +/* Reserved field names */
> +#define FIELD_STRING_IP "__probe_ip"
> +#define FIELD_STRING_NARGS "__probe_nargs"
> +#define FIELD_STRING_RETIP "__probe_ret_ip"
> +#define FIELD_STRING_FUNC "__probe_func"
> +#define FIELD_STRING_PID "__probe_pid"
> +
> +static const char *reserved_field_names[] = {
> + "common_type",
> + "common_flags",
> + "common_preempt_count",
> + "common_pid",
> + "common_tgid",
> + "common_lock_depth",
> + FIELD_STRING_IP,
> + FIELD_STRING_NARGS,
> + FIELD_STRING_RETIP,
> + FIELD_STRING_FUNC,
> + FIELD_STRING_PID,
> +};
> +
> +/* Flags for trace_probe */
> +#define TP_FLAG_TRACE 1
> +#define TP_FLAG_PROFILE 2
> +#define UPROBE_ENABLED 4

If this is a trace_probe flag, it is better to start with TP_FLAG_.

Thank you,

--
Masami Hiramatsu
e-mail: mhiramat@xxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/