From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32561C1975A for ; Tue, 17 Mar 2020 21:33:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 032ED20757 for ; Tue, 17 Mar 2020 21:33:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584480830; bh=gcJnFPP0ksb1GRI6uV7QJRMhRKrj0jE6f1HzxdYooNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jfyw7UFVGDv6pJPwt8W3w/vICWJ1UuR+ni6W5TzS/7smbO4ekrLHx9RIe8Fn+skBt JNxJfcS4f9G3C2cQwxqdhdpPp9QZN/ecfSaFAmDWNTa8hWbQRGRCmcfT5C8sfaeg/R mYUWu7qW62eAFHNPGF0nBH+bXKnnYXxjIvRfEngg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbgCQVds (ORCPT ); Tue, 17 Mar 2020 17:33:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:52478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbgCQVdq (ORCPT ); Tue, 17 Mar 2020 17:33:46 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (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 3C11320754; Tue, 17 Mar 2020 21:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584480826; bh=gcJnFPP0ksb1GRI6uV7QJRMhRKrj0jE6f1HzxdYooNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nfzl6pCu2hF0D2LpDWw/kxI0er/n2XrAdzj8/25UmRFx0mjlFRl6t2ay1zMD3JG8T 7DkAoRY03haz7NcsUEVTPfZ1VELlN1Ixvkadl78PEhBBl4bBsZ1an4LMpciswVQciq 2A2H+H4GPoxu4aJk8nB1JFDkpzDZ37kALL99y224= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Mathieu Poirier , Mike Leach , Alexander Shishkin , Jiri Olsa , Mark Rutland , Peter Zijlstra , Robert Walker , Suzuki Poulouse , coresight ml , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo Subject: [PATCH 10/23] perf cs-etm: Continuously record last branch Date: Tue, 17 Mar 2020 18:32:46 -0300 Message-Id: <20200317213259.15494-11-acme@kernel.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200317213259.15494-1-acme@kernel.org> References: <20200317213259.15494-1-acme@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan 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 294b09cfb034..2c4156c5ed09 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; } -- 2.21.1