Received: by 10.223.164.202 with SMTP id h10csp4393765wrb; Wed, 29 Nov 2017 05:48:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMZwuNKIRe6drUETdrNYSIII5fp6yk/xkRli0y8TsmwiX5b0AIgrFI8WWJxaNb20lfDpu1xM X-Received: by 10.84.135.101 with SMTP id 92mr3085775pli.172.1511963311993; Wed, 29 Nov 2017 05:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511963311; cv=none; d=google.com; s=arc-20160816; b=B/xvio107GNwpvvh4IA0ukLJnuLuUchairziUok4xe/x7NaEkIUS/vkjICJPtLre/L PePx9VSs9Gr/BuztYKNQ2373NW5frpSNxahaVmzskdMqSKwiKGnz/H163maI40QLaltL +1/udcL8+EtWKtQ7oCkx669vdEEpkNtBtTkcXHKXmM35bisF41HKC1xvC06+sIlqQJtH EibLbNi74jaAP9SGOsf3fRrlRbxJQJywN6AqfV06N6paErJ9DZQCYBOD0ww20YtMMu55 rzhFSI+SJBZuVOcsAwL8BaVd09NXwTaQd5ZOR6pjumOKn7WjMxrcT3Le7IxWVtPyLmSF leOw== 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=2vqAdk/sdtFT6B6079IMbNk8q82g6sDctyGmyRnX8NM=; b=xlWzL9bnfiunxmXDJMtQbvM+nM7BJhjUdhxMjlfdArv/zUOUMZRevgAK1FRX08IiHT eMrvaRx5yXrl+dTnE5ZVx4Oy+vPDV6x6mByB/T/8M2em48xL24nN+WF2Eep/hIE2gzm4 IFn9C2BAxK7BBakex6MAnD6X4hwy6bl58+SIWg/XB1MhF6zaaxoFk1GqQHsuNOOXkRSO x4nUETZtwRpFluhlyN0nBYKM5YdsgsumYOu0hdF4iC+BClAPmFi+PEQrmfkZBYNARpkV N3w8BQ6AKKZj7BYML8WBcgYGrXotR58gXQ55cQIJ/xUKmmpMiHk90Ujo27dTT+CPwg+l xlPg== 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 w2si1277164plp.715.2017.11.29.05.48.21; Wed, 29 Nov 2017 05:48:31 -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 S1754716AbdK2Meb (ORCPT + 70 others); Wed, 29 Nov 2017 07:34:31 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42228 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752963AbdK2Mea (ORCPT ); Wed, 29 Nov 2017 07:34:30 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vATCYOic045375 for ; Wed, 29 Nov 2017 07:34:29 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ehurtkpq2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 29 Nov 2017 07:34:28 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Nov 2017 12:34:27 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Nov 2017 12:34:25 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vATCYP7Y45678828; Wed, 29 Nov 2017 12:34:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C158FA4040; Wed, 29 Nov 2017 12:28:57 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47EEEA4053; Wed, 29 Nov 2017 12:28:55 +0000 (GMT) Received: from [9.79.224.165] (unknown [9.79.224.165]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2017 12:28:54 +0000 (GMT) Subject: Re: [PATCH] perf annotate: Fix unnecessary memory allocation for s390x To: Thomas Richter , acme@kernel.org Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, Ravi Bangoria References: <20171124094637.55558-1-tmricht@linux.vnet.ibm.com> From: Ravi Bangoria Date: Wed, 29 Nov 2017 18:04:56 +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: <20171124094637.55558-1-tmricht@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17112912-0040-0000-0000-000003F3F17E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17112912-0041-0000-0000-000025F6D3A1 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-29_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711290162 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/24/2017 03:16 PM, Thomas Richter wrote: > This patch fixes a bug introduced with commit d9f8dfa9baf9 > ("perf annotate s390: Implement jump types for perf annotate"). > > Perf annotate displays annotated assembler output by reading > output of command objdump and parsing the disassembled lines. For > each shown mnemonic this function sequence is executed: > > disasm_line__new() > | > +--> disasm_line__init_ins() > | > +--> ins__find() > | > +--> arch->associate_instruction_ops() > > The s390x specific function assigned to function pointer > associate_instruction_ops refers to function > s390__associate_ins_ops(). This function checks for supported > mnemonics and assigns a NULL pointer to unsupported mnemonics. > However even the NULL pointer is added to the architecture > dependend instruction array. > > This leads to an extremely large architecture instruction array > (due to array resize logic in function arch__grow_instructions()). > Depending on the objdump output being parsed the array can end up > with several ten-thousand elements. > > This patch checks if a mnemonic is supported and only adds > supported ones into the architecture instruction array. The > array does not contain elements with NULL pointers anymore. > > Before the patch (With some debug printf output): > [root@s35lp76 perf]# time ./perf annotate --stdio > /tmp/xxxbb > > real 8m49.679s > user 7m13.008s > sys 0m1.649s > [root@s35lp76 perf]# fgrep '__ins__find sorted:1 nr_instructions:' > /tmp/xxxbb | tail -1 > __ins__find sorted:1 nr_instructions:87433 ins:0x341583c0 > [root@s35lp76 perf]# > > The number of different s390x branch/jump/call/return instructions > entered into the array is 87433. > > After the patch (With some printf debug output:) > > [root@s35lp76 perf]# time ./perf annotate --stdio > /tmp/xxxaa > > real 1m24.553s > user 0m0.587s > sys 0m1.530s > [root@s35lp76 perf]# fgrep '__ins__find sorted:1 nr_instructions:' > /tmp/xxxaa | tail -1 > __ins__find sorted:1 nr_instructions:56 ins:0x3f406570 > [root@s35lp76 perf]# > > The number of different s390x branch/jump/call/return instructions > entered into the array is 56 which is sensible. Ack-by: Ravi Bangoria > Signed-off-by: Thomas Richter > Reviewed-by: Hendrik Brueckner > --- > tools/perf/arch/s390/annotate/instructions.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c > index c9a81673e8aa..89f0b6c00e3f 100644 > --- a/tools/perf/arch/s390/annotate/instructions.c > +++ b/tools/perf/arch/s390/annotate/instructions.c > @@ -16,7 +16,8 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na > if (!strcmp(name, "br")) > ops = &ret_ops; > > - arch__associate_ins_ops(arch, name, ops); > + if (ops) > + arch__associate_ins_ops(arch, name, ops); > return ops; > } > From 1584940385779909713@xxx Fri Nov 24 09:48:58 +0000 2017 X-GM-THRID: 1584940385779909713 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread