From patchwork Wed Feb 6 18:48:48 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: 157662 Delivered-To: patch@linaro.org Received: by 2002:ac9:7558:0:0:0:0:0 with SMTP id r24csp6438148oct; Wed, 6 Feb 2019 10:51:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ/aNlNiuk+Kl9fD6KS6IsdWDtwDAibl2TXHHu2Dckh77DIiGQ7mHbieYZuXPCYl/mg/3gu X-Received: by 2002:a62:4641:: with SMTP id t62mr11852748pfa.141.1549479085449; Wed, 06 Feb 2019 10:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549479085; cv=none; d=google.com; s=arc-20160816; b=P31c1HC2LKGxBBiQJchaMjtQmAoZSVDfxrAD67TtrcnLT6T4Ogwj2POs8QHMoaCzc8 uDid2iKTtmG9LOXcZqpjw54ObdPmMqqDY+MNbPqVs/uVeKNc/vUxyoJXmPqbFk21M95e b6pHAuXiopnsnjdtF/B4jA0GVVm2BAtk8gOSZuOTRG5xooPyWFT/z6JHkzyT8VKtSAAi 1Jvt/6lThcfCyesGPHkPQnA3vTDihsmCqL8l2PYGXQsAKzoiPFNHHJkg95bviHyD1w5y /W3KoGYs2jcWcmmumb1S8ROFB46ZaKFaD66RjczKOqPRrZ0LPP7iihod9NNJtRWLmRo2 b4rg== 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=doKbP9b1LxGUryIEExfY91dgw/lW7uG0DyTYVvLTCpA=; b=IgYiv4szTRxufI6ho/0ziUjnKpohulN3u6vOh5yoSp00j+GL2HD6w+dUI74BuSGp/a fM4GdKlS2jWhxAEBna1ayiFQ0PAEpdYaJ+QUHFTGns9nF18eiKgsXgh+tfQNvmnM6MG6 xs+mv3ysO2t7P1p3/ecCUNNWgZOhsdlsEuRwRrVIZwEvk9O1xxE5gTKcLJw0+y7+1zZu eWdrzQOqd1WReC2hdZDbvY8SkFNoB8MhbnbGgRU0kcf26GUgAG5Dh12rrM2P/NEswk7U WkJatC82bvbvdSunRz0mNEmuwoEfCh/3eDs1foGDoTNafU5/oQ8ka+dhEvov84cYPWRX k9mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m5rnX1BT; 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 s4si6756355pfb.190.2019.02.06.10.51.25; Wed, 06 Feb 2019 10:51:25 -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=m5rnX1BT; 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 S1727960AbfBFSvX (ORCPT + 31 others); Wed, 6 Feb 2019 13:51:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:45654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727929AbfBFSvU (ORCPT ); Wed, 6 Feb 2019 13:51:20 -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 AEE2120823; Wed, 6 Feb 2019 18:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549479079; bh=8xVfWL7PNGbZby5GdK/FGiGNFYB6H5Fzl6/NRZdf5bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5rnX1BTMJ5avdkOLgbzMIiyDDC3z7HSqWK2YKkU0FkD5X1iDR+1iRGJaDYR0WhIH Keo1o0m3oGa1WP202IuHlLo6DZ9rWDla/SXZuXk2akX1nmo/Ah4ATDdmhO2m7LBDnn sLYfKaksBqtcDCyPiCAxRTyehwl10NyRIPEd28Rk= 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 38/53] perf cs-etm: Set sample flags for trace discontinuity Date: Wed, 6 Feb 2019 15:48:48 -0300 Message-Id: <20190206184903.24054-39-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 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(+) -- 2.20.1 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: