From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, jolsa@kernel.org, hpa@zytor.com,
kim.phillips@arm.com, tglx@linutronix.de, acme@redhat.com,
mingo@kernel.org, linux-kernel@vger.kernel.org,
peterz@infradead.org
Subject: [tip:perf/urgent] perf machine: Set main kernel end address properly
Date: Wed, 25 Apr 2018 22:51:50 -0700 [thread overview]
Message-ID: <tip-ee05d21791db6db954bbb7b79bb18d88b5f6b7ff@git.kernel.org> (raw)
In-Reply-To: <20180419235915.GA19067@sejong>
Commit-ID: ee05d21791db6db954bbb7b79bb18d88b5f6b7ff
Gitweb: https://git.kernel.org/tip/ee05d21791db6db954bbb7b79bb18d88b5f6b7ff
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 19 Feb 2018 19:05:45 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 23 Apr 2018 10:52:55 -0300
perf machine: Set main kernel end address properly
map_groups__fixup_end() was called to set the end addresses of kernel
and module maps. But now since machine__create_modules() sets the end
address of modules properly, the only remaining piece is the kernel map.
We can set it with adjacent module's address directly instead of calling
map_groups__fixup_end(). If there's no module after the kernel map, the
end address will be ~0ULL.
Since it also changes the start address of the kernel map, it needs to
re-insert the map to the kmaps in order to keep a correct ordering. Kim
reported that it caused problems on ARM64.
Reported-by: Kim Phillips <kim.phillips@arm.com>
Tested-by: Kim Phillips <kim.phillips@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20180419235915.GA19067@sejong
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 2eca8478e24f..32d50492505d 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1019,13 +1019,6 @@ int machine__load_vmlinux_path(struct machine *machine, enum map_type type)
return ret;
}
-static void map_groups__fixup_end(struct map_groups *mg)
-{
- int i;
- for (i = 0; i < MAP__NR_TYPES; ++i)
- __map_groups__fixup_end(mg, i);
-}
-
static char *get_kernel_version(const char *root_dir)
{
char version[PATH_MAX];
@@ -1233,6 +1226,7 @@ int machine__create_kernel_maps(struct machine *machine)
{
struct dso *kernel = machine__get_kernel(machine);
const char *name = NULL;
+ struct map *map;
u64 addr = 0;
int ret;
@@ -1259,13 +1253,25 @@ int machine__create_kernel_maps(struct machine *machine)
machine__destroy_kernel_maps(machine);
return -1;
}
- machine__set_kernel_mmap(machine, addr, 0);
+
+ /* we have a real start address now, so re-order the kmaps */
+ map = machine__kernel_map(machine);
+
+ map__get(map);
+ map_groups__remove(&machine->kmaps, map);
+
+ /* assume it's the last in the kmaps */
+ machine__set_kernel_mmap(machine, addr, ~0ULL);
+
+ map_groups__insert(&machine->kmaps, map);
+ map__put(map);
}
- /*
- * Now that we have all the maps created, just set the ->end of them:
- */
- map_groups__fixup_end(&machine->kmaps);
+ /* update end address of the kernel map using adjacent module address */
+ map = map__next(machine__kernel_map(machine));
+ if (map)
+ machine__set_kernel_mmap(machine, addr, map->start);
+
return 0;
}
next prev parent reply other threads:[~2018-04-26 5:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 4:22 [PATCH] perf tools: set kernel end address properly Namhyung Kim
2018-04-16 9:23 ` Jiri Olsa
2018-04-16 13:51 ` Arnaldo Carvalho de Melo
2018-04-16 16:07 ` Kim Phillips
2018-04-16 16:58 ` Arnaldo Carvalho de Melo
2018-04-16 17:24 ` Kim Phillips
2018-04-16 22:48 ` Kim Phillips
2018-04-17 2:27 ` Namhyung Kim
2018-04-19 0:37 ` Kim Phillips
2018-04-19 2:37 ` Namhyung Kim
2018-04-19 23:20 ` Kim Phillips
2018-04-19 23:59 ` Namhyung Kim
2018-04-20 23:23 ` Kim Phillips
2018-04-23 13:52 ` Arnaldo Carvalho de Melo
2018-04-23 14:56 ` Kim Phillips
2018-04-26 5:51 ` tip-bot for Namhyung Kim [this message]
2018-04-19 2:54 ` Namhyung Kim
2018-04-19 23:33 ` Kim Phillips
2018-04-20 0:11 ` Namhyung Kim
2018-04-20 8:10 ` Ard Biesheuvel
2018-04-23 21:43 ` Kim Phillips
2018-04-24 6:13 ` Ard Biesheuvel
2018-04-24 12:50 ` Kim Phillips
2018-04-24 13:07 ` Ard Biesheuvel
2018-04-24 15:13 ` [PATCH] arm64/kernel: rename module_emit_adrp_veneer->module_emit_veneer_for_adrp Kim Phillips
2018-04-24 15:13 ` Kim Phillips
2018-04-24 15:15 ` Ard Biesheuvel
2018-04-24 15:15 ` Ard Biesheuvel
2018-04-24 15:39 ` [PATCH v2] " Kim Phillips
2018-04-24 15:39 ` Kim Phillips
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=tip-ee05d21791db6db954bbb7b79bb18d88b5f6b7ff@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kim.phillips@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.