From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753851AbdK2JOx (ORCPT ); Wed, 29 Nov 2017 04:14:53 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56972 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753516AbdK2JOp (ORCPT ); Wed, 29 Nov 2017 04:14:45 -0500 Subject: Re: Question to perf annotate handling mov ...(%rip) instructions To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Linux Kernel Mailing List , "linux-perf-use." References: <20171128145030.GG3298@kernel.org> From: Thomas-Mich Richter Organization: IBM LTC Date: Wed, 29 Nov 2017 10:14:37 +0100 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: <20171128145030.GG3298@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-IE Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17112909-0040-0000-0000-000003F3D545 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17112909-0041-0000-0000-000025F6B66B Message-Id: <64422ec4-d081-0f0e-9b0c-c5b7d566da85@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-29_03:,, 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=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711290116 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/28/2017 03:50 PM, Arnaldo Carvalho de Melo wrote: ..... >> .... >> 60b4: 48 8b 05 35 cd 22 00 mov 0x22cd35(%rip),%rax # 232df0 <__gmon_start__> >> >> Commit 6de783b6f50f7f1db18a3fda0aa34b2e84b5771d ("perf annotate: Resolve symbols >> using objdump comment") added this support. >> >> Special code for Intel platform handles the mov at address 60b4: >> This is dynamic linkage against the PLT. Function mov__parse() is always called >> to parse the objdump comment following the '#' character. >> However the function mov__scnprintf() to replace the text '0x22cd35(%rip)' by the >> target function name __gmon_start__ is only called in tui mode and not in stdio mode. >> >> Now to the confusion: >> Function mov__parse() calls comment__symbol() which contains: >> >> static int comment__symbol(char *raw, char *comment, u64 *addrp, char **namep) >> { >> char *endptr, *name, *t; >> >> if (strstr(raw, "(%rip)") == NULL) >> return 0; >> >> This is architecture specific and does not work for non-Intel platforms. >> >> I would like to fix perf annotate for s390x and above move instruction on s390x >> is >> >> 655a: c0 10 00 01 9c eb larl %r1,39f30 <__gmon_start__> >> >> There is a need to handle PLT resolution in an architecture independent way. >> >> Ideas and suggestions? > > Some historical background there, busy now, but you seem to be on the > right track and IIRC you already sent a patch for this, right? I'll try > to look at it. The two patches I sent are unrelated to this issue. > Jiri may as well, since he worked a lot recently in this codebase, to > refactor it some more to make it useful for annotating python code, perl > next, other scripted languages should follow too. -- Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany -- Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294