[3/3] perf scripts python: arm-cs-trace-disasm.py: do not ignore disam first sample
Message ID | 20231214123304.34087-4-tianruidong@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8507616dys; Thu, 14 Dec 2023 04:33:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpvOscEatlOeW7cjyCU8TLo+AKAr+eQqvsmfkua7EGxr2exLsm+0Msfxyv88rZNlpnN+uZ X-Received: by 2002:a05:6a20:1445:b0:190:cbe:9edd with SMTP id a5-20020a056a20144500b001900cbe9eddmr5590377pzi.54.1702557223871; Thu, 14 Dec 2023 04:33:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702557223; cv=none; d=google.com; s=arc-20160816; b=XoQlBXF09yrypD1wqlFEvq9Zfayx/PA/pQ4BrVlhlkeRM/l+6+RFlCm2rw1L6FDdcz WgTi8GOsLybH3l8wF5P0o4anc7AVJz7Z/kO7XPY9QBFhgsIFrrKdt0AVdKDq5CjyCaG3 +0PrhzsaCRRuU4iW7yPKyirlLGFxcBFw+gPplkHTU92m8rEtmVEa28SnFzWz+ScWFX49 xSGIRwCIvbYsPjdvHDUvx7SajCHqoudWbyt40Z84CHVClql6Y/iidnJeXFMMJzVVsiq4 ERkvPsv7gpbNJu44HxuKVnGEksFm21ZWvm6FF4Z5DnFngsDyJDLNKG4NzI1oiTlvSJuN siMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8aJ2YrOG+eFK2YK8clHoBBgwPHhC0BnzWnzziuEMjdA=; fh=2C1f0j/nzSygmX2ABc+8OQYD53hkUy28AVWbjAwc8E0=; b=RcZvSIIs8jej6oNIxESU/IzAjnuZAV6EfIMOaGyCE/MnzoLsKToGaogxTZkL5xVLxg QeJVBNZWXWgh9WZI6V/PC2Iku1vIQFE+hUDyoUcy12Rvljcd+Va+fL8WrjdchXplgy4l yj6g2UwDsUg1cYwOESd+RfqbBSHnpNJw8cf8EzxmFOv84srZu9E1HlhLD3gafzsIOnyV oycbrmkiM1MUuJAFmHi52XU0fQM9nxADUObTT5GbIaudsejydEnZTpAgEU75zdlNVtJQ su4l3w5WAWkY5Ex0qP3cfJgQDVYu/6BH4rVNeboT204nTK4Pt0g8VPjDzJqdbKFDI1jj tu9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z24-20020a17090ad79800b0028b185b0277si273564pju.42.2023.12.14.04.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:33:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 643A584AA9E7; Thu, 14 Dec 2023 04:33:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573088AbjLNMdZ (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Thu, 14 Dec 2023 07:33:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573081AbjLNMdX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Dec 2023 07:33:23 -0500 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88344116; Thu, 14 Dec 2023 04:33:28 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=tianruidong@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VyUMJ2Z_1702557203; Received: from localhost(mailfrom:tianruidong@linux.alibaba.com fp:SMTPD_---0VyUMJ2Z_1702557203) by smtp.aliyun-inc.com; Thu, 14 Dec 2023 20:33:26 +0800 From: Ruidong Tian <tianruidong@linux.alibaba.com> To: linux-kernel@vger.kernel.org Cc: james.clark@arm.com, coresight@lists.linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, alexander.shishkin@linux.intel.com, linux-arm-kernel@lists.infradead.org, adrian.hunter@intel.com, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, al.grant@arm.com, mathieu.poirier@linaro.org, tor@ti.com, acme@redhat.com, Ruidong Tian <tianruidong@linux.alibaba.com> Subject: [PATCH 3/3] perf scripts python: arm-cs-trace-disasm.py: do not ignore disam first sample Date: Thu, 14 Dec 2023 20:33:04 +0800 Message-Id: <20231214123304.34087-4-tianruidong@linux.alibaba.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20231214123304.34087-1-tianruidong@linux.alibaba.com> References: <20231214123304.34087-1-tianruidong@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 04:33:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785260643370599325 X-GMAIL-MSGID: 1785260643370599325 |
Series |
perf scripts python: arm-cs-trace-disasm.py:
|
|
Commit Message
Ruidong Tian
Dec. 14, 2023, 12:33 p.m. UTC
arm-cs-trace-disasm ignore disam the first branch sample, For example as
follow, the instructions beteween 0x0000ffffae878750 and
0x0000ffffae878754 is lose:
ARM CoreSight Trace Data Assembler Dump
Event type: branches:uH
Sample = { cpu: 0000 addr: 0x0000ffffae878750 phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 }
Event type: branches:uH
Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 }
Initialize cpu_data earlier to fix it:
ARM CoreSight Trace Data Assembler Dump
Event type: branches:uH
Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 }
0000000000028740 <ioctl>: (base address is 0x0000ffffae850000)
28750: b13ffc1f cmn x0, #4095
28754: 54000042 b.hs 0x2875c <ioctl+0x1c>
test 4003489/4003489 [0000] 26765.151766034 __GI___ioctl+0x14 /usr/lib64/libc-2.32.so
Event type: branches:uH
Sample = { cpu: 0000 addr: 0x0000ffffa67535ac phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 }
Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
---
.../scripts/python/arm-cs-trace-disasm.py | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
Comments
Em Thu, Dec 14, 2023 at 08:33:04PM +0800, Ruidong Tian escreveu: > arm-cs-trace-disasm ignore disam the first branch sample, For example as > follow, the instructions beteween 0x0000ffffae878750 and > 0x0000ffffae878754 is lose: Leo, Mathieu, Tor, Al, can you guys take a look and provide an Acked or Reviewed-by tag? Thanks, - Arnaldo > ARM CoreSight Trace Data Assembler Dump > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000ffffae878750 phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > > Initialize cpu_data earlier to fix it: > > ARM CoreSight Trace Data Assembler Dump > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > 0000000000028740 <ioctl>: (base address is 0x0000ffffae850000) > 28750: b13ffc1f cmn x0, #4095 > 28754: 54000042 b.hs 0x2875c <ioctl+0x1c> > test 4003489/4003489 [0000] 26765.151766034 __GI___ioctl+0x14 /usr/lib64/libc-2.32.so > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000ffffa67535ac phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > > Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com> > --- > .../scripts/python/arm-cs-trace-disasm.py | 21 ++++++++++--------- > 1 file changed, 11 insertions(+), 10 deletions(-) > > diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py > index c9e14af5b58c..b1eb4293cbef 100755 > --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py > +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py > @@ -190,6 +190,17 @@ def process_event(param_dict): > dso_end = get_optional(param_dict, "dso_map_end") > symbol = get_optional(param_dict, "symbol") > > + cpu = sample["cpu"] > + ip = sample["ip"] > + addr = sample["addr"] > + > + # Initialize CPU data if it's empty, and directly return back > + # if this is the first tracing event for this CPU. > + if (cpu_data.get(str(cpu) + 'addr') == None): > + cpu_data[str(cpu) + 'addr'] = addr > + return > + > + > if (options.verbose == True): > print("Event type: %s" % name) > print_sample(sample) > @@ -211,16 +222,6 @@ def process_event(param_dict): > if (name[0:8] != "branches"): > return > > - cpu = sample["cpu"] > - ip = sample["ip"] > - addr = sample["addr"] > - > - # Initialize CPU data if it's empty, and directly return back > - # if this is the first tracing event for this CPU. > - if (cpu_data.get(str(cpu) + 'addr') == None): > - cpu_data[str(cpu) + 'addr'] = addr > - return > - > # The format for packet is: > # > # +------------+------------+------------+ > -- > 2.33.1 > >
On 14/12/2023 12:33, Ruidong Tian wrote: > arm-cs-trace-disasm ignore disam the first branch sample, For example as > follow, the instructions beteween 0x0000ffffae878750 and > 0x0000ffffae878754 is lose: > > ARM CoreSight Trace Data Assembler Dump > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000ffffae878750 phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > > Initialize cpu_data earlier to fix it: > > ARM CoreSight Trace Data Assembler Dump > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000000000000000 phys_addr: 0x0000000000000000 ip: 0x0000ffffae878754 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > 0000000000028740 <ioctl>: (base address is 0x0000ffffae850000) > 28750: b13ffc1f cmn x0, #4095 > 28754: 54000042 b.hs 0x2875c <ioctl+0x1c> > test 4003489/4003489 [0000] 26765.151766034 __GI___ioctl+0x14 /usr/lib64/libc-2.32.so > Event type: branches:uH > Sample = { cpu: 0000 addr: 0x0000ffffa67535ac phys_addr: 0x0000000000000000 ip: 0x0000000000000000 pid: 4003489 tid: 4003489 period: 1 time: 26765151766034 } > > Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com> I noticed that this is for the missing second branch sample. Technically the first one is also still missing, but it doesn't have the origin set, only the destination, so I'm not sure if we need to do anything with it, but the first one always looks like this: 0 [unknown] ([unknown]) => ffff8a3b9100 _start+0x0 Followed by this one which you now generate the disassembly for: ffff8a3b9104 _start+0x4 (ld-2.31.so) => ffff8a3b9b80 _dl_start+0x0 Either way: Reviewed-by: James Clark <james.clark@arm.com> > --- > .../scripts/python/arm-cs-trace-disasm.py | 21 ++++++++++--------- > 1 file changed, 11 insertions(+), 10 deletions(-) > > diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py > index c9e14af5b58c..b1eb4293cbef 100755 > --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py > +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py > @@ -190,6 +190,17 @@ def process_event(param_dict): > dso_end = get_optional(param_dict, "dso_map_end") > symbol = get_optional(param_dict, "symbol") > > + cpu = sample["cpu"] > + ip = sample["ip"] > + addr = sample["addr"] > + > + # Initialize CPU data if it's empty, and directly return back > + # if this is the first tracing event for this CPU. > + if (cpu_data.get(str(cpu) + 'addr') == None): > + cpu_data[str(cpu) + 'addr'] = addr > + return > + > + > if (options.verbose == True): > print("Event type: %s" % name) > print_sample(sample) > @@ -211,16 +222,6 @@ def process_event(param_dict): > if (name[0:8] != "branches"): > return > > - cpu = sample["cpu"] > - ip = sample["ip"] > - addr = sample["addr"] > - > - # Initialize CPU data if it's empty, and directly return back > - # if this is the first tracing event for this CPU. > - if (cpu_data.get(str(cpu) + 'addr') == None): > - cpu_data[str(cpu) + 'addr'] = addr > - return > - > # The format for packet is: > # > # +------------+------------+------------+
diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py index c9e14af5b58c..b1eb4293cbef 100755 --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py @@ -190,6 +190,17 @@ def process_event(param_dict): dso_end = get_optional(param_dict, "dso_map_end") symbol = get_optional(param_dict, "symbol") + cpu = sample["cpu"] + ip = sample["ip"] + addr = sample["addr"] + + # Initialize CPU data if it's empty, and directly return back + # if this is the first tracing event for this CPU. + if (cpu_data.get(str(cpu) + 'addr') == None): + cpu_data[str(cpu) + 'addr'] = addr + return + + if (options.verbose == True): print("Event type: %s" % name) print_sample(sample) @@ -211,16 +222,6 @@ def process_event(param_dict): if (name[0:8] != "branches"): return - cpu = sample["cpu"] - ip = sample["ip"] - addr = sample["addr"] - - # Initialize CPU data if it's empty, and directly return back - # if this is the first tracing event for this CPU. - if (cpu_data.get(str(cpu) + 'addr') == None): - cpu_data[str(cpu) + 'addr'] = addr - return - # The format for packet is: # # +------------+------------+------------+