public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: acme@ghostprotocols.net, linux-kernel@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH 4/4] perf trace: Add option to specify machine type
Date: Wed,  4 Dec 2013 19:41:42 -0700	[thread overview]
Message-ID: <1386211302-31303-5-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1386211302-31303-1-git-send-email-dsahern@gmail.com>

Perhaps there is a better way to do this; I could not think of one and
I don't see any field in the tracepoint that can be leveraged. So ...

perf-trace autodetects the machine type (e.g., i386, x86_64, etc) via
libaudit. When running 32-bit apps on a 64-bit kernel the wrong machine
type is used to convert syscall numbers to names leading to wrong information
getting displayed to the user. This option allows the user to override
the machine type to use.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-trace.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 0203324fe585..4a78a39b684a 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2274,6 +2274,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	};
 	const char *output_name = NULL;
 	const char *ev_qualifier_str = NULL;
+	const char *machine_str = NULL;
 	const struct option trace_options[] = {
 	OPT_BOOLEAN(0, "comm", &trace.show_comm,
 		    "show the thread COMM next to its id"),
@@ -2308,6 +2309,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "Show only syscall summary with statistics"),
 	OPT_BOOLEAN('S', "with-summary", &trace.summary,
 		    "Show all syscalls and summary with statistics"),
+	OPT_STRING('M', NULL, &machine_str, "x86|x86_64",
+		     "Advanced: machine type for converting system calls: x86, x86_64"),
 	OPT_END()
 	};
 	int err;
@@ -2318,6 +2321,17 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	argc = parse_options(argc, argv, trace_options, trace_usage, 0);
 
+	if (machine_str) {
+		if (strcmp(machine_str, "x86") == 0)
+			trace.audit.machine = MACH_X86;
+		else if (strcmp(machine_str, "x86_64") == 0)
+			trace.audit.machine = MACH_86_64;
+		else {
+			pr_err("Invalid machine type\n");
+			return -EINVAL;
+		}
+	}
+
 	/* summary_only implies summary option, but don't overwrite summary if set */
 	if (trace.summary_only)
 		trace.summary = trace.summary_only;
-- 
1.8.3.4 (Apple Git-47)


  parent reply	other threads:[~2013-12-05  2:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  2:41 [PATCH 0/4] perf trace fixes David Ahern
2013-12-05  2:41 ` [PATCH 1/4] perf trace: Add support for syscalls vs raw_syscalls David Ahern
2013-12-11 11:03   ` [tip:perf/core] " tip-bot for David Ahern
2013-12-05  2:41 ` [PATCH 2/4] perf trace: Fix crash on RHEL6 David Ahern
2013-12-05 13:09   ` Arnaldo Carvalho de Melo
2013-12-05 14:27     ` David Ahern
2013-12-05 14:47       ` Arnaldo Carvalho de Melo
2013-12-05  2:41 ` [PATCH 3/4] perf trace: Fix summary percentage when processing files David Ahern
2013-12-11 11:03   ` [tip:perf/core] " tip-bot for David Ahern
2013-12-05  2:41 ` David Ahern [this message]
2013-12-05 13:50   ` [PATCH 4/4] perf trace: Add option to specify machine type Arnaldo Carvalho de Melo
2013-12-05 14:33     ` David Ahern
2013-12-05 14:49       ` Arnaldo Carvalho de Melo
2013-12-05  4:04 ` [PATCH 0/4] perf trace fixes David Ahern

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=1386211302-31303-5-git-send-email-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /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