From patchwork Wed Feb 6 18:48:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 157660 Delivered-To: patch@linaro.org Received: by 2002:ac9:7558:0:0:0:0:0 with SMTP id r24csp6438028oct; Wed, 6 Feb 2019 10:51:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IZlCz6yJlSPmRKt8V4EhNWn0h0iitnW7VbwlNStNbDkF69ugmjsGP98m1B4r0rT477/5ci+ X-Received: by 2002:a62:6503:: with SMTP id z3mr11647404pfb.169.1549479076259; Wed, 06 Feb 2019 10:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549479076; cv=none; d=google.com; s=arc-20160816; b=zbxTQ5H1bWeQYEaNknPSq1QRLumMXMQOasyxYPd4y4F7Y6IdJIWneR5SdpSrSc6wmy TWH4UP02nmLC4DZcpvHGCoo6OZ/fUd38Qne+W+1bQHick9P+gMx9hSPG3gkmjsRSePtU ST23/aY94HZpwIRiuILDZDWvtyAHkZ/9kk0wmc+uKpFAyYMM1eh7yVoK53oO3nSokmgA zKFji/WameEARS7JjG2eYoNdoRnzqL8hF27/14h1zXbzOzPYVjdAsdBbkqI1XDOTdYAP ZYay3Qf41Yjr2TFyyT4NUy16qRYU0iZZjv4j8BCb4ewVIjjCxSqcWx7U7vr+OEKOIIX2 +s/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f8o8wIjeb0DXa0GeiqIsRRQ29wyEyTVFUXCxh4DM6vE=; b=M+5ylH5kPueS19CYDrhX2oIaqLZwZOr3Hk0x/avkzaHWicqcWrbN69HmRdMvDXQigy Ajv8A5iXNK2ve5djHp1YMILRrNboPftmbY2j17yHwkyq8qTzfGQfKdvTZ3ipWxo7omFx UcwjhKtCk4MNIPVvM/APnBSPlZlaKgJjL3GKwUMS0Kl5KHdj45cRbts+tcQMVvYdLJ2i bttmPAiYO59XxwGltRFrKIdO5GZQqTjzZiWySugPyqTDKyTg5DqR+aGc/VFiPYwYd+Ef Re3/T/TwF5V5ZkapP/SHzloLs9Zd3ZvGfN7/Xu2Sk/+SHMYN5SdHNCvY3fd06j58VtIU gKdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YgcghQgV; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si1900495pgv.512.2019.02.06.10.51.15; Wed, 06 Feb 2019 10:51:16 -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=@kernel.org header.s=default header.b=YgcghQgV; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbfBFSvO (ORCPT + 31 others); Wed, 6 Feb 2019 13:51:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:45484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbfBFSvM (ORCPT ); Wed, 6 Feb 2019 13:51:12 -0500 Received: from quaco.ghostprotocols.net (unknown [179.97.41.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 125F8206DD; Wed, 6 Feb 2019 18:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549479071; bh=DPf6+m4SQ6YL80tHDJ5sakvRWpQ41t/xOw6ARq7RVvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YgcghQgV5rLpoQYci3DExRdStKbSRvc7AatPj14kKp5XFx7XAqVs6lp3gLWmuia2v Wi1+KBFnQZfmUsSdYj6xCzGNflgUyA68+ZZYrru10ZqKQIa+fKlDOxdBikDpWHlq2a CdCfyDzL/ezZqdI5e8eO8yJNWZhntqwVi6gVPTZU= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Mathieu Poirier , Alexander Shishkin , Jiri Olsa , Mike Leach , Robert Walker , Suzuki K Poulouse , coresight ml , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 36/53] perf cs-etm: Add last instruction information in packet Date: Wed, 6 Feb 2019 15:48:46 -0300 Message-Id: <20190206184903.24054-37-acme@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206184903.24054-1-acme@kernel.org> References: <20190206184903.24054-1-acme@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan 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 Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mike Leach Cc: Namhyung Kim Cc: Robert Walker Cc: Suzuki K Poulouse Cc: coresight ml Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190129122842.32041-2-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- 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.20.1 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;