perf machine: Introduce machine__kernel_maps()
That returns the a data structure contained the ordered list of kernel
modules + the main kernel maps, one more step in removing the
MAP__{FUNCTION,VARIABLE} split.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-qsgbxfyaohc80c9ma049dubm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -20,7 +20,7 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest
|
|||||||
struct map *kallsyms_map, *vmlinux_map, *map;
|
struct map *kallsyms_map, *vmlinux_map, *map;
|
||||||
struct machine kallsyms, vmlinux;
|
struct machine kallsyms, vmlinux;
|
||||||
enum map_type type = MAP__FUNCTION;
|
enum map_type type = MAP__FUNCTION;
|
||||||
struct maps *maps = &vmlinux.kmaps.maps[type];
|
struct maps *maps = machine__kernel_maps(&vmlinux);
|
||||||
u64 mem_start, mem_end;
|
u64 mem_start, mem_end;
|
||||||
bool header_printed;
|
bool header_printed;
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ next_pair:
|
|||||||
|
|
||||||
header_printed = false;
|
header_printed = false;
|
||||||
|
|
||||||
maps = &kallsyms.kmaps.maps[type];
|
maps = machine__kernel_maps(&kallsyms);
|
||||||
|
|
||||||
for (map = maps__first(maps); map; map = map__next(map)) {
|
for (map = maps__first(maps); map; map = map__next(map)) {
|
||||||
if (!map->priv) {
|
if (!map->priv) {
|
||||||
|
|||||||
@@ -464,8 +464,7 @@ int perf_event__synthesize_modules(struct perf_tool *tool,
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct map *pos;
|
struct map *pos;
|
||||||
struct map_groups *kmaps = &machine->kmaps;
|
struct maps *maps = machine__kernel_maps(machine);
|
||||||
struct maps *maps = &kmaps->maps[MAP__FUNCTION];
|
|
||||||
union perf_event *event = zalloc((sizeof(event->mmap) +
|
union perf_event *event = zalloc((sizeof(event->mmap) +
|
||||||
machine->id_hdr_size));
|
machine->id_hdr_size));
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
|
|||||||
@@ -70,12 +70,24 @@ struct map *__machine__kernel_map(struct machine *machine, enum map_type type)
|
|||||||
return machine->vmlinux_maps[type];
|
return machine->vmlinux_maps[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The main kernel (vmlinux) map
|
||||||
|
*/
|
||||||
static inline
|
static inline
|
||||||
struct map *machine__kernel_map(struct machine *machine)
|
struct map *machine__kernel_map(struct machine *machine)
|
||||||
{
|
{
|
||||||
return __machine__kernel_map(machine, MAP__FUNCTION);
|
return __machine__kernel_map(machine, MAP__FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* kernel (the one returned by machine__kernel_map()) plus kernel modules maps
|
||||||
|
*/
|
||||||
|
static inline
|
||||||
|
struct maps *machine__kernel_maps(struct machine *machine)
|
||||||
|
{
|
||||||
|
return &machine->kmaps.maps[MAP__FUNCTION];
|
||||||
|
}
|
||||||
|
|
||||||
int machine__get_kernel_start(struct machine *machine);
|
int machine__get_kernel_start(struct machine *machine);
|
||||||
|
|
||||||
static inline u64 machine__kernel_start(struct machine *machine)
|
static inline u64 machine__kernel_start(struct machine *machine)
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ static int kernel_get_symbol_address_by_name(const char *name, u64 *addr,
|
|||||||
|
|
||||||
static struct map *kernel_get_module_map(const char *module)
|
static struct map *kernel_get_module_map(const char *module)
|
||||||
{
|
{
|
||||||
struct map_groups *grp = &host_machine->kmaps;
|
struct maps *maps = machine__kernel_maps(host_machine);
|
||||||
struct maps *maps = &grp->maps[MAP__FUNCTION];
|
|
||||||
struct map *pos;
|
struct map *pos;
|
||||||
|
|
||||||
/* A file path -- this is an offline module */
|
/* A file path -- this is an offline module */
|
||||||
|
|||||||
Reference in New Issue
Block a user