From patchwork Mon May 21 08:52:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 136432 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp51658lji; Mon, 21 May 2018 01:53:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpM9zfemgLMRM9XbiGU6Bblfg82BuAmS18aIOe6qXOIKkIdzfHhY8JtSvN7zwpcsa2DQBAW X-Received: by 2002:a17:902:bf4a:: with SMTP id u10-v6mr20029863pls.322.1526892823014; Mon, 21 May 2018 01:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526892823; cv=none; d=google.com; s=arc-20160816; b=BO4Z4tKXureooEnUN0dFnNPL+j982WBmzRJjlDbgbtu96N3z93gFEWPWuxYO+z3KQY sLt68G7KM6dbEGNWK3jlqBN4LTtVUkF3qRDp2ZlWHr/htR7n1l37XmnVZ2Km8A8+BUOa p1Dv/+gPSnlu/fREB7Gtz3BW5AI2z/meyQEcjK46ofPOTmgVFIXzd3FX76MqkyG0Hx9d Nb5pLzBCCxss47uSjs2D/1zTmEksNi4IcDawYEQuf0RVLWkHC10PM+LWhHS6FJsPKsyy 4aTLjPPP/UhWCbOM2g6aCE483kATOHVcTYT36fG+k7zOFrm5eMLHYj5MOlcxTvoqblK1 CU3A== 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=7HNfZFmkg7H2Dsk1KDP61dJ//0n7TfGIrRFVLHVIUGw=; b=o1NDVRKhMkiMddVncv+V0tJ8STtOTmJady71pPMz2VMp+RT/wNwT9OH50Os141USsM EOOkQvzO+9Izgam4VuWCbBHEO2ZWw2BZwbVz4cPxdFB9ar4ASuAZMdYkn5bytnKGCFI5 AgtRUbXIzpknjCwQPKLP/VQQzQQteN62bZu24S4gFBFj4ghQDFqKLNJAH8BfxlRbnBNk KgAMN5CQU9Dy8qfLVpZN7K+5KBx+0XaEfTS/mw1ZHtGFqmakDLEwfHROMf0xSBh4sCgX 6NktGWFlEH0tPbMfb4V4r50uo4oo/9Qk0Mw2CbYHM8O6ub5Fz4g6KTZnSeI4/4pdKxNK 892Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BMk7NoVH; 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 m2-v6si9247179pgc.588.2018.05.21.01.53.42; Mon, 21 May 2018 01:53:42 -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=BMk7NoVH; 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 S1751639AbeEUIxk (ORCPT + 29 others); Mon, 21 May 2018 04:53:40 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:43887 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbeEUIxg (ORCPT ); Mon, 21 May 2018 04:53:36 -0400 Received: by mail-pg0-f54.google.com with SMTP id p8-v6so6068228pgq.10 for ; Mon, 21 May 2018 01:53:36 -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=7HNfZFmkg7H2Dsk1KDP61dJ//0n7TfGIrRFVLHVIUGw=; b=BMk7NoVHQzrpmWA45Ejw3uTfudT6ayf1MAKS0W/pgmRFdHbHvNvEL2Mc40nG4VbfYW n0OmTOYxHvAe+e67JWUi0/xoz1UDTc/4OffOZlBb1pTZlxHrPLgXcPAUDFvUxVuC4eol LhKIqLWJYTSBXERSiw6V3MEpYrOV9CJCw6dPQ= 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=7HNfZFmkg7H2Dsk1KDP61dJ//0n7TfGIrRFVLHVIUGw=; b=mWPfzY/m6GxdA3GECsij+6hPlT5uS5yOPycPGlTeCzaFKkKywSSFhZQiz/aASnr1lr fOMWdZMjjTFXLJisqjBkbG9TxNlgeJHoS1fgajmOa/1rfmfZfOtcbVULhy5adprcO/Nu sI4RZcxkPu6/Rv2pyIjQ16VfEy8RJ2oIwmsV4IjNeE0T/vYELSYZbk2EGOwC09Kq8RH/ pZsKIXFq9WXVS8N56PLBS1WxrCKvvFw8yVi1r0tlhrZbZbxp5lFr60txYnhCfTBRTKyU lVpmIMUfJkYld6WfoR1NLjA1n1TQNrnuE0DBHiP4DsfoNX25DkQpQMPppgoz05XpzCJb QZjA== X-Gm-Message-State: ALKqPwfVky6PJqvnQeECQeCHl7UXBPYqUVck7xtVCg+45+UnFLM7BSPT XIrxldQ2BMxNAW5zlNlOpt1dUQ== X-Received: by 2002:a62:e107:: with SMTP id q7-v6mr19105268pfh.226.1526892815536; Mon, 21 May 2018 01:53:35 -0700 (PDT) Received: from localhost.localdomain (li1209-69.members.linode.com. [45.79.110.69]) by smtp.gmail.com with ESMTPSA id 16-v6sm28553918pfq.115.2018.05.21.01.53.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 May 2018 01:53:34 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Jonathan Corbet , 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, Tor Jeremiassen , mike.leach@linaro.org, kim.phillips@arm.com, Robert Walker , coresight@lists.linaro.org Cc: Leo Yan Subject: [RFT v2 0/4] Perf script: Add python script for CoreSight trace disassembler Date: Mon, 21 May 2018 16:52:24 +0800 Message-Id: <1526892748-326-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 last 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 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. [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git Leo Yan (4): perf cs-etm: Generate 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 | 234 +++++++++++++++++++++ tools/perf/util/cs-etm.c | 35 ++- .../util/scripting-engines/trace-event-python.c | 2 + 4 files changed, 316 insertions(+), 7 deletions(-) create mode 100644 tools/perf/scripts/python/arm-cs-trace-disasm.py -- 2.7.4