Re: [PATCH 4/5] perf intel-pt: Insert callchain context into synthesized callchains

From: Adrian Hunter
Date: Wed Oct 31 2018 - 10:22:34 EST


This is a multi-part message in MIME format.On 31/10/18 4:15 PM, Adrian Hunter wrote:
> On 31/10/18 3:28 PM, Arnaldo Carvalho de Melo wrote:
>> Em Wed, Oct 31, 2018 at 11:10:42AM +0200, Adrian Hunter escreveu:
>>> In the absence of a fallback, callchains must encode also the callchain
>>> context. Do that now there is no fallback.
>>
>> So, this one is independent of the first 3 patches, right?
>
> Yes. I was just going to test it separately when I noticed I had
> screwed up my earlier testing. When I re-tested I discovered this patch
> has an off-by-one error:
>
> diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c
> index afdf36852ac8..61a4286a74dc 100644
> --- a/tools/perf/util/thread-stack.c
> +++ b/tools/perf/util/thread-stack.c
> @@ -337,7 +337,7 @@ void thread_stack__sample(struct thread *thread, struct ip_callchain *chain,
>
> last_context = context;
>
> - for (i = 2, j = 0; i < sz && j < thread->ts->cnt; i++, j++) {
> + for (i = 2, j = 1; i < sz && j <= thread->ts->cnt; i++, j++) {
> ip = thread->ts->stack[thread->ts->cnt - j].ret_addr;
> context = callchain_context(ip, kernel_start);
> if (context != last_context) {
>
> Shall I send V2?

I have attached it