lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141117155553.GC21532@krava.brq.redhat.com>
Date:	Mon, 17 Nov 2014 16:55:53 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	kan.liang@...el.com
Cc:	acme@...nel.org, a.p.zijlstra@...llo.nl, eranian@...gle.com,
	linux-kernel@...r.kernel.org, mingo@...hat.com, paulus@...ba.org,
	ak@...ux.intel.com
Subject: Re: [PATCH V3 3/3] perf tools: Construct LBR call chain

On Fri, Nov 14, 2014 at 08:44:12AM -0500, kan.liang@...el.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.

other then that I think it's ok IMO and I could ack next version

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ