From patchwork Mon May 28 08:45:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 137035 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2560357lji; Mon, 28 May 2018 01:46:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoWUjZT/+4oY/MUFuimSwRdRgQ6kNnGgEloQukpIQgNyOixRC1N2oFKM1WxYnWT2WvT2/Ka X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr12813042plb.14.1527497177260; Mon, 28 May 2018 01:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527497177; cv=none; d=google.com; s=arc-20160816; b=sKMEon1c+ZupiUO+ihObnwxRxwvKX6aAyK/XIZoizjw/okfOQqGs3JjBcHAr+yPiSg PXyGuIgKnYWLShDSYXLBlnlgxYJa+pDybnEMnviy/8hNqYNBJrzep8r7H/GL2HvtAPFq 6jT1jJ6hu2UPcPxPCGUm5HbzpRTAf9w0HygGP0CuKN7by85rTKvIdaMSoE16upuc7opY YdyGYezw3nfiNrvh7v8tq3FNZ7NYaHJ1oUGip5vqM7PvdBF1Tc/6CxLfbb+kiGnw+UON 4jTRDLq7gBMYRntolxDLCv8+kx0qFgVWar3x8rIg7v/zqMOU1YPNqFsTp8I4Xo6h2Iqi ueZA== 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=qRTrCHfdNdOMOBF4q/n9Wd+llY/BUP1xGOHxe5Jv3XYybBhJNGawXLkZHN9fxtxBf6 saaXTOYFKmOm9ess8EyfWKF1p9WwtSNhVKfB+d7YAnYEztXTgj0LaUZiwqaOslbbyQfS woHFqbbqseQYJLsecbt3CZ/cMMJLMOKFkdY9heoFo6rgsTao/L7I8buPwxASMvWCo0Rd dQS3p+Yx7djxQFvHr5NceCrKy1yP50Afp52zSipxmEZtSddCgvP6ec46k4GR02qkvteg IET6cf8FKMZ8NGyocydm+JmLV7qHdASARho1rMp843BlnrTJNVRdKrzsTGjDKXMOkZ8k tTzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b1orCH8M; 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 l70-v6si30287773pfk.129.2018.05.28.01.46.16; Mon, 28 May 2018 01:46:17 -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=b1orCH8M; 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 S1754130AbeE1IqP (ORCPT + 30 others); Mon, 28 May 2018 04:46:15 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37109 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933163AbeE1IqE (ORCPT ); Mon, 28 May 2018 04:46:04 -0400 Received: by mail-wm0-f67.google.com with SMTP id l1-v6so30021499wmb.2 for ; Mon, 28 May 2018 01:46:04 -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=b1orCH8MJwaXP08XQQNpfqozC/WlgS86Zjhn020ibietnYcIa0mzJPKcXpguquzIaj 6C1qUczNM6P3v2Q+iAhOfE9eoGSLy317ULJ5hBYidaBrxomBtJtkOurr4BOXDx2uWx11 bakhbqiAWmuYxJ0XyRdYhzn85Xwb5WepY9HtE= 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=UvkGbFEjoEHQCdWHTYALLMwnwVj8/hGsecCKitJXTyGCxo/XpgDBmD3qyOdpylFuos oR+hQGaUC+9unHvin3+WaNMCevXOMcsVu5rC8TW2EE37R2bMCZtYxXvuim/XN169xk9v wXWjd+o7MFs77x72rJ6YZsyd2C9U10Dsxj1wcFEYlDgN1NWNTVJ3GjGIodniZgSJSkhf r3Ohe1bowgUjgp9GaTidAtdMAapGmubvhfioE0dERC33FjLgwR36QrKenVNT/4cpHXEv 6Z8cUt1nTgL6/8McIk+lCw3VuEsGZkHhjrtHzlYyVRLdymaonT9eOBoSgplR30PuiTfC APYA== X-Gm-Message-State: ALKqPwfUguLMF3AX5pBtLu5HEnXsmwrd9r4GPQWw0XU4/UobGm7i7uyt 8I2oZv9QcWqvijdb60QNOLDfRQ== X-Received: by 2002:a1c:da13:: with SMTP id r19-v6mr9019079wmg.2.1527497163176; Mon, 28 May 2018 01:46:03 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 May 2018 01:46:02 -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 4/4] coresight: Document for CoreSight trace disassembler Date: Mon, 28 May 2018 16:45:03 +0800 Message-Id: <1527497103-3593-5-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527497103-3593-1-git-send-email-leo.yan@linaro.org> References: <1527497103-3593-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