From patchwork Sat Jan 19 01:43:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 156109 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3903575jaa; Fri, 18 Jan 2019 17:44:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN57PcJGylFZPNKRdi6Qu0tKyHpB0h6sTK4bx7ZlkcbIU0Mzg5UzID/+V7dlTmVlYq7FBTj8 X-Received: by 2002:a63:f141:: with SMTP id o1mr20356545pgk.134.1547862269883; Fri, 18 Jan 2019 17:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547862269; cv=none; d=google.com; s=arc-20160816; b=lrD/E7E7Ma5LvSCdI6w3xodyd1StK2ST695OE+JDeFnk+j5QrTmuUXdYgXT6Ep59Hu J68qILER066g3+5W5hZu/AHtkcxgwGR8BZHaL3ya+x8S6qnadjjdc3hv0424mvCTZoJd +Vi8YqAaBh1/dclSaqefVGe910bXSHaJJRiud6XN1Cjy1vnVxfoW9SnsNH7SncaaZHCY 0RqwsqeLF3HtTuHXmSrdTtHxRRewkDLquzDPtpmOjGoH+SWLc7eXuotGMbYHiWRmA8v5 DqX9Zvq6d9UStXJjlv5zOeV84NQW8ytkQ4MEF5834AZksIRbWIjhCTvOxXjounBD0ACq UdDw== 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; bh=jETu+BduxrzXdBTSoIHDOv28Ri7iXymF5DJaIor1gtI=; b=dz0bxG0OTapGLGTwblvL/Ta/mGPoLyyyufaTSpLS6SAkTMqN5hM5EjcT4VhRKsJ1EL R4W0N0wTgULFM+sxq74mhOXXRdS6x398uanq+ZidRskSCNRgKQ/nWh4A9dS7skC16l4c WFAO1me4dGwvfFWrNNpv1sohw67foM50bvTFbqBdP0ePW4Vx7e4UrFwSi+r1C015jCIZ YSP5gp9niBXYOiwoe8uTMwSdmDBsFo4WgvjTrywWeqlHf/Avel/OyGHDd3QZCk25qJev olsQ30+Xgbq1aVAP2WxCfes/wb6nXuMW85yOfntaaVME7EzTUrkjnYFepmtWsNm4eP+g d1zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UJR/ZDiL"; 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 o68si6904714pfo.140.2019.01.18.17.44.29; Fri, 18 Jan 2019 17:44:29 -0800 (PST) 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="UJR/ZDiL"; 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 S1729920AbfASBoK (ORCPT + 24 others); Fri, 18 Jan 2019 20:44:10 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44095 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727713AbfASBoK (ORCPT ); Fri, 18 Jan 2019 20:44:10 -0500 Received: by mail-pg1-f196.google.com with SMTP id t13so6856536pgr.11 for ; Fri, 18 Jan 2019 17:44:09 -0800 (PST) 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=jETu+BduxrzXdBTSoIHDOv28Ri7iXymF5DJaIor1gtI=; b=UJR/ZDiLrjsIi9UcHwH4vY5U6Z90QraRTn+RRpSe4uSHbu8vCGNQiDKM6DoVc7aJoU 9deaQGz1NS/r9W8SPTrMsbninLi8UUuIVDTKQ0/eo21TQ4WaMoF4BdRzhKmdgklUljK/ ZjkVKboyhwsZShHi77LZBbotd/1pNsLp0lXdM= 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=jETu+BduxrzXdBTSoIHDOv28Ri7iXymF5DJaIor1gtI=; b=cR7kck29VPueE875yHJF2PE3j5Vs8romOmeJzavHFjSTk5F8NlquWofRe4qEHYCG4a HYItyg1T6q3zBam5Sg37LWXjOqM5rIFYLK13ncO/tGeif8B37/09dW5U1fqAgBBkMLdg K9JGGadlkqgMYdjC2ZUcvGFWW/b5/VX8hvvf7cvuOBpFCMOPXOo7+fX2u9FXN5eEUn86 W0B6oXzVDrq9KHfYg0D1ayFztggIwy38/i0SvBmHBlYPni07Pd7cSY8f7OGpvQ4+AZMc P++4pBB5w+7sp9tt7ypBzXKZ+MmV/+GCgBAlI/Wn6nypoEzGhG6XpyVxz8wrrTGIZFDy AnDQ== X-Gm-Message-State: AJcUukeA/eRFostUQypQx5AVsVm/J2cIv7S1C0wIMc0sdP2iOrxq2H+M mI+/Gu1XC7jSdRWtBeGJGsf5UQ== X-Received: by 2002:a62:6204:: with SMTP id w4mr21762120pfb.5.1547862249054; Fri, 18 Jan 2019 17:44:09 -0800 (PST) Received: from localhost.localdomain (li421-24.members.linode.com. [50.116.3.24]) by smtp.gmail.com with ESMTPSA id d21sm8648436pfo.162.2019.01.18.17.44.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 17:44:08 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mike Leach , Robert Walker , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML Cc: Leo Yan Subject: [PATCH v6 1/8] perf cs-etm: Add last instruction information in packet Date: Sat, 19 Jan 2019 09:43:40 +0800 Message-Id: <20190119014347.27441-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119014347.27441-1-leo.yan@linaro.org> References: <20190119014347.27441-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Decoder provides last instruction related information, these information can be used for trace analysis; specifically we can get to know what kind of branch instruction has been executed, mainly the information are contained in three element fields: last_i_type: this is significant type for waypoint calculation, it indicates the last instruction is one of immediate branch instruction, indirect branch instruction, instruction barrier (ISB), or data barrier (DSB/DMB). last_i_subtype: this is used for instruction sub type, it can be branch with link, ARMv8 return instruction, ARMv8 eret instruction (return from exception), or ARMv7 instruction which could imply return (e.g. MOV PC, LR; POP { ,PC}). last_instr_cond: it indicates if the last instruction was conditional. But these three fields are not saved into cs_etm_packet struct, thus cs-etm layer don't know related information and cannot generate sample flags for branch instructions. This patch add corresponding three new fields in cs_etm_packet struct and save related value into the packet structure, it is preparation for supporting sample flags. Signed-off-by: Leo Yan --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 9 +++++++++ tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 3 +++ 2 files changed, 12 insertions(+) -- 2.17.1 Reviewed-by: Mathieu Poirier diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index 8c155575c6c5..8a19310500d9 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -290,6 +290,9 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder) decoder->packet_buffer[i].instr_count = 0; decoder->packet_buffer[i].last_instr_taken_branch = false; decoder->packet_buffer[i].last_instr_size = 0; + decoder->packet_buffer[i].last_instr_type = 0; + decoder->packet_buffer[i].last_instr_subtype = 0; + decoder->packet_buffer[i].last_instr_cond = 0; decoder->packet_buffer[i].cpu = INT_MIN; } } @@ -323,6 +326,9 @@ cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder, decoder->packet_buffer[et].instr_count = 0; decoder->packet_buffer[et].last_instr_taken_branch = false; decoder->packet_buffer[et].last_instr_size = 0; + decoder->packet_buffer[et].last_instr_type = 0; + decoder->packet_buffer[et].last_instr_subtype = 0; + decoder->packet_buffer[et].last_instr_cond = 0; if (decoder->packet_count == MAX_BUFFER - 1) return OCSD_RESP_WAIT; @@ -366,6 +372,9 @@ cs_etm_decoder__buffer_range(struct cs_etm_decoder *decoder, packet->start_addr = elem->st_addr; packet->end_addr = elem->en_addr; packet->instr_count = elem->num_instr_range; + packet->last_instr_type = elem->last_i_type; + packet->last_instr_subtype = elem->last_i_subtype; + packet->last_instr_cond = elem->last_instr_cond; switch (elem->last_i_type) { case OCSD_INSTR_BR: diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index a6407d41598f..7cdd6a9c68a7 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -43,6 +43,9 @@ struct cs_etm_packet { u64 start_addr; u64 end_addr; u32 instr_count; + u32 last_instr_type; + u32 last_instr_subtype; + u8 last_instr_cond; u8 last_instr_taken_branch; u8 last_instr_size; int cpu;