Received: by 10.192.165.156 with SMTP id m28csp66858imm; Tue, 10 Apr 2018 16:33:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zsaihfvVysNIMzUXC/svnfj3HMiTn0LQQjZYDcGaXxZ3i9LN1FkTWKW4xZpzBiyaM/CQQ X-Received: by 10.101.93.2 with SMTP id e2mr1688938pgr.100.1523403204301; Tue, 10 Apr 2018 16:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403204; cv=none; d=google.com; s=arc-20160816; b=AtUy2AIHKC/XfvAkGT5NEH8/6X9dBWc4uiW6JbLG2AIX7mzH79K5kASAdQV9MwfEXL ERvZIxjGsr32fvikJvUu49NB2znmnWzgzmGIDGV8BqgNtfNHVn4qzjN6+Y/KEuqhgxjY skN1JIbVtsbq+0o6mgyVX/JRhplEcoT6Kri9xiGHhTki/QvQCVInWzGEhoPNhclD99Yg BG5pZGVE2hTCgIzUgKV7z7SXI+Fe51/5BZaPB8iC7LMQ0WGS149iDtHwwYG+nCvw0w1E sgHMRTho4lxSn13PQ0SEETfIDU5sRGMC/xhEM77iP/ZyL2THBwXfgdEtFBNNSB9noaWq RFJg== 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=BwSt9SR7ToDX7nJOztAuuIQ3i99jSq52obRkzZ/dCWs=; b=OI18i6uIC1SC2+u2+Qbu9mgcM5v1ldaEfpjFDyioAULdBYYJ6kmSBQpVJZp7bzyVqH eikBOe/NGNAhD2U7lwaMdcyj0HTetBE+tnTfmhSFawZaUq952Rr+r/w45zlskfLYbhfp Uia9TSPVG2hgbJXuWCk4f8pXK2C3dH2ckLkbKdvXZ0sG/zbbQVOQEK8K3oxG0vBQqA6I hef6hq7PU0tdOYvLN/SIF0bkb0u3t1kyGAh5Oxsv72y2jEoQMgMfNgZYuSAWJHIrKvnS KSBOd/xb7hZhe3lvspmz7AQdj3pYatbQfKRxdDBihqDYpk4V380TllbNF/Bu3JfmYV9u nz9A== 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 a8-v6si3452657pln.234.2018.04.10.16.32.47; Tue, 10 Apr 2018 16:33:24 -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 S1754744AbeDJX15 (ORCPT + 99 others); Tue, 10 Apr 2018 19:27:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39466 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbeDJW3V (ORCPT ); Tue, 10 Apr 2018 18:29:21 -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 A72AFD4F; Tue, 10 Apr 2018 22:29:19 +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.15 061/168] perf report: Fix a no annotate browser displayed issue Date: Wed, 11 Apr 2018 00:23:23 +0200 Message-Id: <20180410212802.798227844@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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,