Re: [PATCH V2 2/3] perf tool: re-organize thread__resolve_callchain_sample

From: Jiri Olsa
Date: Thu Nov 13 2014 - 13:21:50 EST


On Wed, Nov 12, 2014 at 07:18:14PM -0500, kan.liang@xxxxxxxxx wrote:

SNIP

> +static inline int __thread__resolve_callchain_sample(struct thread *thread,
> + u64 ip, u8 *cpumode,
> + struct symbol **parent,
> + struct addr_location *root_al)
> +{
> + struct addr_location al;
> +
> + if (ip >= PERF_CONTEXT_MAX) {
> + switch (ip) {
> + case PERF_CONTEXT_HV:
> + *cpumode = PERF_RECORD_MISC_HYPERVISOR;
> + break;
> + case PERF_CONTEXT_KERNEL:
> + *cpumode = PERF_RECORD_MISC_KERNEL;
> + break;
> + case PERF_CONTEXT_USER:
> + *cpumode = PERF_RECORD_MISC_USER;
> + break;
> + default:
> + pr_debug("invalid callchain context: "
> + "%"PRId64"\n", (s64) ip);
> + /*
> + * It seems the callchain is corrupted.
> + * Discard all.
> + */
> + callchain_cursor_reset(&callchain_cursor);
> + return 1;
> + }
> + return 0;
> + }
> +
> + al.filtered = 0;
> + thread__find_addr_location(thread, *cpumode,
> + MAP__FUNCTION, ip, &al);
> + if (al.sym != NULL) {
> + if (sort__has_parent && !*parent &&
> + symbol__match_regex(al.sym, &parent_regex))
> + *parent = al.sym;
> + else if (have_ignore_callees && root_al &&
> + symbol__match_regex(al.sym, &ignore_callees_regex)) {
> + /* Treat this symbol as the root,
> + forgetting its callees. */
> + *root_al = al;
> + callchain_cursor_reset(&callchain_cursor);
> + }
> + }
> +
> + return callchain_cursor_append(&callchain_cursor,
> + ip, al.map, al.sym);

you added slightly more than Andi ;-)
http://marc.info/?l=linux-kernel&m=141584439819848&w=2

Any chance you guys could sync on this? ..you're touching the
same code.. Andi, maybe you wouldn't mind having this patch
instead of your change.. looks like the only extra part is the
cpumode resolve.

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/