From patchwork Thu Oct 24 15:13:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 177531 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2330340ill; Thu, 24 Oct 2019 08:15:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7I2zEhgVV+KziMfVUnq43ZDJ2IrGdXcPE0NOjMMCn4xZJxkb/bkY/XXdbSt6nER0J+iEb X-Received: by 2002:a17:906:e57:: with SMTP id q23mr11985623eji.303.1571930115818; Thu, 24 Oct 2019 08:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571930115; cv=none; d=google.com; s=arc-20160816; b=RZ0Xf1GEqrRU15ZQjo4EwCuM8CkEW5gBaW8kjA9ghYmYNZDlqEbYbbz9p/+7y08+Pl 7EuwwLXcSbG0YgyxBdQzH42/dkX3ZrocY23Nalkj1BY7X4grjCbW9Hz6SqYi93cOY7mO gWhVWMP84s1tfuvyUy+cVPUm3d5XfNR90Oa2edoEhckgMMc528XlLgQgUMuvnGArrZlo 9MmkieQaQj0MBYBvgBKYeJYUOq9BTR3VdOFqcsiWJGnxzpoZMfas7adJUdWeJfl1sHPc nWQrWpAuSdoju0hrADZ0vugPke8PcKqAQNrWYp/M7gk+TAZKzhv2gVQOKrHBsaDjiGIi Ikqg== 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=iAgomrDaaw+p9SyPDKe+DIwZEIKyPHeJdp6rMCsSqrc=; b=icqkEWJJbYAXnOVH8WQjSWG+UH6MFanc3KMY/nS/f/2yu7/8eJV5sJ8gCDhov2Wjtm qVkVDiUV6d4WizUCZP6qvHBO2i8cPvuqEFStt4smCaQtjvF2bXsqx47jm/DchdpEsUt3 i+pD034EcuRvDwb9Bls/D4ajBoZ5I2M8CBsUf8lSvY/yDt9rZzxBTiJOQG2pGt2ndmjg vnYKhKFKcL8yXtM73Dt49zk9ymQEWeRG75ztAmhRxYWMzY/D1gHVQKmDNeK7UrCVAhgB Ka1Srsuw7lsR/z3aoNtYl4pPBYkwv59R4r0KgU6Bs1mFParoVk/B2X/3vEQ9j2n5GtG+ Cquw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P5Z9s7tQ; 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 g3si18589317edj.220.2019.10.24.08.15.15; Thu, 24 Oct 2019 08:15:15 -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=@linaro.org header.s=google header.b=P5Z9s7tQ; 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 S2409645AbfJXPPL (ORCPT + 26 others); Thu, 24 Oct 2019 11:15:11 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:36634 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409599AbfJXPPK (ORCPT ); Thu, 24 Oct 2019 11:15:10 -0400 Received: by mail-qk1-f195.google.com with SMTP id y189so23757095qkc.3 for ; Thu, 24 Oct 2019 08:15:09 -0700 (PDT) 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=iAgomrDaaw+p9SyPDKe+DIwZEIKyPHeJdp6rMCsSqrc=; b=P5Z9s7tQX1G3oEdM4YkZvIy9JwZJm7c9n9mVSVcigEo+f08pPSB15O+iIGQQpa8iIM G3oOT++5AX46oumLuNw63gqOs1XcA+8gU94YEpASQyvBUu/+Vb1sPvW4JclYvp0wRC/Q YMSPhO+qnod1JwlDRe86ke+XVh6Pzokns3VnnCtu2LgOaBZWmk50vQILLjP1CdDojU6L wR4o17+y954XBO3kwDwXAPhXqd0Bb0kWtboPY48cuDnhNzrXBTyOH2SPpOXwC+g4rYLu 1L+1AljcwUuqwQQdJXineJMQK76V3ejsnirZjuwI0dMsBTPJ5nZG9MyDB9R1slKaECww JAfQ== 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=iAgomrDaaw+p9SyPDKe+DIwZEIKyPHeJdp6rMCsSqrc=; b=KNwrHhrQSiiFlvXVhiwcswncpV1XUdxNu+xKw3lg2ukpQx5bPwXutzNAe/wTAdFwu/ uaCnqzpQ34UKTO3u4RLnjXFSXa242umG6a2zh3VAb4Gkgc/0YnLAnu3roGYAiAe42RF2 N8w10cfOydIQ9aCUeiEgoRjak1jvwxn2T+5hOgpb7zGSGL8WH/CMoOKpcirSGVjk4WJm IVqnogLFaO218kgdKyQvIHqZz1VUlx7z4FfooLdIO19m3kQz3IJ/N0r9TFgNNJWHrFbX Vp67WsEcikJguYW4H7gv+vXhdTC+1QxQU6QnYFIP54HBd3zxdz0jKwKPol5Z4JOUf3Vv 9DFQ== X-Gm-Message-State: APjAAAWTSrWcB2rmzgXas7F3uBC8Oa+K1iIruAwXLQ+Vgj8HqqtQeOri HvaFOTBKp25W6W7Q8PxRxY1S6g== X-Received: by 2002:a37:f514:: with SMTP id l20mr1916565qkk.331.1571930109291; Thu, 24 Oct 2019 08:15:09 -0700 (PDT) Received: from localhost.localdomain (li937-157.members.linode.com. [45.56.119.157]) by smtp.gmail.com with ESMTPSA id l5sm4346073qtj.52.2019.10.24.08.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 08:15:08 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML , Robert Walker Cc: Leo Yan Subject: [PATCH v1 1/4] perf cs-etm: Continuously record last branches Date: Thu, 24 Oct 2019 23:13:22 +0800 Message-Id: <20191024151325.28623-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191024151325.28623-1-leo.yan@linaro.org> References: <20191024151325.28623-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Every time synthesize instruction sample, the last branches recording will be reset. This would be fine if the instruction period is big enough, for example if we use the option '--itrace=i100000', the last branch array is reset for every instruction sample (10000 instructions per period); before generate the next instruction sample, there has the enough packets coming to fill 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 if the last branch array is reset for the previous instruction sample, it's almost empty for the next instruction sample. To allow the last branches to work for any instruction periods, this patch avoids to reset the last branches 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; thus it can continuously record last branches. Signed-off-by: Leo Yan --- tools/perf/util/cs-etm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index f5f855fff412..8be6d010ae84 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -1153,9 +1153,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; } @@ -1486,6 +1483,10 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, tidq->prev_packet = tmp; } + /* Reset last branches after flush the trace */ + if (etm->synth_opts.last_branch) + cs_etm__reset_last_branch_rb(tidq); + return err; }