From patchwork Wed Aug 1 21:36:42 2018 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: 143314 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1378577ljj; Wed, 1 Aug 2018 14:39:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeqk1lE2t8c18vCRchkJx8CpwoJYmhKBuSnU4U7Hc2tCNFiiB1fONSEPjuBGO4XnwP6pqv4 X-Received: by 2002:a63:e247:: with SMTP id y7-v6mr58659pgj.231.1533159547067; Wed, 01 Aug 2018 14:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533159547; cv=none; d=google.com; s=arc-20160816; b=loo9erNeg1FgXcOW//f/LgM2/jdjhV/kQ9z9RDLWvr1mjiXw9Mw/lEifurlnc2/hz7 tkw9ZhCBkAkyBLVrlq2ddxdqGEdNCdFyeGlM07EYrksbL1HxB5/t61n5CHkCt0AViFmS JTsdzwNBMjk8tmPturC0dvBrXk8oFpK5JCIo7KTPEqrRNVWE+oFAmtRFJTSKn/IDhmO0 mqG77PT5tBnC2eFwBnMY+DVbqE8FSv2mNoKTq9V2MilY/4WagsWUtom63BbsxHvxFCCI uJvI2dnJ0Jg9ZKJHz/+TAJMhuMo4u874LQgNQMi5dFt/9rgojT9NeVEC+OWHdGSrS6Fo /h3w== 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:arc-authentication-results; bh=8uvAWMoKirB5Oq2xV9E9FqrCKKNnbnvGtRdfyFGECc4=; b=TQHoK3+q3V9AfpkDcLm72iq/sZ66A96zz76QjyoV4QeUISO4c/eWr9TuLkIjHYvyKq PBfymq08KSicSNqc1CGnJIdjAvZGra3FcB/qvDmnxwpPvdQ9PlzC1s1oHxcN60xokamb LqrY3UHLISkBLO/1tuc437TfUoCVdlDayZT0ib6Nqf2ARPKkG/My3Evu8o8KmbANdPtK 2PX9hAwUUd9hBNVTb5ijaqobPUgxl8rfelBPfwwmXwNhKKnCE1UqDtWnVNwoqgawyp2t c5ULwNGJfZNLNoVagYY3cIV2K2s0ZMq4wPNt5QHvN91+RI2gxAz6mumv+Pz2hGGCo58f QkuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YvFwQ9Y8; 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 i24-v6si86405pgj.228.2018.08.01.14.39.06; Wed, 01 Aug 2018 14:39:07 -0700 (PDT) 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=YvFwQ9Y8; 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 S2388873AbeHAX0w (ORCPT + 31 others); Wed, 1 Aug 2018 19:26:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:39752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388731AbeHAXZj (ORCPT ); Wed, 1 Aug 2018 19:25:39 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (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 22FF8208A6; Wed, 1 Aug 2018 21:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533159471; bh=NqiGDYhS9DKP0U4/znGIEYTBKhiCrrjfAp/8MIJXKfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvFwQ9Y8p5E89BIkO9YmOL9r5t6MC8DddMXKgZ54bzyo5PuRizDW0Cy2LM8VLFlfS 8sjG1VV3eIeATNMSQwbh9J8vW3PaiCptGFgTr8dyG9nVU7N+3bS9D0AnJL4SS+UFGB CLURbYRzaoznbAfN+I4R/2ToRD9MGYGcLZu2b9H8= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Kim Phillips , Mike Leach , Namhyung Kim , Peter Zijlstra , Robert Walker , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 15/21] perf cs-etm: Generate branch sample for CS_ETM_TRACE_ON packet Date: Wed, 1 Aug 2018 18:36:42 -0300 Message-Id: <20180801213648.4814-16-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801213648.4814-1-acme@kernel.org> References: <20180801213648.4814-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan CS_ETM_TRACE_ON packet itself can give the info that there have a discontinuity in the trace, this patch is to add branch sample for CS_ETM_TRACE_ON packet if it is inserted in the middle of CS_ETM_RANGE packets; as result we can have hint for the trace discontinuity. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Kim Phillips Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1531295145-596-7-git-send-email-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) -- 2.14.4 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index d3b794286bca..2ae640257fdb 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -910,13 +910,23 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) etmq->period_instructions = instrs_over; } - if (etm->sample_branches && - etmq->prev_packet && - etmq->prev_packet->sample_type == CS_ETM_RANGE && - etmq->prev_packet->last_instr_taken_branch) { - ret = cs_etm__synth_branch_sample(etmq); - if (ret) - return ret; + if (etm->sample_branches && etmq->prev_packet) { + bool generate_sample = false; + + /* Generate sample for tracing on packet */ + if (etmq->prev_packet->sample_type == CS_ETM_TRACE_ON) + generate_sample = true; + + /* Generate sample for branch taken packet */ + if (etmq->prev_packet->sample_type == CS_ETM_RANGE && + etmq->prev_packet->last_instr_taken_branch) + generate_sample = true; + + if (generate_sample) { + ret = cs_etm__synth_branch_sample(etmq); + if (ret) + return ret; + } } if (etm->sample_branches || etm->synth_opts.last_branch) {