From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757911AbcHCMGm (ORCPT ); Wed, 3 Aug 2016 08:06:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55089 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757775AbcHCMGQ (ORCPT ); Wed, 3 Aug 2016 08:06:16 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: ravi.bangoria@linux.vnet.ibm.com Subject: Re: [PATCH] perf uprobe: Skip prologue if program compiled without optimization To: Masami Hiramatsu References: <1470041368-5442-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com> <20160802235230.31bb9a50d88e4838926f5609@kernel.org> Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, wangnan0@huawei.com, hemant@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, Ravi Bangoria From: Ravi Bangoria Date: Wed, 3 Aug 2016 14:32:00 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160802235230.31bb9a50d88e4838926f5609@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16080309-0056-0000-0000-000000F3DB7A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005546; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000177; SDB=6.00739334; UDB=6.00347586; IPR=6.00511925; BA=6.00004641; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012132; XFM=3.00000011; UTC=2016-08-03 09:02:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16080309-0057-0000-0000-0000050E18F8 Message-Id: <57A1B308.7070606@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-03_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1606300000 definitions=main-1608030090 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks Masami, On Tuesday 02 August 2016 08:22 PM, Masami Hiramatsu wrote: > On Mon, 1 Aug 2016 14:19:28 +0530 > Ravi Bangoria wrote: > >> Function prologue prepares stack and registers before executing function >> logic. When target program is compiled without optimization, function >> parameter information is only valid after prologue. When we probe entrypc >> of the function, and try to record function parameter, it contains >> garbage value. >> [SNIP] >> + >> + /* Only FUNC and FUNC@SRC are eligible. */ >> + if (!pp->function || pp->line || pp->retprobe || pp->lazy_line || >> + pp->offset || pp->abs_address) >> + return; >> + >> + /* Not interested in func parameter? */ >> + if (!pf->pev->nargs) >> + return; > Hmm, this is not enough, since perf-probe accepts registers and stacks. > At least you should check if all argument are !is_c_varname(), !PROBE_ARG_VARS and > !PROBE_ARG_PARAMS here, instead of checking nargs. > >> + >> + pr_info("Target program is compiled without optimization. Skipping prologue.\n" >> + "Use %s:1 or absolute address 0x%lx to force probe on entry point.\n\n", > Hmm, is :1 always available? I think we should just recommend to use only > the address. > (moreover, pf->addr may not the absolute address in uprobe event, we'd better say > "the address 0x%x") Nice catch. :) Sent v2. Please review it. -Ravi