From patchwork Mon May 28 08:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 137031 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2559898lji; Mon, 28 May 2018 01:45:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoptMdKUOxvifclrU9bLayiNOiF3zxbbVkOyY90zsHRcZQX8ZBNQB5yoI2bwLKu4KUvEYpO X-Received: by 2002:a63:7c0b:: with SMTP id x11-v6mr9732601pgc.384.1527497141956; Mon, 28 May 2018 01:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527497141; cv=none; d=google.com; s=arc-20160816; b=kXYLHEnS5Eeymrv9lijF1NpdpFIIBk6ovTV9uLKbL9t/X738DtdabDw+97iW0zFUxE WBrubvyr0VcwzLzFX/hyL2ZZgRQwhhLJCaBalAZqQcTMXGvz9m/0V52b+prUVK+hi7fT EMCcx0ZIRmwr6jmgrDzAOZcPqPEWCLd6PWbKRIHAKroajV3rtauI5YmWREGE74RUuwjv XXphq8IIKoQ46+HVoWOcBgttQs2QkLWef05bcAy6ZCeoQDTBeE6EUB9LBlTEz4W98iIl UtiZRRScNV9UJKr6pCMu2bHKeMIZ1qh64+B72kEhnsluCgrjtlXk8JR5xDaZN7c7ZuKX xh7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Jcv36zqK5z4CBDKrfpSmhF6yClhbmwK2Wy9b+M/nBZ0=; b=tmlfIC6RfMuDg2EdrUpzrdAQTFwmowgDQozPQh5T8CAaqDgsV7hz4j7ca61mnI9YYS GaEFaCyZYGcsIhAyxwg88S1/HCEA+Sr+H3KpStX5jiWCEbs3AKiPtNujmK1jNd8anRM0 Tv6dgDVm3jmopzNNKZvryiE8hiHMCdCzU6LvO62vO31hDcS5QWLKcxpNF6ONz4MphGgn T3v4gBSkPXdqQ+wU2WYskeKE4LWDyIDqpCe7qL31ZhejPMOjtYmtRkJoIfdCXiiWBpB8 YdawSyGm+9QNYS2+TjfmlmseJ9GrMPnBStfPyzd/Nx/25/nzkO8Ys5H+nvHKAgd0HqcG yHAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b3M4Z/99; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si5702765pgq.65.2018.05.28.01.45.41; Mon, 28 May 2018 01:45:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=b3M4Z/99; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754124AbeE1Ipj (ORCPT + 30 others); Mon, 28 May 2018 04:45:39 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35453 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754029AbeE1Ipg (ORCPT ); Mon, 28 May 2018 04:45:36 -0400 Received: by mail-wm0-f43.google.com with SMTP id o78-v6so30048114wmg.0 for ; Mon, 28 May 2018 01:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Jcv36zqK5z4CBDKrfpSmhF6yClhbmwK2Wy9b+M/nBZ0=; b=b3M4Z/995/1LcmA+1WeaiC+zvqd3mTSrG8Nv8VC7dHn6iyS98er1K3MfBilu1guj7M bJO7/I/UtEoB3TzRo31YhWLLQqDJ77nUQFGgsf6VEPJ3nzogsreHE+E/vpfByQdMqKhx my1AtWYe0UgXoe/vm5vFf1ijjF8IGsZmBFmqI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Jcv36zqK5z4CBDKrfpSmhF6yClhbmwK2Wy9b+M/nBZ0=; b=EGtaVBAaw5KiD63oqXeY1HmuSYBndxco+ksI6tYCClwfhZ/6PzkJM5MPVJts66zdPY jUG7j6UW/C1ksaAf34z7GXorodvQ5/MxKr7by+Q00dJlXEDMR/gQaTJR1Rfdh1iKvxPa Mge49g4wu4SAXBUiAuzJ4Q7LMHS/lXebyvK1ommKKWOovT4c5sUqHuDCb1xuh+JmTB5j dG+t1pS0UjMX1xI7ejc3UV3SS1u+BlQIaByRC63LA5HhDW0SH816sJVGZbeEJdSV/1pE YQ2KZtUSCl+XTIdp4h4w43IaeAJWiuvmIVNN6Xf2BMFI1IBKuWVV+OK7pQ3c4mXNsIP1 aqBw== X-Gm-Message-State: ALKqPweNGWWYddt38Ma6OuN/Jw98MfEeASz2SYdcz9Yi8iffp+o8fba8 1ke8tXP7ZyL2rZVR5DHIs2lK0Q== X-Received: by 2002:a1c:b109:: with SMTP id a9-v6mr7096006wmf.18.1527497134835; Mon, 28 May 2018 01:45:34 -0700 (PDT) Received: from localhost.localdomain ([45.76.138.171]) by smtp.gmail.com with ESMTPSA id 123-v6sm21783013wmt.19.2018.05.28.01.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 May 2018 01:45:33 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Jonathan Corbet , Robert Walker , mike.leach@linaro.org, kim.phillips@arm.co, Tor Jeremiassen Cc: Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, Leo Yan Subject: [RFT v3 0/4] Perf script: Add python script for CoreSight trace disassembler Date: Mon, 28 May 2018 16:44:59 +0800 Message-Id: <1527497103-3593-1-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series is to support for using 'perf script' for CoreSight trace disassembler, for this purpose this patch series adds a new python script to parse CoreSight tracing event and use command 'objdump' for disassembled lines, finally this can generate readable program execution flow for reviewing tracing data. Patch 0001 is one fixing patch to generate samples for the start packet and exception packets. Patch 0002 is the prerequisite to add addr into sample dict, so this value can be used by python script to analyze instruction range. Patch 0003 is to add python script for trace disassembler. Patch 0004 is to add doc to explain python script usage and give example for it. This patch series has been rebased on acme git tree [1] with the commit 19422a9f2a3b ("perf tools: Fix kernel_start for PTI on x86") and tested on Hikey (ARM64 octa CA53 cores). In this version the script has no dependency on ARM64 platform and is expected to support ARM32 platform, but I am lacking ARM32 platform for testing on it, so firstly upstream to support ARM64 platform. This patch series is firstly to support 'per-thread' recording tracing data, but we also need to verify the script can dump trace disassembler CPU wide tracing and kernel panic kdump tracing data. I also verified this patch series which can work with kernel panic kdump tracing data, because Mathieu is working on CPU wide tracing related work, so after this we need to retest for CPU wide tracing and kdump tracing to ensure the python script can handle well for all cases. You are very welcome to test the script in this patch series, your testing result and suggestion are very valuable to perfect this script to cover more cases. Changes from v2: * Synced with Rob for handling CS_ETM_TRACE_ON packet, so refined 0001 patch according to dicussion; * Minor cleanup and fixes in 0003 patch for python script: remove 'svc' checking. Changes from v1: * According to Mike and Rob suggestion, add the fixing to generate samples for the start packet and exception packets. * Simplify the python script to remove the exception prediction algorithm, we can rely on the sane exception packets for disassembler. Leo Yan (4): perf cs-etm: Generate branch sample for missed packets perf script python: Add addr into perf sample dict perf script python: Add script for CoreSight trace disassembler coresight: Document for CoreSight trace disassembler Documentation/trace/coresight.txt | 52 +++++ tools/perf/scripts/python/arm-cs-trace-disasm.py | 235 +++++++++++++++++++++ tools/perf/util/cs-etm.c | 93 ++++++-- .../util/scripting-engines/trace-event-python.c | 2 + 4 files changed, 362 insertions(+), 20 deletions(-) create mode 100644 tools/perf/scripts/python/arm-cs-trace-disasm.py -- 2.7.4