All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: set kernel end address properly
@ 2018-04-16  4:22 Namhyung Kim
  2018-04-16  9:23 ` Jiri Olsa
  0 siblings, 1 reply; 30+ messages in thread
From: Namhyung Kim @ 2018-04-16  4:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, kernel-team, Kim Phillips

The map_groups__fixup_end() was called to set end addresses of kernel
map and module maps.  But now machine__create_modules() is set the end
address of modules properly so the only remaining piece is the kernel
map.  We can set it with adjacent module's address directly instead of
calling the map_groups__fixup_end().  If there's no module after the
kernel map, the end address will be ~0ULL.

Reported-by: Kim Phillips <kim.phillips@arm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/machine.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 2eca8478e24f..be328416de61 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,7 +1226,9 @@ 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;
+	u64 end = ~0ULL;
 	int ret;
 
 	if (kernel == NULL)
@@ -1259,13 +1254,14 @@ int machine__create_kernel_maps(struct machine *machine)
 			machine__destroy_kernel_maps(machine);
 			return -1;
 		}
-		machine__set_kernel_mmap(machine, addr, 0);
 	}
 
-	/*
-	 * 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)
+		end = map->start;
+
+	machine__set_kernel_mmap(machine, addr, end);
 	return 0;
 }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2018-04-26  5:52 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:perf/urgent] perf machine: Set main " tip-bot for Namhyung Kim
2018-04-19  2:54                 ` [PATCH] perf tools: set " 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

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.