Re: [PATCH 4/4] perf trace: Add option to specify machine type
Em Thu, Dec 05, 2013 at 07:33:20AM -0700, David Ahern escreveu: > On 12/5/13, 6:50 AM, Arnaldo Carvalho de Melo wrote: > >Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: > >>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. > > > >And that means that using perf.data files from another machine, say, > >ARM, will produce completely bogus results :-\ > > Indeed all offline analysis of trace data is wrong because it uses > the arch of the machine running perf. I am not hitting that problem, > but analysis on box. > > > > >We need a way to store this info in the perf.data header, i.e. use the > >same algorithm that libaudit uses in audit_detect_machine() (and set the > >open_id as well, btw) at 'perf record' time and store it somewhere. > > > >What we have now that could be used? > > > >Lets see: > > > >[acme@zoo linux]$ perf report | grep 'arch' > ># arch : x86_64 > >[acme@zoo linux]$ > > > >Would that be enough? Stephane? > > That fixes one part -- using the arch in the file to translate > system calls in the file. > > But it is a per process problem: Some are 32-bit; others are 64-bit. > I was hoping there was some option at the syscall entry level to tag > the bitness. And then there is the problem of needing a solution We need to look at how compat syscalls work and how that translates to our raw_syscalls tracing needs :-\ > that works from RHEL6 forward. This patch at least allows me to have > sensible data until something more clever is thought of. > > David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] perf trace: Add option to specify machine type
On 12/5/13, 6:50 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: 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. And that means that using perf.data files from another machine, say, ARM, will produce completely bogus results :-\ Indeed all offline analysis of trace data is wrong because it uses the arch of the machine running perf. I am not hitting that problem, but analysis on box. We need a way to store this info in the perf.data header, i.e. use the same algorithm that libaudit uses in audit_detect_machine() (and set the open_id as well, btw) at 'perf record' time and store it somewhere. What we have now that could be used? Lets see: [acme@zoo linux]$ perf report | grep 'arch' # arch : x86_64 [acme@zoo linux]$ Would that be enough? Stephane? That fixes one part -- using the arch in the file to translate system calls in the file. But it is a per process problem: Some are 32-bit; others are 64-bit. I was hoping there was some option at the syscall entry level to tag the bitness. And then there is the problem of needing a solution that works from RHEL6 forward. This patch at least allows me to have sensible data until something more clever is thought of. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] perf trace: Add option to specify machine type
Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: > 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. And that means that using perf.data files from another machine, say, ARM, will produce completely bogus results :-\ We need a way to store this info in the perf.data header, i.e. use the same algorithm that libaudit uses in audit_detect_machine() (and set the open_id as well, btw) at 'perf record' time and store it somewhere. What we have now that could be used? Lets see: [acme@zoo linux]$ perf report | grep 'arch' # arch : x86_64 [acme@zoo linux]$ Would that be enough? Stephane? - Arnaldo > 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 > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Frederic Weisbecker > Cc: Jiri Olsa > Cc: Namhyung Kim > --- > 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", _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", , > "Show all syscalls and summary with statistics"), > + OPT_STRING('M', NULL, _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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] perf trace: Add option to specify machine type
Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: 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. And that means that using perf.data files from another machine, say, ARM, will produce completely bogus results :-\ We need a way to store this info in the perf.data header, i.e. use the same algorithm that libaudit uses in audit_detect_machine() (and set the open_id as well, btw) at 'perf record' time and store it somewhere. What we have now that could be used? Lets see: [acme@zoo linux]$ perf report | grep 'arch' # arch : x86_64 [acme@zoo linux]$ Would that be enough? Stephane? - Arnaldo 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 dsah...@gmail.com Cc: Ingo Molnar mi...@kernel.org Cc: Peter Zijlstra a.p.zijls...@chello.nl Cc: Frederic Weisbecker fweis...@gmail.com Cc: Jiri Olsa jo...@redhat.com Cc: Namhyung Kim namhy...@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) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] perf trace: Add option to specify machine type
On 12/5/13, 6:50 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: 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. And that means that using perf.data files from another machine, say, ARM, will produce completely bogus results :-\ Indeed all offline analysis of trace data is wrong because it uses the arch of the machine running perf. I am not hitting that problem, but analysis on box. We need a way to store this info in the perf.data header, i.e. use the same algorithm that libaudit uses in audit_detect_machine() (and set the open_id as well, btw) at 'perf record' time and store it somewhere. What we have now that could be used? Lets see: [acme@zoo linux]$ perf report | grep 'arch' # arch : x86_64 [acme@zoo linux]$ Would that be enough? Stephane? That fixes one part -- using the arch in the file to translate system calls in the file. But it is a per process problem: Some are 32-bit; others are 64-bit. I was hoping there was some option at the syscall entry level to tag the bitness. And then there is the problem of needing a solution that works from RHEL6 forward. This patch at least allows me to have sensible data until something more clever is thought of. David -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] perf trace: Add option to specify machine type
Em Thu, Dec 05, 2013 at 07:33:20AM -0700, David Ahern escreveu: On 12/5/13, 6:50 AM, Arnaldo Carvalho de Melo wrote: Em Wed, Dec 04, 2013 at 07:41:42PM -0700, David Ahern escreveu: 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. And that means that using perf.data files from another machine, say, ARM, will produce completely bogus results :-\ Indeed all offline analysis of trace data is wrong because it uses the arch of the machine running perf. I am not hitting that problem, but analysis on box. We need a way to store this info in the perf.data header, i.e. use the same algorithm that libaudit uses in audit_detect_machine() (and set the open_id as well, btw) at 'perf record' time and store it somewhere. What we have now that could be used? Lets see: [acme@zoo linux]$ perf report | grep 'arch' # arch : x86_64 [acme@zoo linux]$ Would that be enough? Stephane? That fixes one part -- using the arch in the file to translate system calls in the file. But it is a per process problem: Some are 32-bit; others are 64-bit. I was hoping there was some option at the syscall entry level to tag the bitness. And then there is the problem of needing a solution We need to look at how compat syscalls work and how that translates to our raw_syscalls tracing needs :-\ that works from RHEL6 forward. This patch at least allows me to have sensible data until something more clever is thought of. David -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] perf trace: Add option to specify machine type
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 Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim --- 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", _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", , "Show all syscalls and summary with statistics"), + OPT_STRING('M', NULL, _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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] perf trace: Add option to specify machine type
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 dsah...@gmail.com Cc: Ingo Molnar mi...@kernel.org Cc: Peter Zijlstra a.p.zijls...@chello.nl Cc: Frederic Weisbecker fweis...@gmail.com Cc: Jiri Olsa jo...@redhat.com Cc: Namhyung Kim namhy...@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) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/