Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1230716imu; Wed, 23 Jan 2019 13:03:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN63bwB6X/7pmYO/7zeDPXgHnBN1AserdfyjVIDb3623CQPWLg3DJUQF0n/I1AhIQX9hZR9G X-Received: by 2002:a17:902:7e0d:: with SMTP id b13mr3913995plm.154.1548277412446; Wed, 23 Jan 2019 13:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548277412; cv=none; d=google.com; s=arc-20160816; b=utn0KRSZ/Wdf4rsoiXGhXEDuXGzvusnTgSDMYrbMC2fdSUastAJStcZuUX6lP/24ps Ue/oC6GWK66YNooHVNZcIWFSsgbzr573JyeuPoboLW2bXMUYSKbQZRDQ/rUfvK4Oi8WH /yBLjGd0VVpv4q8yu5yqbZ8zZDyGfKIT5tiQh/9WfEzz7fpaVjKliZpefK3MN6E2kkzN fkPaVJVrhBCptb3MyMD1vO8k6vQ3EKUcCyi5yY+IpO+nNHAEgg7+tYUUdOKkwp228jYo eIaKd5Cs7QGSLOzJecN5B6b/tM4W+/ISC8aE/HHmPOkG4UVquyKgPbllJk/XAF0dPvg9 uBfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GIwaEMRKzxnb6kRlUoX4AjXq8zujt0bvbN32eIubOBc=; b=CTjNix+X45E1iWiPwP3UyxleFsYhue8WRBE4nqqQ9qhHRq9KJYAmbke+hHvgOxDGLp Hdh6L5vIGsgEALIZ3xdxYXYPUbO3lsWd2MRLz2jGN+IoY42Nxn2OU99m+oMx3K8jfgIY 808Dk7/jbSz5Wyl5RQZE3tTGaqY4KdvwWOj+Zz+rkm3L8px+kUqCmxJNt5lLfVLVwofG PD5RiYPbnJftTjcXkv0tNTNrLXtpFbRUxbdBLFCXWJv+LfIA5XKfQmExGCVnF37bPd5h 3bOWCVNaKKYegHZEYEE/XMbDntEEr7kdhewP43pbBa6Ki7xJ+tix9Ky2P+46cWcFsy3E fVHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jw4Tnn7d; 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 x24si19324933plr.379.2019.01.23.13.03.17; Wed, 23 Jan 2019 13:03:32 -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=jw4Tnn7d; 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 S1726953AbfAWVDL (ORCPT + 99 others); Wed, 23 Jan 2019 16:03:11 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43173 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfAWVDL (ORCPT ); Wed, 23 Jan 2019 16:03:11 -0500 Received: by mail-pg1-f193.google.com with SMTP id v28so1611265pgk.10 for ; Wed, 23 Jan 2019 13:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GIwaEMRKzxnb6kRlUoX4AjXq8zujt0bvbN32eIubOBc=; b=jw4Tnn7d+cdlFORADnV4fHvzTEsuKH9PUcz1TG4QwybCM5scoDtiyf0TFXz7RoYnhu 15TSgEO90GhRuif3wdIZQnZ9aZEai85d7t7yCyOzaPOx+CGvLTWfIKyDLkvSCxzgE2OI anOvV8s9CYDNbOf8Ch0HEEQza8YwQJ0d9a4w0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GIwaEMRKzxnb6kRlUoX4AjXq8zujt0bvbN32eIubOBc=; b=IfQDCOchHKuzin6WHsbD8BNpfxBlHSTgLmzbKSV4JalkSZqpzDd9pik0wtHBnMJeCd 3kBPeTAH5fqEr11/pimHxXNDOBrUbLMbe6kOyPUSwvqaT6vYfdbyOcDlGzKxgFaZ7XG+ Cy6jV4hBvwWz8lUW76KrRCajBcBac2iMmrk49hot9eVc/jzXzlL/DlkuF/oPt50tOm9x 1Uz9kxhxnVOAFzKFX4JV8TziSNoZnz4Dsf0OxPvp1dP1bcL/8rVY3C8C8YvbdmE90oWB gs7Z+VQ0tB085Eg9c86kT9s4a3hMw5SxQjdm7H4mHTvf2WmhBW4xno0T3gG8Ecb75CqO TIVg== X-Gm-Message-State: AJcUukeHap8Gx3daMTmgSm4imi5PJWr63jriHVcq8mIryNzHnuwJY9zf xcYDB6NpsAktRLDFZxZUm8bTMw== X-Received: by 2002:a62:e044:: with SMTP id f65mr3585000pfh.208.1548277390263; Wed, 23 Jan 2019 13:03:10 -0800 (PST) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r187sm67184687pfc.63.2019.01.23.13.03.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Jan 2019 13:03:09 -0800 (PST) Date: Wed, 23 Jan 2019 14:03:07 -0700 From: Mathieu Poirier To: Leo Yan Cc: Arnaldo Carvalho de Melo , 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 Subject: Re: [PATCH v6 1/8] perf cs-etm: Add last instruction information in packet Message-ID: <20190123210307.GA620@xps15> References: <20190119014347.27441-1-leo.yan@linaro.org> <20190119014347.27441-2-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190119014347.27441-2-leo.yan@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 19, 2019 at 09:43:40AM +0800, Leo Yan wrote: > 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(+) > > 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; Reviewed-by: Mathieu Poirier > -- > 2.17.1 >