Received: by 10.192.165.156 with SMTP id m28csp42589imm; Tue, 10 Apr 2018 16:01:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx49hEx9N23xofw/YQ8yGlZsKj0dNa0AChla3RnA1bZ6yI/z9bywnc73mDwzgNt/pdzgZC0/5 X-Received: by 2002:a17:902:43e4:: with SMTP id j91-v6mr2359200pld.118.1523401278837; Tue, 10 Apr 2018 16:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401278; cv=none; d=google.com; s=arc-20160816; b=MClLWs1lKnZM2gYRz4iGZRvasj+kSyNpkJYJ4a2NV+uMhnxNVqzEQgghZNvtg76/fP sC6pgZXiLxhQ0RZ4MgpK0VTOeL4njr+KJrokE14ylNRMubAgvSramBPtbke3WN9wMXcx VFhDAY6/H308T3AwLPyL9aJAcnZlVQYLBOt0WZhPhQWaDqB1MSCn5gQZrbzu3Hrv66iq jbKBDvgBP9Hz+H1ADw05vVf0UFTw0VTAOZnk6R5nsf6PK6/fX9w4JnFcKaEoJ4Jd9KDM 0B7m7QBzcPvC0bs7nBIDa6Y84glgHu6r8GyuC+WXRJQIWoKHFwJpVguhwmcn3Ydpxk0J fUAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=S8erZqKI4xM145zcUmy+eT2pF1c/qDFT5Cv84HnxwR4=; b=yzbOoogfayFsOAnMWiw62dtOGBGHR2L+fnInsraScTW7A0SVT097INGhN5PFCGd9ug aZ26zorGxPFLLHpzgCGFfqjCk0ang4l3EA0zzekenDvO8RVc/GjBTl8ZmkfW9Nro88rW NbiodwlMjtxFe/uKRQEUMTlvEKxjlz/mecQ5Tqu8lY7YruEcfCt3lMY0vvr9oea+QViK 8v3ysgnGzh15NTDQ/owGFspJsZsZhMjjalLGpGKf69/PGcLoAypGOA8oWQD4vXkhIPWt bMMZwqXOwEC7kwaKl1vz0XtiKdiDp0Bm8fINPnyRNYNRNwqG9Ni4OAXeHLCmzJ7p4eeV V5WQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si3900520pln.619.2018.04.10.16.00.40; Tue, 10 Apr 2018 16:01:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755757AbeDJWhB (ORCPT + 99 others); Tue, 10 Apr 2018 18:37:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43622 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755743AbeDJWg6 (ORCPT ); Tue, 10 Apr 2018 18:36:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 92B97408; Tue, 10 Apr 2018 22:36:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jin Yao , Arnaldo Carvalho de Melo , Alexander Shishkin , Andi Kleen , Jiri Olsa , Kan Liang , Peter Zijlstra , Sasha Levin Subject: [PATCH 4.14 046/138] perf report: Fix a no annotate browser displayed issue Date: Wed, 11 Apr 2018 00:23:56 +0200 Message-Id: <20180410212907.441055486@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jin Yao [ Upstream commit 40c39e3046411f84bab82f66783ff3593e2bcd9b ] When enabling '-b' option in perf record, for example, perf record -b ... perf report and then browsing the annotate browser from perf report (press 'A'), it would fail (annotate browser can't be displayed). It's because the '.add_entry_cb' op of struct report is overwritten by hist_iter__branch_callback() in builtin-report.c. But this function doesn't do something like mapping symbols and sources. So next, do_annotate() will return directly. notes = symbol__annotation(act->ms.sym); if (!notes->src) return 0; This patch adds the lost code to hist_iter__branch_callback (refer to hist_iter__report_callback). v2: Fix a crash bug when perform 'perf report --stdio'. The reason is that we init the symbol annotation only in browser mode, it doesn't allocate/init resources for stdio mode. So now in hist_iter__branch_callback(), it will return directly if it's not in browser mode. Signed-off-by: Jin Yao Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: Kan Liang Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1514284963-18587-1-git-send-email-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/builtin-report.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -162,12 +162,28 @@ static int hist_iter__branch_callback(st struct hist_entry *he = iter->he; struct report *rep = arg; struct branch_info *bi; + struct perf_sample *sample = iter->sample; + struct perf_evsel *evsel = iter->evsel; + int err; + + if (!ui__has_annotation()) + return 0; + + hist__account_cycles(sample->branch_stack, al, sample, + rep->nonany_branch_mode); bi = he->branch_info; + err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx); + if (err) + goto out; + + err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx); + branch_type_count(&rep->brtype_stat, &bi->flags, bi->from.addr, bi->to.addr); - return 0; +out: + return err; } static int process_sample_event(struct perf_tool *tool,