perf map: Shorten map_groups__find() signature
Removing the map_type, that is going away. 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-18iiiw25r75xn7zlppjldk48@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -25,7 +25,7 @@ static int sample_ustack(struct perf_sample *sample,
|
|||||||
|
|
||||||
sp = (unsigned long) regs[PERF_REG_ARM_SP];
|
sp = (unsigned long) regs[PERF_REG_ARM_SP];
|
||||||
|
|
||||||
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
pr_debug("failed to get stack map\n");
|
pr_debug("failed to get stack map\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static int sample_ustack(struct perf_sample *sample,
|
|||||||
|
|
||||||
sp = (unsigned long) regs[PERF_REG_ARM64_SP];
|
sp = (unsigned long) regs[PERF_REG_ARM64_SP];
|
||||||
|
|
||||||
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
pr_debug("failed to get stack map\n");
|
pr_debug("failed to get stack map\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
|
|||||||
|
|
||||||
sp = (unsigned long) regs[PERF_REG_POWERPC_R1];
|
sp = (unsigned long) regs[PERF_REG_POWERPC_R1];
|
||||||
|
|
||||||
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
pr_debug("failed to get stack map\n");
|
pr_debug("failed to get stack map\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ static int sample_ustack(struct perf_sample *sample,
|
|||||||
|
|
||||||
sp = (unsigned long) regs[PERF_REG_X86_SP];
|
sp = (unsigned long) regs[PERF_REG_X86_SP];
|
||||||
|
|
||||||
map = map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
map = __map_groups__find(thread->mg, MAP__VARIABLE, (u64) sp);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
pr_debug("failed to get stack map\n");
|
pr_debug("failed to get stack map\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest
|
|||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
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;
|
|
||||||
struct maps *maps = machine__kernel_maps(&vmlinux);
|
struct maps *maps = machine__kernel_maps(&vmlinux);
|
||||||
u64 mem_start, mem_end;
|
u64 mem_start, mem_end;
|
||||||
bool header_printed;
|
bool header_printed;
|
||||||
@@ -205,7 +204,7 @@ next_pair:
|
|||||||
mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start);
|
mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start);
|
||||||
mem_end = vmlinux_map->unmap_ip(vmlinux_map, map->end);
|
mem_end = vmlinux_map->unmap_ip(vmlinux_map, map->end);
|
||||||
|
|
||||||
pair = map_groups__find(&kallsyms.kmaps, type, mem_start);
|
pair = map_groups__find(&kallsyms.kmaps, mem_start);
|
||||||
if (pair == NULL || pair->priv)
|
if (pair == NULL || pair->priv)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -1534,7 +1534,7 @@ struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
try_again:
|
try_again:
|
||||||
al->map = map_groups__find(mg, type, al->addr);
|
al->map = __map_groups__find(mg, type, al->addr);
|
||||||
if (al->map == NULL) {
|
if (al->map == NULL) {
|
||||||
/*
|
/*
|
||||||
* If this is outside of all known maps, and is a negative
|
* If this is outside of all known maps, and is a negative
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
|
|||||||
enum map_type type, u64 addr,
|
enum map_type type, u64 addr,
|
||||||
struct map **mapp)
|
struct map **mapp)
|
||||||
{
|
{
|
||||||
struct map *map = map_groups__find(mg, type, addr);
|
struct map *map = __map_groups__find(mg, type, addr);
|
||||||
|
|
||||||
/* Ensure map is loaded before using map->map_ip */
|
/* Ensure map is loaded before using map->map_ip */
|
||||||
if (map != NULL && map__load(map) >= 0) {
|
if (map != NULL && map__load(map) >= 0) {
|
||||||
@@ -627,8 +627,7 @@ int map_groups__find_ams(struct addr_map_symbol *ams)
|
|||||||
if (ams->addr < ams->map->start || ams->addr >= ams->map->end) {
|
if (ams->addr < ams->map->start || ams->addr >= ams->map->end) {
|
||||||
if (ams->map->groups == NULL)
|
if (ams->map->groups == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
ams->map = map_groups__find(ams->map->groups, ams->map->type,
|
ams->map = __map_groups__find(ams->map->groups, ams->map->type, ams->addr);
|
||||||
ams->addr);
|
|
||||||
if (ams->map == NULL)
|
if (ams->map == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,12 +214,17 @@ static inline void map_groups__remove(struct map_groups *mg, struct map *map)
|
|||||||
maps__remove(&mg->maps[map->type], map);
|
maps__remove(&mg->maps[map->type], map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct map *map_groups__find(struct map_groups *mg,
|
static inline struct map *__map_groups__find(struct map_groups *mg,
|
||||||
enum map_type type, u64 addr)
|
enum map_type type, u64 addr)
|
||||||
{
|
{
|
||||||
return maps__find(&mg->maps[type], addr);
|
return maps__find(&mg->maps[type], addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct map *map_groups__find(struct map_groups *mg, u64 addr)
|
||||||
|
{
|
||||||
|
return __map_groups__find(mg, MAP__FUNCTION, addr);
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct map *map_groups__first(struct map_groups *mg,
|
static inline struct map *map_groups__first(struct map_groups *mg,
|
||||||
enum map_type type)
|
enum map_type type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -723,7 +723,7 @@ static int dso__split_kallsyms_for_kcore(struct dso *dso, struct map *map)
|
|||||||
if (module)
|
if (module)
|
||||||
*module = '\0';
|
*module = '\0';
|
||||||
|
|
||||||
curr_map = map_groups__find(kmaps, map->type, pos->start);
|
curr_map = __map_groups__find(kmaps, map->type, pos->start);
|
||||||
|
|
||||||
if (!curr_map) {
|
if (!curr_map) {
|
||||||
symbol__delete(pos);
|
symbol__delete(pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user