Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp628197imj; Sat, 9 Feb 2019 04:54:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IaYEQYvomKdkFQVVNUtDSmxM1M3rI6QOojBLIPnBeaa7tsCMzmA10rwgFHwMPn2LtXVPhPX X-Received: by 2002:a62:9fcf:: with SMTP id v76mr27257443pfk.144.1549716876117; Sat, 09 Feb 2019 04:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549716876; cv=none; d=google.com; s=arc-20160816; b=SgIlcJbBVn07854nSXQg2y5J0Yrpjx77FyWYmsKvTeJzp/EeBz6L4cAlszDaqla6fZ YWvyCYVK+Dtg1h5KuU8Pukj/GlEldC4tyO1hztkgPH1KSKgcvia69XJusOS1cbkKbDtj YTVkMJAiufuxIcVSdzIs3gAqXE3eg1PZgo82OREvWWI+iOqoY3k7A8S6FAjz7O4dn0k1 D3L1dr976AaUkECAQgh2og68giXQC0izXagquKYGT69a0p8ilgYd8Nju9wP8kh2UPOvQ IXs47o4LIatWmfapKiAe1+2SrXrQeYjFRSxF/8jsBSNqxDRPCE/aswnPAx2jkPBOFTmT vWOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=qTivbXCyKRVVO/t1woWxDOtvcjnz4Bu3DjXzqM1hVRI=; b=rrWMABr1zd+02IC2XFVKBX0lsEk9+JhpJjcr3L7fiKSLqXPEk6p62U/s4TnRi/Z9Sj FUn8tJHem34pbHyPRAvXa/t5FSthgOWeCffgMBrn6yy9SuClFraYHPT3XZLpMxV+xDw6 2j+4U45Gr/xn+IIAnaXDN471ekZRt4BTHIMtbddIgjWH9d4Gud5gQXF86kWZQ5OwefRl aEYPL89rhYtH++WOI3wQ3KuMsOmY1s35bb97SUGeWgolmRzPwn/e3/sZxH3SbgPOY/nz uLqGAByX7CZjD03okTFz9vFfugq66hcHj6Vsv/siRhq2B8qF5YERodI9wmr9K3k8BrxM 4hEw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si5152228pls.83.2019.02.09.04.54.20; Sat, 09 Feb 2019 04:54:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbfBIMyH (ORCPT + 99 others); Sat, 9 Feb 2019 07:54:07 -0500 Received: from terminus.zytor.com ([198.137.202.136]:56797 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbfBIMyG (ORCPT ); Sat, 9 Feb 2019 07:54:06 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x19CqrBo2632962 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 9 Feb 2019 04:52:53 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x19CqrX12632959; Sat, 9 Feb 2019 04:52:53 -0800 Date: Sat, 9 Feb 2019 04:52:53 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Leo Yan Message-ID: Cc: mingo@kernel.org, acme@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, coresight@lists.linaro.org, alexander.shishkin@linux.intel.com, suzuki.poulose@arm.com, leo.yan@linaro.org, mike.leach@linaro.org, mathieu.poirier@linaro.org, robert.walker@arm.com, namhyung@kernel.org, jolsa@redhat.com Reply-To: robert.walker@arm.com, namhyung@kernel.org, jolsa@redhat.com, leo.yan@linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, mathieu.poirier@linaro.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, mingo@kernel.org, acme@redhat.com, hpa@zytor.com In-Reply-To: <20190129122842.32041-4-leo.yan@linaro.org> References: <20190129122842.32041-4-leo.yan@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf cs-etm: Set sample flags for trace discontinuity Git-Commit-ID: 465eaaa89e2b7e450d53f4d3a6845f0c595a5f59 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 465eaaa89e2b7e450d53f4d3a6845f0c595a5f59 Gitweb: https://git.kernel.org/tip/465eaaa89e2b7e450d53f4d3a6845f0c595a5f59 Author: Leo Yan AuthorDate: Tue, 29 Jan 2019 20:28:37 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 6 Feb 2019 10:00:40 -0300 perf cs-etm: Set sample flags for trace discontinuity In the middle of trace stream, it might be interrupted thus the trace data is not continuous, the trace stream firstly is ended for previous trace block and restarted for next block. To display related information for showing trace is restarted, this patch set sample flags for trace discontinuity: - If one discontinuity packet is coming, append flag PERF_IP_FLAG_TRACE_END to the previous packet to indicate the trace has been ended; - If one instruction packet is following discontinuity packet, this instruction packet is the first one packet to restarting trace. So set flag PERF_IP_FLAG_TRACE_START to discontinuity packet, this flag will be used to generate sample when connect with the sequential instruction packet. 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-4-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index d05cac5295f1..1aa29633ce77 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1111,6 +1111,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq) static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq) { struct cs_etm_packet *packet = etmq->packet; + struct cs_etm_packet *prev_packet = etmq->prev_packet; switch (packet->sample_type) { case CS_ETM_RANGE: @@ -1170,8 +1171,26 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq) packet->last_instr_subtype == OCSD_S_INSTR_V8_RET) packet->flags = PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN; + + /* + * Decoder might insert a discontinuity in the middle of + * instruction packets, fixup prev_packet with flag + * PERF_IP_FLAG_TRACE_BEGIN to indicate restarting trace. + */ + if (prev_packet->sample_type == CS_ETM_DISCONTINUITY) + prev_packet->flags |= PERF_IP_FLAG_BRANCH | + PERF_IP_FLAG_TRACE_BEGIN; break; case CS_ETM_DISCONTINUITY: + /* + * The trace is discontinuous, if the previous packet is + * instruction packet, set flag PERF_IP_FLAG_TRACE_END + * for previous packet. + */ + if (prev_packet->sample_type == CS_ETM_RANGE) + prev_packet->flags |= PERF_IP_FLAG_BRANCH | + PERF_IP_FLAG_TRACE_END; + break; case CS_ETM_EXCEPTION: case CS_ETM_EXCEPTION_RET: case CS_ETM_EMPTY: