Received: by 10.192.165.156 with SMTP id m28csp322486imm; Wed, 18 Apr 2018 23:02:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+qoo2D7n+Q007IsUBCE4p1Ou99ExiJ7yrrgPUXG+sUBhZnLobe/xpeMHt0H/dvBBWmktpu X-Received: by 10.101.91.138 with SMTP id i10mr4138569pgr.431.1524117778939; Wed, 18 Apr 2018 23:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524117778; cv=none; d=google.com; s=arc-20160816; b=dF4JzbUF3NMFkcjA8Q2rKcVQXsH8kaag+55lkK2UWfRVw8vMc43XnmQ8jhjyhl0JkX sWBlhDAXNK0UJGEYKuTPOy9BFZY++H+ANCZkWMEipTTBaG1pzdO0l8xtgpBw/95zHlwm UEyiHLQMzmjB5wBu6KS4t40yufXNyRcgvWkHzcQoYT9mHprPpwsGVbLxj9e29z+4jXo2 aR/zyf1/igLo2j1Q0qO554UJShF+2PakLziDmyuh7Fd9DSvS835X3AXtRLaTkesW/S/s XOZuG1CTbxzouMOxW/pUwcY+t5zIjyLdUDHE51yX7wcFgBniIXtgAmVdQ+DNrOG/HjEe H+SQ== 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=xQ2pNqMMRToMCuqQfld6n+nqLPX1mdXSkWXqZZlHgoY=; b=eDWHKoGis6lKgo1WuLr1gES8Fq9sJCTAZpAPCmHGa2T1atx3/h9/fB3uh0HWaviZiL Gtz7mLWn1hWjnTi+TPIaOF+I7Kqf65qfLlOC0KbaXJpqoJfYbuWzNZOiB4dMEizrnysj mYQWKtkKsuFENdm1FcfTihuj4a1hQQdusLAq+fFeRnG8GahzXET7CMjDpY/UuYqNoMJ7 e5VCuk503PNV7v/X0VB08NhzpJItLBWpqhC8oPrzs3XfjfYbvfehM2phtQywfzeGyinX TarfLY6tb2kKuEWkLPeJl2E/8MuRDYYQxkL0CTZ79GMwomSGezsL1MfooZHamkYEin5E LWjg== 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 q74si2646907pfg.295.2018.04.18.23.02.44; Wed, 18 Apr 2018 23:02:58 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752705AbeDSGBf (ORCPT + 99 others); Thu, 19 Apr 2018 02:01:35 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59232 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeDSGBd (ORCPT ); Thu, 19 Apr 2018 02:01:33 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3J5xwZl043461 for ; Thu, 19 Apr 2018 02:01:33 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hefdwwcu4-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 19 Apr 2018 02:01:32 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Apr 2018 07:01:29 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 19 Apr 2018 07:01:26 +0100 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 w3J61Qah38011094; Thu, 19 Apr 2018 06:01:26 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1836D4C044; Thu, 19 Apr 2018 06:53:55 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 97CA24C040; Thu, 19 Apr 2018 06:53:53 +0100 (BST) Received: from [9.124.31.177] (unknown [9.124.31.177]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 19 Apr 2018 06:53:53 +0100 (BST) Subject: Re: [PATCH v2 0/3] perf: Fixes for callchain ip handling on powerpc To: Sandipan Das , acme@kernel.org Cc: jolsa@redhat.com, linux-kernel@vger.kernel.org, naveen.n.rao@linux.vnet.ibm.com, ravi.bangoria@linux.vnet.ibm.com, sukadev@linux.vnet.ibm.com, maynard@us.ibm.com References: <20180418105900.5899-1-sandipan@linux.vnet.ibm.com> From: Ravi Bangoria Date: Thu, 19 Apr 2018 11:31:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180418105900.5899-1-sandipan@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18041906-0040-0000-0000-000004309F02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041906-0041-0000-0000-00002634B395 Message-Id: <8c0d4deb-9bbd-1f19-94a3-ce2cded4fa10@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-19_02:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804190052 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/18/2018 04:28 PM, Sandipan Das wrote: > The first patch fixes the callchain ip filtering mechanism for powerpc > from skipping entries in case the LR value is still valid and yet to > be written to the stack frame. This was previously posted as an RFC > here: https://lkml.org/lkml/2018/4/4/633 > > The second patch fixes a crash caused by attempting to access an empty > callchain. > > The third patch fixes a shell test which used to fail on powerpc as > the back trace from perf output did not match the expected pattern. > Also, because of the issue described in the first patch, some entries > from the callchain were incorrectly skipped. So, this has also been > readjusted to work with the fix in the first patch. > > v2: > - Consider case when return address is in R0 as pointed out by Ravi. > - Add another patch to fix crash when callchain is empty. Looks good. For the series, Tested-by: Ravi Bangoria But there are few other cases, I've mentioned them in detail at the end, which needs to be fixed. Arnaldo, if you are fine, can we push this series and take care of other cases later on? No point in stretching this series. I've used this simple test program to test it:     int i = 10000000;     void *ptr;     while (i--) {         ptr = malloc(i);         free(ptr);     } Case 1: Without Suka's and Sandipan's changes:     perf  9207  3034.786828:   cycles:ppp:                       10d66c power_pmu_enable (/lib/modules/4.17.0-rc1+/build/vmlinux)                       2e4f24 perf_event_exec (/lib/modules/4.17.0-rc1+/build/vmlinux)            <===== This one                       4096cc setup_new_exec (/lib/modules/4.17.0-rc1+/build/vmlinux)                       494f38 load_elf_binary (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40842c search_binary_handler (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40924c do_execveat_common.isra.13 (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40981c sys_execve (/lib/modules/4.17.0-rc1+/build/vmlinux)                        1b9e0 system_call (/lib/modules/4.17.0-rc1+/build/vmlinux)                 7fff9855b448 [unknown] ([unknown]) With only Suka's changes:     perf  9207  3034.786828:   cycles:ppp:                       10d66c power_pmu_enable (/lib/modules/4.17.0-rc1+/build/vmlinux)                       4096cc setup_new_exec (/lib/modules/4.17.0-rc1+/build/vmlinux)                       494f38 load_elf_binary (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40842c search_binary_handler (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40924c do_execveat_common.isra.13 (/lib/modules/4.17.0-rc1+/build/vmlinux)                       40981c sys_execve (/lib/modules/4.17.0-rc1+/build/vmlinux)                        1b9e0 system_call (/lib/modules/4.17.0-rc1+/build/vmlinux)                 7fff9855b448 [unknown] ([unknown]) With both Suka's and Sandipan's changes:      perf  9207  3034.786828:   cycles:ppp:                        10d66c power_pmu_enable (/lib/modules/4.17.0-rc1+/build/vmlinux)                        4096cc setup_new_exec (/lib/modules/4.17.0-rc1+/build/vmlinux)                        494f38 load_elf_binary (/lib/modules/4.17.0-rc1+/build/vmlinux)                        40842c search_binary_handler (/lib/modules/4.17.0-rc1+/build/vmlinux)                        40924c do_execveat_common.isra.13 (/lib/modules/4.17.0-rc1+/build/vmlinux)                        40981c sys_execve (/lib/modules/4.17.0-rc1+/build/vmlinux)                         1b9e0 system_call (/lib/modules/4.17.0-rc1+/build/vmlinux)                  7fff9855b448 [unknown] ([unknown])     perf_event_exec() is a valid entry, which is missing in last two output. Case 2: Without Suka's and Sandipan's changes:     1854.720942:     568814 cycles:ppp:          9cf3c _int_malloc (/usr/lib64/libc-2.26.so)          9f838 malloc (/usr/lib64/libc-2.26.so)            <===== This one              0 [unknown] ([unknown])            624 main (/home/ravi/Workspace/malloc)          236a0 generic_start_main.isra.0 (/usr/lib64/libc-2.26.so)          23898 __libc_start_main (/usr/lib64/libc-2.26.so) With only Suka's changes:     1854.720942:     568814 cycles:ppp:          9cf3c _int_malloc (/usr/lib64/libc-2.26.so)              0 [unknown] ([unknown])            624 main (/home/ravi/Workspace/malloc)          236a0 generic_start_main.isra.0 (/usr/lib64/libc-2.26.so)          23898 __libc_start_main (/usr/lib64/libc-2.26.so) With both Suka's and Sandipan's changes:     1854.720942:     568814 cycles:ppp:          9cf3c _int_malloc (/usr/lib64/libc-2.26.so)              0 [unknown] ([unknown])            624 main (/home/ravi/Workspace/malloc)          236a0 generic_start_main.isra.0 (/usr/lib64/libc-2.26.so)          23898 __libc_start_main (/usr/lib64/libc-2.26.so) malloc() is missing in last two output. Also, the pattern I've observed is, all samples where malloc() is missing is followed by  0 [unknown] ([unknown]). Thanks, Ravi