From patchwork Sat Jan 19 01:43:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 156111 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3903592jaa; Fri, 18 Jan 2019 17:44:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN58zcM6t6i6O45EptPryJgDc13zJ1XAp8yZlxHERKPzntJLWKiu8tLz7Wy/IAhQqzf8TYVs X-Received: by 2002:a63:104d:: with SMTP id 13mr20070363pgq.303.1547862271205; Fri, 18 Jan 2019 17:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547862271; cv=none; d=google.com; s=arc-20160816; b=ifp8Nsf2Vo7lWcGplzaUiQgt4hCic3XRKtAZTWcs+QMC8eUdfH8rs1ZEMxWOxea0Xe n0ZnygJIb9IZASTtzab0x9XAJZqVzy55juqcEBqymzykDHxcxVpTrF3g5xRvjaeYrfsU s5Ypo5grl7Ni7Igc4GH6c5vZ+M432759Zt+pYH53WDYswl1ZZCDS0G1eucpkxj7uTtBs S+lJR997cxVB3oVlmVsIOxieJDxFC4F4IKrTTgjy6PFDnVLfoINcO398OCNh6EcwyNZU VwRJanMjfrlSUVmqtHpQmyuIxtcWjL5r8IPS66h93NmGtJkfUqVEYDLUwNQL2i/1kb5A DjpQ== 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=apzqr2DPBRKwMWYdw7mN2gcZix8iFxXQD+UIs2uAD/8=; b=TlnTjdy5M+Ds+IfC4iyHAvTPiIzGnDexbQ6+qCSxk6OgVeqTG7cKMOB26N8OjvV8g2 dZV7xpvIYj12ZDYG1dCtF3Wk8NTVanLbFgoamxVIQMnbzhpHk3dd3hUlRTxQR7wG/Dmm NW4rkGTmf/kIeEpF6PK/EawEkav+BMSQUtiqgoV7Y6bXRu0O/xJNnTx/c4oyhkFznGe5 iKv2CX97BzcPhE2o4wXL32O5pqQbLL8fR1k04Zt6oE7mw151I9azqHGs79L8ScEPXCTj FBFFiR2hrml6aFtygEep8Y+SrGurt2KaeTABID7vyvgwpncalqfaaT8KQKfcEjg2S6eL /+AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PiMbxk9o; 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.30; Fri, 18 Jan 2019 17:44:31 -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=PiMbxk9o; 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 S1730312AbfASBoU (ORCPT + 24 others); Fri, 18 Jan 2019 20:44:20 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33840 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730262AbfASBoR (ORCPT ); Fri, 18 Jan 2019 20:44:17 -0500 Received: by mail-pl1-f196.google.com with SMTP id w4so7105132plz.1 for ; Fri, 18 Jan 2019 17:44:16 -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=apzqr2DPBRKwMWYdw7mN2gcZix8iFxXQD+UIs2uAD/8=; b=PiMbxk9o8YY2tVjT3ff/E+/k0qmzfKhgGNsgDhImweyyi3d6rdLRJL2sTjMAjzFyx3 kNoFWUkUmRpDfUJGqWEtwRE5WiItb8AOQRRnrGKmMgSG9N5WulWUt4ln5TA6zoeBlKxm 2k3tLnjb+Cc5RyA8fu959FOaaWTwFmPK+7zWM= 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=apzqr2DPBRKwMWYdw7mN2gcZix8iFxXQD+UIs2uAD/8=; b=se8Wj2gdADGecgj9XDTaQPBNNPUmt6bPAh49z3pjiFMUn89J2OoDWq8v0e9vI/0ps8 tQ/wlak7tyNc7krGu6pFLCLZcqWetGsE0k1HIJ7sBksN2Ox/Ik2fMaVmefUWIUREqplm BAFMgiYS7h/L20kPxPkURnv/JNvmJd35bV5I212R/oc1a1AKYeMQTdc9GlJIb6zDRBck 7JcZn/QV9ofiEacLxAyK2TSRT6Xk1BJOOdVZfbqp/PjpcepL0NW15Qcx5YGtL556Q3Cx QHYzVccq5SHzeT5P5T0/wv0+2H3rO7Pb++evKsUoKNE49s6VqVy4LeujiRJdFfDoFBl6 8ovg== X-Gm-Message-State: AJcUukcjgEZpgZ5JdHmblKjZS/Sx1UNlx5p2rOP5NCBXQ9bjoRDlTcFs UePxUhuCHrMdnHC7Vre5FwUeSA== X-Received: by 2002:a17:902:2969:: with SMTP id g96mr21194637plb.295.1547862256537; Fri, 18 Jan 2019 17:44:16 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 17:44:15 -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 3/8] perf cs-etm: Set sample flags for trace discontinuity Date: Sat, 19 Jan 2019 09:43:42 +0800 Message-Id: <20190119014347.27441-4-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 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 --- tools/perf/util/cs-etm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 Reviewed-by: Mathieu Poirier 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: