From patchwork Mon May 21 08:52:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 136436 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp51938lji; Mon, 21 May 2018 01:54:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq+53Bt4/BgAzUTiYbbSmCiZNjwHF6jixg+w75u1eiBmOZ3Q8cJM905SiJR8z4LImhSqMjF X-Received: by 2002:a62:11dc:: with SMTP id 89-v6mr19273651pfr.18.1526892848888; Mon, 21 May 2018 01:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526892848; cv=none; d=google.com; s=arc-20160816; b=v2mWu6ECVnBaEx5b4izqBDa3VSYGksnzKlh4HTTVimUdV50C9hgMHqzrv5T1OEU7oI +wVKEnfIituvCCBFBaUpcMm8UOdfjQwoFINvMLwonPu2cFj5MFLT+YW1udxqh31eRa2j xkX+vKd59R6ewC6x+ifl/T1ukUh0FzotURZrkpBsoFyZQvvlRqXNc5gKaYSCFoV8lSEj SY1++7hOBvzWVDRBEX1eDhiFXcHJnjXo/V5aIC1GU6KbBZf/+NnPiifTWZF/RlQxEvq0 4Uyu8tMAAhDAuvoLawyqONfx/YJE3QQG+7TnrzDj36hoBmyJYKEqYh3CCfIx+hHv7aHT EBxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NnN/fhGrSR8SrEds0HmRI/5r4C+zJoMVSRbsuhZ0Y3Y=; b=BvTAUHmr7CTcp9ysGqHpYL0vdz7HSvbm/Upx12KaKL7ZQDOsVxLMCslSotLrxuhnHY glBjrMnaz/fyU2vN1HIREPqH0owJSsGs+FifH+L8ujluWHBvdGxtEXeJrNc2mZZwO/iS dRjLPDxalkzE8vEaj8+kgk0u7J7VNzcBLKJEISBR0yhxKZFkFE88S+wt7CFKvFEXFEz4 8oMsnoQuw5KVKNfDUZF+0wrUL3+sevOPxycmxSf8M33FWwLLft1HSx2aGHUuDzwrMydG AcI3MJdT2jnz55ENBiVXDcOhde+wtRb3QjrB+ZXxZ7CB2/qWbl2ynn47ACnNp4gN5FnV p/EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Myu1ilwl; 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 32-v6si13855641ple.319.2018.05.21.01.54.08; Mon, 21 May 2018 01:54:08 -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=Myu1ilwl; 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 S1752605AbeEUIyE (ORCPT + 29 others); Mon, 21 May 2018 04:54:04 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:41248 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbeEUIyA (ORCPT ); Mon, 21 May 2018 04:54:00 -0400 Received: by mail-pf0-f193.google.com with SMTP id v63-v6so6755813pfk.8 for ; Mon, 21 May 2018 01:53:59 -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:in-reply-to:references; bh=NnN/fhGrSR8SrEds0HmRI/5r4C+zJoMVSRbsuhZ0Y3Y=; b=Myu1ilwl1cX/e+DgnWHGowuOZYQcc6J3QGoDMvIwz8KULGpSPGEGOAOjk1nTuMV3cD QQfkeldDdwlzhz2PclCVUIhdvyp8CWM1WUyTZ/K4pzsiGXQhOC8nT3PIAgmuwc7FPEwR wR/4tdETaXc15BMZOUuWfTLJDWbYghUMbQqIE= 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:in-reply-to :references; bh=NnN/fhGrSR8SrEds0HmRI/5r4C+zJoMVSRbsuhZ0Y3Y=; b=J4hb+Rj0Hgit9qqhrZ0ZBUfh1bWK0aSbol48HtEC6yN0uHqbDRGdnNMeuWPAw8gbyg OWkOYPHiuWitL2nRCnwmZJf1uA42nw7KGqQOSkicSkBsziPSp1XCf+XD6RHvHjeOlmXC wR2nUHgeLt23FreBO1FReiCiUVdGiVqxYN4S4IIQ9ayRVlaDB5wAb4X26INpsyIThSI/ 4SRSrHGtwTROA03pw1FWPDSB8WJOkdrbBOU/YZ3URe7AdDxDDNelbvS4lIwMHEcN9yFf r86HBgfWPrYPP8kkEAcOAckm+KqC5hqtzV+CfS1lr2N7nBLxZmIhbTSTNmGuQfjsKLTA Wvfw== X-Gm-Message-State: ALKqPweiRS2GKN4XfL2/yPcBLdlHr+pmxVDq5PYiKPMIhfcXIwXnqfEG VNnSlli3478xeniU4fFWnSTKcQ== X-Received: by 2002:a62:9d89:: with SMTP id a9-v6mr19171509pfk.206.1526892839364; Mon, 21 May 2018 01:53:59 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 May 2018 01:53:58 -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 4/4] coresight: Document for CoreSight trace disassembler Date: Mon, 21 May 2018 16:52:28 +0800 Message-Id: <1526892748-326-5-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526892748-326-1-git-send-email-leo.yan@linaro.org> References: <1526892748-326-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit documents CoreSight trace disassembler usage and gives example for it. Signed-off-by: Leo Yan --- Documentation/trace/coresight.txt | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) -- 2.7.4 diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt index 6f0120c..b8f2359 100644 --- a/Documentation/trace/coresight.txt +++ b/Documentation/trace/coresight.txt @@ -381,3 +381,55 @@ sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tuto $ taskset -c 2 ./sort_autofdo Bubble sorting array of 30000 elements 5806 ms + + +Tracing data disassembler +------------------------- + +'perf script' supports to use script to parse tracing packet and rely on +'objdump' for disassembled lines, this can convert tracing data to readable +program execution flow for easily reviewing tracing data. + +The CoreSight trace disassembler is located in the folder: +tools/perf/scripts/python/arm-cs-trace-disasm.py. This script support below +options: + + -d, --objdump: Set path to objdump executable, this option is + mandatory. + -k, --vmlinux: Set path to vmlinux file. + -v, --verbose: Enable debugging log, after enable this option the + script dumps every event data. + +Below is one example for using python script to dump CoreSight trace +disassembler: + + $ perf script -s arm-cs-trace-disasm.py -i perf.data \ + -F cpu,event,ip,addr,sym -- -d objdump -k ./vmlinux > cs-disasm.log + +Below is one example for the disassembler log: + +ARM CoreSight Trace Data Assembler Dump + ffff000008a5f2dc : + ffff000008a5f2dc: 340000a0 cbz w0, ffff000008a5f2f0 + ffff000008a5f2f0 : + ffff000008a5f2f0: f9400260 ldr x0, [x19] + ffff000008a5f2f4: d5033f9f dsb sy + ffff000008a5f2f8: 913ec000 add x0, x0, #0xfb0 + ffff000008a5f2fc: b900001f str wzr, [x0] + ffff000008a5f300: f9400bf3 ldr x19, [sp, #16] + ffff000008a5f304: a8c27bfd ldp x29, x30, [sp], #32 + ffff000008a5f308: d65f03c0 ret + ffff000008a5fa18 : + ffff000008a5fa18: 14000025 b ffff000008a5faac + ffff000008a5faac : + ffff000008a5faac: b9406261 ldr w1, [x19, #96] + ffff000008a5fab0: 52800015 mov w21, #0x0 // #0 + ffff000008a5fab4: f901ca61 str x1, [x19, #912] + ffff000008a5fab8: 2a1503e0 mov w0, w21 + ffff000008a5fabc: 3940e261 ldrb w1, [x19, #56] + ffff000008a5fac0: f901ce61 str x1, [x19, #920] + ffff000008a5fac4: a94153f3 ldp x19, x20, [sp, #16] + ffff000008a5fac8: a9425bf5 ldp x21, x22, [sp, #32] + ffff000008a5facc: a94363f7 ldp x23, x24, [sp, #48] + ffff000008a5fad0: a8c47bfd ldp x29, x30, [sp], #64 + ffff000008a5fad4: d65f03c0 ret