Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp541244pja; Thu, 19 Mar 2020 07:14:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsmLHzo8SIjNc82pqe18qFjZ3AY9vAowUy7vSKcYzq7TcK1kmar4KpIvuNl8Ed+LPbmdI5P X-Received: by 2002:a9d:1ec5:: with SMTP id n63mr2437077otn.360.1584627244656; Thu, 19 Mar 2020 07:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584627244; cv=none; d=google.com; s=arc-20160816; b=zwCmIIkTEtkNuTeKgN9vnOvdo62WNzfDNg0lIUElQAIMsIO7NAQvjl+smP6iEzQr9m q6UdUucwWOV4QvLDaGFXMq7nanbH9ivqLUeFeWNl/mar7LaCYw+wVw7htIvIFemgGQXC JQsnU+NYlZrcbaSc7kAERp/qvXzbK2Dxvas5u8ervgNkhw1yEKEGffoQfegROTlfm6KY A/SITSRK7nxSD5m/H3ft5PQ1lFKCwD5RzlHngeEHb/66lej+4IUd/MgIxv3+sWdYhb+l SWnJeWYSb84jbL1ICIcWzYOaEVYq/bQ9vT0hcP2xo6zYmx1NLNtkLYz5VHlgR2HOj/N8 QHeg== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=67jMxh8svRJokTWiRu/eiy9mF3Y7bLfLZifjsxIeD0E=; b=nPyyIht7M4wPez9np8KoEKKgMLSGXspVnhZgtsocRYe1XACekTGLOUrJXg/kURepsf fjyfxgaoRVtPGuXyXjsG4ZVlKYFc2Ys7Et9cdmcg8V/XU2aiOEi6Flk7+GePPm5xJu4g jsYIBmD8YI1lxl+ZlvgKIzEpzSTS0LIWl9pV0cyo7oNm8dZenfaSKcJPlc6X86UMrxcK oHtz+uQq+hDXVZSx6SYkQFMoJQa1ylQfHYOY9VGi8qJSwsbdfAILOVoWaKcbqeVI7RF/ DvFWppVZk790DyryQN6LfGdoNdOfGLCF5ewb6wj97IZD3h9yBpa6VMhHmE5gDXVKrGIg 5QAA== 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 m125si1026170oia.240.2020.03.19.07.13.45; Thu, 19 Mar 2020 07:14:04 -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; 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 S1727754AbgCSOMi (ORCPT + 99 others); Thu, 19 Mar 2020 10:12:38 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60955 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727811AbgCSOLB (ORCPT ); Thu, 19 Mar 2020 10:11:01 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jEvso-00023d-CT; Thu, 19 Mar 2020 15:10:50 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id D03661C22A7; Thu, 19 Mar 2020 15:10:44 +0100 (CET) Date: Thu, 19 Mar 2020 14:10:44 -0000 From: "tip-bot2 for Leo Yan" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf cs-etm: Continuously record last branch Cc: Leo Yan , Mathieu Poirier , Mike Leach , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Robert Walker , Suzuki Poulouse , coresight ml , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200219021811.20067-3-leo.yan@linaro.org> References: <20200219021811.20067-3-leo.yan@linaro.org> MIME-Version: 1.0 Message-ID: <158462704454.28353.11740281942674708113.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: f1410028c762893daf353765112cf6797e4442fa Gitweb: https://git.kernel.org/tip/f1410028c762893daf353765112cf6797e4442fa Author: Leo Yan AuthorDate: Wed, 19 Feb 2020 10:18:08 +08:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Wed, 11 Mar 2020 10:48:44 -03:00 perf cs-etm: Continuously record last branch Every time synthesize instruction sample, the last branch recording will be reset. This is fine if the instruction period is big enough, for example if use the option '--itrace=i100000', the last branch array is reset for every sample with 100000 instructions per period; before generate the next instruction sample, there has the sufficient packets coming to fill the last branch array. On the other hand, if set a very small period, the packets will be significantly reduced between two continuous instruction samples, thus the last branch array is almost empty for new instruction sample by frequently resetting. To allow the last branches to work properly for any instruction periods, this patch avoids to reset the last branch for every instruction sample and only reset it when flush the trace data. The last branches will be reset only for two cases, one is for trace starting, another case is for discontinuous trace; other cases can keep recording last branches for continuous instruction samples. Signed-off-by: Leo Yan Reviewed-by: Mathieu Poirier Reviewed-by: Mike Leach Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Robert Walker Cc: Suzuki Poulouse Cc: coresight ml Cc: linux-arm-kernel@lists.infradead.org Link: http://lore.kernel.org/lkml/20200219021811.20067-3-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/cs-etm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 294b09c..2c4156c 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1170,9 +1170,6 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq, "CS ETM Trace: failed to deliver instruction event, error %d\n", ret); - if (etm->synth_opts.last_branch) - cs_etm__reset_last_branch_rb(tidq); - return ret; } @@ -1487,6 +1484,10 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, swap_packet: cs_etm__packet_swap(etm, tidq); + /* Reset last branches after flush the trace */ + if (etm->synth_opts.last_branch) + cs_etm__reset_last_branch_rb(tidq); + return err; }