Em Mon, Feb 19, 2018 at 11:20:36AM +0900, Namhyung Kim escreveu: > On Thu, Feb 15, 2018 at 01:26:32PM +0100, Jiri Olsa wrote: > > if (!machine__get_running_kernel_start(machine, &name, &addr)) { > > if (name && > > maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, > > name, addr)) { > > 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); > > With above change, I think it work. But the whole point of the above > is to set the end address of vmlinux and modules. And now we don't > need it for modules thanks to modules__parse() for passing the size. > > So we only needs to update the end address of vmlinux using the start > address of the first module. What about this then? Looks ok, Jiri? I noticed that Namhyung has the patch below in his git tree, but I couldn't find it in the mailing list, Jiri, can I have your acked-by? - Arnaldo > Thanks, > Namhyung > > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index fe27ef55cbb9..022f0539b750 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -1021,13 +1021,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]; > @@ -1235,6 +1228,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; > > @@ -1261,13 +1255,13 @@ 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) > + machine__set_kernel_mmap(machine, addr, map->start); > + > return 0; > }