Received: by 10.223.164.202 with SMTP id h10csp371728wrb; Mon, 13 Nov 2017 07:47:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMbg3mNbhbW1UI0oqJCCIVeN0Tsosfj7DO1XWXyaUHopEjVH85bxfjjs6ApbyhKoT/uiWPij X-Received: by 10.98.16.211 with SMTP id 80mr10247089pfq.72.1510588034101; Mon, 13 Nov 2017 07:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510588034; cv=none; d=google.com; s=arc-20160816; b=ojTuasZlFhIFpQvR1zz2x/N+10iRlctsWZoXFPGkN7p8jiKnfNrNPNob9ZdTE/7Q4D YPgExU+jwN0sKB8P9Z4iInAcBMRU+SfROFyai3jTkTRJSFCCQGgmYLv3B/ZlRAZ/Rl8r J9OMTBuf7qdnTL5ihmzza/SlLUDMyaxoAlMK3j3l4iZnr4Nr6SOsgsi7vMlOx19mfVZS 8dMVCGPhk6WQ6qhKD3ZOIB3s8+veyMhJ4OLTqgNz3a9WacAAWHCjyWlvFMP4kgWg1Egt 5PoZenqlPxZM9Al17OoR3wWLryMcaOWex5jLHeY4aelY+pgGrO8YqYzz1XK9LfGgzs2Q wiuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=omST0Dn8szU5gKOq2qRcoKryRA9reaAkfm8Y04TjqPY=; b=RHCmQg+kTC+SG0u6Ms8P8VbY959Yv3Tye7kbaFD5GmdGgMVRXBWsCNNyHwF3NYtsLw cPKE3PkljteWsbHEv/rpOil/EpRGB31FBZqAciuYCHN1PhIKcfL2C6UC4brJUgjXzT+j KSrBJWW0oWNiZg7SRICs2IOu8SN/SSlGl+0gFyWhJwIInwa0LRJgKZug2IXCrYjSIkws JbYacLR5ir6fz9TOa+yQ2ehSTfl6xGT7idvlSzTBw09i6WPTvGtpBkhZ7jQf9ySswmSV 7p67+oV695ZT/KK3xoyAzP2Qj6RLBuQboX0avXdTxjvtvAQRjZ3n1hNhg735oVYuK4Iz xuaQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f24si15623918pfk.415.2017.11.13.07.47.00; Mon, 13 Nov 2017 07:47:14 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351AbdKMPqU (ORCPT + 88 others); Mon, 13 Nov 2017 10:46:20 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50210 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753062AbdKMPqT (ORCPT ); Mon, 13 Nov 2017 10:46:19 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vADFjdWY064221 for ; Mon, 13 Nov 2017 10:46:18 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e7cty5sb9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Nov 2017 10:46:17 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Nov 2017 15:46:12 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Nov 2017 15:46:09 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vADFk88s36372566; Mon, 13 Nov 2017 15:46:09 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42AD94C046; Mon, 13 Nov 2017 15:41:24 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E6DE4C044; Mon, 13 Nov 2017 15:41:20 +0000 (GMT) Received: from [9.79.253.74] (unknown [9.79.253.74]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 13 Nov 2017 15:41:19 +0000 (GMT) Subject: Re: [PATCH 16/35] perf annotate: Add samples into struct annotation_line To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Peter Zijlstra , Andi Kleen , ravi.bangoria@linux.vnet.ibm.com References: <20171011150158.11895-1-jolsa@kernel.org> <20171011150158.11895-17-jolsa@kernel.org> From: Ravi Bangoria Date: Mon, 13 Nov 2017 21:16:20 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171011150158.11895-17-jolsa@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17111315-0040-0000-0000-0000040DC154 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111315-0041-0000-0000-000020B07101 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711130219 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, This patch seems to be causing segfault with "perf top --stdio". Steps to reproduce: 1. start "perf top --stdio" in one terminal 2. run some simple workload in another terminal, let it get finished. 3. annotate function from previous workload in perf top (press 'a' followed by 's') Perf will crash with:   perf: Segmentation fault   Obtained 8 stack frames.   ./perf(sighandler_dump_stack+0x3e) [0x4f1b6e]   /lib64/libc.so.6(+0x36a7f) [0x7ff3aa7e4a7f]   ./perf() [0x4a27fd]   ./perf(symbol__annotate+0x199) [0x4a4439]   ./perf() [0x44e32d]   ./perf() [0x44f098]   /lib64/libpthread.so.0(+0x736c) [0x7ff3acee836c]   /lib64/libc.so.6(clone+0x3e) [0x7ff3aa8bee1e] Can you please check. Thanks, Ravi On 10/11/2017 08:31 PM, Jiri Olsa wrote: > Adding samples array into struct annotation_line to > hold the annotation data. The data are populated in > the following patches. > > Link: http://lkml.kernel.org/n/tip-97yja5m7z9brrcuf2gwr56t2@git.kernel.org > Signed-off-by: Jiri Olsa > --- > tools/perf/util/annotate.c | 8 ++++++++ > tools/perf/util/annotate.h | 17 ++++++++++++----- > 2 files changed, 20 insertions(+), 5 deletions(-) > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 8e1e88aab45a..1b5c7d0a53e8 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -901,7 +901,14 @@ static struct annotation_line* > annotation_line__new(struct annotate_args *args, size_t privsize) > { > struct annotation_line *al; > + struct perf_evsel *evsel = args->evsel; > size_t size = privsize + sizeof(*al); > + int nr = 1; > + > + if (perf_evsel__is_group_event(evsel)) > + nr = evsel->nr_members; > + > + size += sizeof(al->samples[0]) * nr; > > al = zalloc(size); > if (al) { > @@ -910,6 +917,7 @@ annotation_line__new(struct annotate_args *args, size_t privsize) > al->offset = args->offset; > al->line = strdup(args->line); > al->line_nr = args->line_nr; > + al->samples_nr = nr; > } > > return al; > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h > index a02a2bf4f2ab..9c722a7e5f6d 100644 > --- a/tools/perf/util/annotate.h > +++ b/tools/perf/util/annotate.h > @@ -58,6 +58,16 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2); > > struct annotation; > > +struct sym_hist_entry { > + u64 nr_samples; > + u64 period; > +}; > + > +struct annotation_data { > + double percent; > + struct sym_hist_entry he; > +}; > + > struct annotation_line { > struct list_head node; > struct rb_node rb_node; > @@ -67,6 +77,8 @@ struct annotation_line { > float ipc; > u64 cycles; > size_t privsize; > + int samples_nr; > + struct annotation_data samples[0]; > }; > > struct disasm_line { > @@ -87,11 +99,6 @@ static inline bool disasm_line__has_offset(const struct disasm_line *dl) > return dl->ops.target.offset_avail; > } > > -struct sym_hist_entry { > - u64 nr_samples; > - u64 period; > -}; > - > void disasm_line__free(struct disasm_line *dl); > struct annotation_line* > annotation_line__next(struct annotation_line *pos, struct list_head *head); From 1580974192078564530@xxx Wed Oct 11 15:08:01 +0000 2017 X-GM-THRID: 1580974192078564530 X-Gmail-Labels: Inbox,Category Forums