On Mon, 17 Nov 2014 16:55:53 +0100, Jiri Olsa wrote: > On Fri, Nov 14, 2014 at 08:44:12AM -0500, kan.li...@intel.com wrote: > > SNIP > >> + if (lbr) { >> + for (i = 0; i < chain_nr; i++) { >> + if (chain->ips[i] == PERF_CONTEXT_USER) >> + break; >> + } >> + >> + /* LBR only affects the user callchain */ >> + if (i != chain_nr) { >> + struct branch_stack *lbr_stack = sample->branch_stack; >> + int lbr_nr = lbr_stack->nr; >> + /* >> + * LBR callstack can only get user call chain. >> + * The mix_chain_nr is kernel call chain >> + * number plus LBR user call chain number. >> + * i is kernel call chain number, >> + * 1 is PERF_CONTEXT_USER, >> + * lbr_nr + 1 is the user call chain number. >> + * For details, please refer to the comments >> + * in callchain__printf >> + */ >> + int mix_chain_nr = i + 1 + lbr_nr + 1; >> + >> + if (mix_chain_nr > PERF_MAX_STACK_DEPTH) { >> + pr_warning("corrupted callchain. >> skipping...\n"); >> + return 0; >> + } >> + >> + for (j = 0; j < mix_chain_nr; j++) { >> + if (callchain_param.order == ORDER_CALLEE) { >> + if (j < i + 1) >> + ip = chain->ips[j]; >> + else if (j > i + 1) >> + ip = lbr_stack->entries[j - i - >> 2].from; >> + else >> + ip = lbr_stack->entries[0].to; >> + } else { >> + if (j < lbr_nr) >> + ip = lbr_stack->entries[lbr_nr >> - j - 1].from; >> + else if (j > lbr_nr) >> + ip = chain->ips[i + 1 - (j - >> lbr_nr)]; >> + else >> + ip = lbr_stack->entries[0].to; >> + } >> + >> + err = add_callchain_ip(thread, parent, root_al, >> + cpumode, ip); >> + if (err) >> + goto exit; >> + } >> + return 0; >> + } >> + } > > also could you please move whole block above into separated function? > Andi has another change for this function and it's becoming really big.
Agreed. Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/