[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-6e97957d3d30552c415292bb08a0e5f3c459c027@git.kernel.org>
Date: Wed, 23 May 2018 22:42:24 -0700
From: tip-bot for Adrian Hunter <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: tglx@...utronix.de, luto@...nel.org, dave.hansen@...ux.intel.com,
linux-kernel@...r.kernel.org, peterz@...radead.org, hpa@...or.com,
jolsa@...hat.com, acme@...hat.com, joro@...tes.org,
adrian.hunter@...el.com, ak@...ux.intel.com, mingo@...nel.org,
alexander.shishkin@...ux.intel.com
Subject: [tip:perf/core] perf kcore_copy: Keep a count of phdrs
Commit-ID: 6e97957d3d30552c415292bb08a0e5f3c459c027
Gitweb: https://git.kernel.org/tip/6e97957d3d30552c415292bb08a0e5f3c459c027
Author: Adrian Hunter <adrian.hunter@...el.com>
AuthorDate: Tue, 22 May 2018 13:54:39 +0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 23 May 2018 10:26:41 -0300
perf kcore_copy: Keep a count of phdrs
In preparation to add more program headers, keep a count of phdrs.
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Joerg Roedel <joro@...tes.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: x86@...nel.org
Link: http://lkml.kernel.org/r/1526986485-6562-12-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/symbol-elf.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index b13873a6f368..4e7b71e8ac0e 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1398,6 +1398,7 @@ struct kcore_copy_info {
u64 last_symbol;
u64 first_module;
u64 last_module_symbol;
+ size_t phnum;
struct phdr_data kernel_map;
struct phdr_data modules_map;
struct list_head phdrs;
@@ -1517,6 +1518,8 @@ static int kcore_copy__read_maps(struct kcore_copy_info *kci, Elf *elf)
if (kci->modules_map.len)
list_add_tail(&kci->modules_map.node, &kci->phdrs);
+ kci->phnum = !!kci->kernel_map.len + !!kci->modules_map.len;
+
return 0;
}
@@ -1678,7 +1681,6 @@ int kcore_copy(const char *from_dir, const char *to_dir)
{
struct kcore kcore;
struct kcore extract;
- size_t count = 2;
int idx = 0, err = -1;
off_t offset = page_size, sz, modules_offset = 0;
struct kcore_copy_info kci = { .stext = 0, };
@@ -1705,10 +1707,7 @@ int kcore_copy(const char *from_dir, const char *to_dir)
if (kcore__init(&extract, extract_filename, kcore.elfclass, false))
goto out_kcore_close;
- if (!kci.modules_map.addr)
- count -= 1;
-
- if (kcore__copy_hdr(&kcore, &extract, count))
+ if (kcore__copy_hdr(&kcore, &extract, kci.phnum))
goto out_extract_close;
if (kcore__add_phdr(&extract, idx++, offset, kci.kernel_map.addr,
Powered by blists - more mailing lists