From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung@gmail.com>,
Paul Mackerras <paulus@samba.org>,
Stephane Eranian <eranian@google.com>,
Andi Kleen <ak@linux.intel.com>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH v0 07/71] perf tools: Record whether a dso is 64-bit
Date: Wed, 11 Dec 2013 14:36:19 +0200 [thread overview]
Message-ID: <1386765443-26966-8-git-send-email-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <1386765443-26966-1-git-send-email-alexander.shishkin@linux.intel.com>
From: Adrian Hunter <adrian.hunter@intel.com>
Add a flag to 'struct dso' to record if the dso is 64-bit
or not. Update the flag when reading the ELF.
This is needed for instruction decoding. For
example, x86 instruction decoding depends on
whether or not the 64-bit instruction set is
used.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/dso.c | 1 +
tools/perf/util/dso.h | 1 +
tools/perf/util/symbol-elf.c | 3 +++
tools/perf/util/symbol-minimal.c | 23 +++++++++++++++++++++++
tools/perf/util/symbol.c | 1 +
tools/perf/util/symbol.h | 1 +
6 files changed, 30 insertions(+)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index a0c7c59..80817ec 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -446,6 +446,7 @@ struct dso *dso__new(const char *name)
dso->cache = RB_ROOT;
dso->symtab_type = DSO_BINARY_TYPE__NOT_FOUND;
dso->data_type = DSO_BINARY_TYPE__NOT_FOUND;
+ dso->is_64_bit = (sizeof(void *) == 8);
dso->loaded = 0;
dso->rel = 0;
dso->sorted_by_name = 0;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 384f2d9..62680e1 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -91,6 +91,7 @@ struct dso {
u8 annotate_warned:1;
u8 sname_alloc:1;
u8 lname_alloc:1;
+ u8 is_64_bit:1;
u8 sorted_by_name;
u8 loaded;
u8 rel;
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index eed0b96..a0fc81b 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -595,6 +595,8 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
goto out_elf_end;
}
+ ss->is_64_bit = (gelf_getclass(elf) == ELFCLASS64);
+
ss->symtab = elf_section_by_name(elf, &ehdr, &ss->symshdr, ".symtab",
NULL);
if (ss->symshdr.sh_type != SHT_SYMTAB)
@@ -694,6 +696,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
bool remap_kernel = false, adjust_kernel_syms = false;
dso->symtab_type = syms_ss->type;
+ dso->is_64_bit = syms_ss->is_64_bit;
dso->rel = syms_ss->ehdr.e_type == ET_REL;
/*
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index ac7070a..b9d1119 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -1,3 +1,4 @@
+#include "util.h"
#include "symbol.h"
#include <stdio.h>
@@ -287,6 +288,23 @@ int dso__synthesize_plt_symbols(struct dso *dso __maybe_unused,
return 0;
}
+static int fd__is_64_bit(int fd)
+{
+ u8 e_ident[EI_NIDENT];
+
+ if (lseek(fd, 0, SEEK_SET))
+ return -1;
+
+ if (readn(fd, e_ident, sizeof(e_ident)) != sizeof(e_ident))
+ return -1;
+
+ if (memcmp(e_ident, ELFMAG, SELFMAG) ||
+ e_ident[EI_VERSION] != EV_CURRENT)
+ return -1;
+
+ return e_ident[EI_CLASS] == ELFCLASS64;
+}
+
int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
struct symsrc *ss,
struct symsrc *runtime_ss __maybe_unused,
@@ -294,6 +312,11 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
int kmodule __maybe_unused)
{
unsigned char *build_id[BUILD_ID_SIZE];
+ int ret;
+
+ ret = fd__is_64_bit(ss->fd);
+ if (ret >= 0)
+ dso->is_64_bit = ret;
if (filename__read_build_id(ss->name, build_id, BUILD_ID_SIZE) > 0) {
dso__set_build_id(dso, build_id);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index de87dba..511de06 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1103,6 +1103,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
&is_64_bit);
if (err)
goto out_err;
+ dso->is_64_bit = is_64_bit;
if (list_empty(&md.maps)) {
err = -EINVAL;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index f1031a1..7f23a05 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -195,6 +195,7 @@ struct symsrc {
GElf_Shdr dynshdr;
bool adjust_symbols;
+ bool is_64_bit;
#endif
};
--
1.8.5.1
next prev parent reply other threads:[~2013-12-11 12:56 UTC|newest]
Thread overview: 163+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 12:36 [PATCH v0 00/71] perf: Add support for Intel Processor Trace Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 01/71] perf: Disable all pmus on unthrottling and rescheduling Alexander Shishkin
2013-12-11 20:53 ` Andi Kleen
2013-12-13 18:06 ` Peter Zijlstra
2013-12-16 11:00 ` Alexander Shishkin
2013-12-16 11:07 ` Peter Zijlstra
2013-12-11 12:36 ` [PATCH v0 02/71] x86: Add Intel Processor Trace (INTEL_PT) cpu feature detection Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 03/71] perf: Abstract ring_buffer backing store operations Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 04/71] itrace: Infrastructure for instruction flow tracing units Alexander Shishkin
2013-12-17 16:11 ` Peter Zijlstra
2013-12-18 13:23 ` Alexander Shishkin
2013-12-18 13:34 ` Peter Zijlstra
2013-12-18 14:01 ` Alexander Shishkin
2013-12-18 14:11 ` Peter Zijlstra
2013-12-18 14:22 ` Alexander Shishkin
2013-12-18 15:09 ` Peter Zijlstra
2013-12-19 7:53 ` Alexander Shishkin
2013-12-19 10:26 ` Peter Zijlstra
2013-12-19 11:14 ` Alexander Shishkin
2013-12-19 11:25 ` Peter Zijlstra
2013-12-19 11:57 ` Alexander Shishkin
2013-12-19 10:31 ` Peter Zijlstra
2013-12-19 11:17 ` Alexander Shishkin
2013-12-19 11:28 ` Peter Zijlstra
2013-12-19 11:57 ` Peter Zijlstra
2013-12-19 12:52 ` Peter Zijlstra
2013-12-19 12:57 ` Peter Zijlstra
2013-12-19 14:54 ` Alexander Shishkin
2013-12-19 15:14 ` Peter Zijlstra
2013-12-19 11:58 ` Alexander Shishkin
2013-12-19 12:39 ` Ingo Molnar
2013-12-19 14:30 ` Alexander Shishkin
2013-12-19 14:49 ` Frederic Weisbecker
2013-12-19 15:02 ` Peter Zijlstra
2013-12-19 15:10 ` Peter Zijlstra
2014-01-06 21:25 ` Andi Kleen
2014-01-06 22:05 ` Peter Zijlstra
2014-01-07 0:52 ` Andi Kleen
2014-01-07 1:01 ` Andi Kleen
2014-01-07 8:42 ` Peter Zijlstra
2014-01-07 15:48 ` Andi Kleen
2014-01-08 11:53 ` Alexander Shishkin
2014-01-06 22:15 ` Peter Zijlstra
2014-01-06 23:10 ` Andi Kleen
2014-01-07 8:38 ` Peter Zijlstra
2014-01-07 15:42 ` Andi Kleen
2014-01-07 20:51 ` Peter Zijlstra
2014-01-07 23:34 ` Andi Kleen
[not found] ` <20140107212322.GE20765@two.firstfloor.org>
[not found] ` <20140108082840.GH2480@laptop.programming.kicks-ass.net>
2014-01-08 8:31 ` Peter Zijlstra
2014-01-07 8:41 ` Peter Zijlstra
2014-01-07 15:46 ` Andi Kleen
2013-12-11 12:36 ` [PATCH v0 05/71] x86: perf: Intel PT PMU driver Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 06/71] perf: Allow set-output for task contexts of different types Alexander Shishkin
2013-12-11 12:36 ` Alexander Shishkin [this message]
2013-12-11 19:26 ` [PATCH v0 07/71] perf tools: Record whether a dso is 64-bit David Ahern
2013-12-11 19:54 ` Arnaldo Carvalho de Melo
2013-12-12 12:07 ` Adrian Hunter
2013-12-12 12:05 ` Adrian Hunter
2013-12-12 16:45 ` David Ahern
2013-12-12 19:05 ` Arnaldo Carvalho de Melo
2013-12-12 19:16 ` David Ahern
2013-12-12 20:01 ` Arnaldo Carvalho de Melo
2013-12-16 3:16 ` David Ahern
2013-12-16 7:55 ` Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 08/71] perf tools: Let a user specify a PMU event without any config terms Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 09/71] perf tools: Let default config be defined for a PMU Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 10/71] perf tools: Add perf_pmu__scan_file() Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 11/71] perf tools: Add perf_event_paranoid() Alexander Shishkin
2013-12-16 15:26 ` [tip:perf/core] " tip-bot for Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 12/71] perf tools: Add dsos__hit_all() Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 13/71] perf tools: Add machine__get_thread_pid() Alexander Shishkin
2013-12-11 19:28 ` David Ahern
2013-12-11 21:18 ` Andi Kleen
2013-12-11 21:49 ` David Ahern
2013-12-12 13:56 ` Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 14/71] perf tools: Add cpu to struct thread Alexander Shishkin
2013-12-11 14:19 ` Arnaldo Carvalho de Melo
2013-12-12 14:14 ` Adrian Hunter
2013-12-11 19:30 ` David Ahern
2013-12-11 19:55 ` Arnaldo Carvalho de Melo
2013-12-11 19:57 ` David Ahern
2013-12-11 12:36 ` [PATCH v0 15/71] perf tools: Add ability to record the current tid for each cpu Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 16/71] perf tools: Allow header->data_offset to be predetermined Alexander Shishkin
2013-12-16 15:26 ` [tip:perf/core] perf header: Allow header-> data_offset " tip-bot for Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 17/71] perf tools: Add perf_evlist__can_select_event() Alexander Shishkin
2013-12-16 15:27 ` [tip:perf/core] perf evlist: Add can_select_event() method tip-bot for Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 18/71] perf session: Flag if the event stream is entirely in memory Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 19/71] perf evlist: Pass mmap parameters in a struct Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 20/71] perf tools: Move mem_bswap32/64 to util.c Alexander Shishkin
2013-12-16 15:27 ` [tip:perf/core] " tip-bot for Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 21/71] perf tools: Add feature test for __sync_val_compare_and_swap Alexander Shishkin
2013-12-11 19:24 ` Arnaldo Carvalho de Melo
2013-12-11 20:07 ` Andi Kleen
2013-12-12 13:45 ` Adrian Hunter
2013-12-12 13:42 ` Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 22/71] perf tools: Add option macro OPT_CALLBACK_OPTARG Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 23/71] perf evlist: Add perf_evlist__to_front() Alexander Shishkin
2013-12-11 19:38 ` Arnaldo Carvalho de Melo
2013-12-12 14:09 ` Adrian Hunter
2013-12-16 15:27 ` [tip:perf/core] " tip-bot for Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 24/71] perf evlist: Add perf_evlist__set_tracking_event() Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 25/71] perf evsel: Add 'no_aux_samples' option Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 26/71] perf evsel: Add 'immediate' option Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 27/71] perf evlist: Add 'system_wide' option Alexander Shishkin
2013-12-11 19:37 ` David Ahern
2013-12-12 12:22 ` Adrian Hunter
2013-12-11 12:36 ` [PATCH v0 28/71] perf tools: Add id index Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 29/71] perf pmu: Let pmu's with no events show up on perf list Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 30/71] perf session: Add ability to skip 4GiB or more Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 31/71] perf session: Add perf_session__deliver_synth_event() Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 32/71] perf tools: Allow TSC conversion on any arch Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 33/71] perf tools: Move rdtsc() function Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 34/71] perf evlist: Add perf_evlist__enable_event_idx() Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 35/71] perf tools: Add itrace members of struct perf_event_attr Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 36/71] perf tools: Add support for parsing pmu itrace_config Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 37/71] perf tools: Add support for PERF_RECORD_ITRACE_LOST Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 38/71] perf tools: Add itrace sample parsing Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 39/71] perf header: Add Instruction Tracing feature Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 40/71] perf evlist: Add ability to mmap itrace buffers Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 41/71] perf tools: Add user events for Instruction Tracing Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 42/71] perf tools: Add support for Instruction Trace recording Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 43/71] perf record: Add basic Instruction Tracing support Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 44/71] perf record: Extend -m option for Instruction Tracing mmap pages Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 45/71] perf tools: Add a user event for Instruction Tracing errors Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 46/71] perf session: Add Instruction Tracing hooks Alexander Shishkin
2013-12-11 12:36 ` [PATCH v0 47/71] perf session: Add Instruction Tracing options Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 48/71] perf session: Make perf_event__itrace_swap() non-static Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 49/71] perf itrace: Add helpers for Instruction Tracing errors Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 50/71] perf itrace: Add helpers for queuing Instruction Tracing data Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 51/71] perf itrace: Add a heap for sorting Instruction Tracing queues Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 52/71] perf itrace: Add processing for Instruction Tracing events Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 53/71] perf script: Add Instruction Tracing support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 54/71] perf script: Always allow fields 'addr' and 'cpu' for itrace Alexander Shishkin
2013-12-11 19:41 ` David Ahern
2013-12-12 12:35 ` Adrian Hunter
2013-12-11 12:37 ` [PATCH v0 55/71] perf report: Add Instruction Tracing support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 56/71] perf tools: Add Instruction Trace sampling support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 57/71] perf record: " Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 58/71] perf tools: Add Instruction Tracing Snapshot Mode Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 59/71] perf record: Add Instruction Tracing Snapshot Mode support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 60/71] perf inject: Re-pipe Instruction Tracing events Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 61/71] perf inject: Add Instruction Tracing support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 62/71] perf inject: Cut Instruction Tracing samples Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 63/71] perf tools: Add Instruction Tracing index Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 64/71] perf tools: Hit all build ids when Instruction Tracing Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 65/71] perf itrace: Add Intel PT as an Instruction Tracing type Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 66/71] perf tools: Add Intel PT packet decoder Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 67/71] perf tools: Add Intel PT instruction decoder Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 68/71] perf tools: Add Intel PT log Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 69/71] perf tools: Add Intel PT decoder Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 70/71] perf tools: Add Intel PT support Alexander Shishkin
2013-12-11 12:37 ` [PATCH v0 71/71] perf tools: Take Intel PT into use Alexander Shishkin
2013-12-11 13:04 ` [PATCH v0 00/71] perf: Add support for Intel Processor Trace Ingo Molnar
2013-12-11 13:14 ` Alexander Shishkin
2013-12-11 13:47 ` Ingo Molnar
2013-12-16 11:08 ` Alexander Shishkin
2013-12-16 14:37 ` Ingo Molnar
2013-12-16 15:18 ` Andi Kleen
2013-12-16 15:30 ` Frederic Weisbecker
2013-12-16 15:45 ` Andi Kleen
2013-12-16 15:57 ` Frederic Weisbecker
2013-12-18 4:03 ` Namhyung Kim
2013-12-11 13:52 ` Arnaldo Carvalho de Melo
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=1386765443-26966-8-git-send-email-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@gmail.com \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®