Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp84685ybv; Tue, 18 Feb 2020 18:19:48 -0800 (PST) X-Google-Smtp-Source: APXvYqz3FKRy5GFYbFtSofJ56Pqgs5BqD9x+Py3NsFueA566fbg0CcMzU8pPNxwfz1dwOyea1jVJ X-Received: by 2002:a9d:3bc4:: with SMTP id k62mr18674566otc.186.1582078788424; Tue, 18 Feb 2020 18:19:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582078788; cv=none; d=google.com; s=arc-20160816; b=LvpxPOnSPD4UzpF+9xKsPondKQ0LzH7E2CV7AC/1APwzeXYQ6QFn1V3wjHcsRygomr 4sibbDAHGfS4GGwL07dT9Qw2+OOO3Dq/uSpcJJKMzaJvgsg2iTy2klI9SnSdumCTFHbT EfZCRRLnCs87ZnvnAkPCP6koslngtBEVW1NW10EvVG7n+UGxZl5YEFtOmSzs/kS34Wwq SCBtQlfuILVIzRTbHr4Kq14qyTqRPQwoO6Ya+wHaXUP1gIXz3VS9paBULP6g3MXW5hkY ZUAWSO2hSwnFrhh7Zuo/2oJgzHL0yLHAKGZHhtj7IhC0LJlQrW0xMePW5asirDgQFk0E iX4A== 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=Nt7KCfOCeoniLbejBgBQRi5gzr/DUGn0cHKbOhTd9/Q=; b=vmbYfGJqCeOLNek6p817Y1jUIMSmrP4zIKzKcRxaI6UWOuwll7Xc1C0qIg5DKsSqF3 onfTcxbwNv2tV6/mjp9dbwYpnmaY7x6zdCiyI/EB2mE0sNF7IGcXUeioIP2x/Ptvl3s2 RqglYWNInkFVCyoSLDah5JnM7YPXGKk7mZ4nGwu4tapPE13u0lmwDN6ZIwWEPCjPvLRP PCZ4r1lgwJdsHTFjPovyn1/MF1oUGodQtdzUGoAS8CdpE8xHo+JyjSotv4ro8/1pC+R1 9LXaewQ8BZ6yZDiv+XpyG3334X+8/purSWdGzYaqNio3tuvHtfUh7HkvqZepu5WkKoC2 PEbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dOfv3pE6; 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 t26si8109080oic.169.2020.02.18.18.19.36; Tue, 18 Feb 2020 18:19:48 -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=@linaro.org header.s=google header.b=dOfv3pE6; 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 S1728112AbgBSCS7 (ORCPT + 99 others); Tue, 18 Feb 2020 21:18:59 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33303 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgBSCS6 (ORCPT ); Tue, 18 Feb 2020 21:18:58 -0500 Received: by mail-pl1-f196.google.com with SMTP id ay11so8908367plb.0 for ; Tue, 18 Feb 2020 18:18:57 -0800 (PST) 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=Nt7KCfOCeoniLbejBgBQRi5gzr/DUGn0cHKbOhTd9/Q=; b=dOfv3pE6XbFb8+IRmXPhqeV8igWMRBbr+HjmaMwvwVzN9E/7yEORi7dYoDiXgpqnOd YbNIC741TwrprDCJYLH3GbQBZzKZBTZ4hgruvN8k6MAu7lNWg/YmqdPtnGRBKSEC7ELr 5cXWrgy6pUF46qjvO9k1oqqPXRDgof2z+DaGUJ8Ta9LjbCgSX+QG7ob36DdlOqc1tEPz pLVVNUKMkQy13ZjCvs5MYJeMBh8Yb11VwrKuj+Z7g29jZJGByTnOUD44UUa8CmSYNWTS /pXvhI7S/Ob1rEthERuwJqU9v9YToQJcP6Apb7oIpa5LZFeBFlGJNxlVAgrgF8P8QaLT HElQ== 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=Nt7KCfOCeoniLbejBgBQRi5gzr/DUGn0cHKbOhTd9/Q=; b=o/nyintBXyFFozNOJqTExjwjo2uM/9v930r+jCMhruZ1a0Z8aeEoPPVkmELGcTi2NL KV6Po+BY8rjuJ+QmAPVRMRHBqnMZNzRI2m8DiWiJei3vEbaiQX8Ll26qdn+tAmAi0Lfa tV2lQtRgAmMQKaQHYHl/UOnJwYJFcvpVf54v1CofVlesRiF8SbqTo8G/SqsNBlVguVqv qMi94NXbyjtIID7jmRD/ZLKdIn9NjLU/b71zpCMzGmnMBr8Pc2bGaSJMp2CpkUL5y8Mc LjUYNyYaLV9Hq082s9nOvLo1+wfy3HQXzm0UMHRwx63qDarDBjKWDQqWitezqcnBwnGo z6qg== X-Gm-Message-State: APjAAAX9kOvL4+OZ29o+lhnxUI8q3yiCdBo78Vn9lv18SY6cuRo2lpg0 uE1BpzqxvjLlQN0/b9FlrKqqTQ== X-Received: by 2002:a17:902:8e84:: with SMTP id bg4mr22905597plb.11.1582078736772; Tue, 18 Feb 2020 18:18:56 -0800 (PST) Received: from localhost.localdomain (li1441-214.members.linode.com. [45.118.134.214]) by smtp.gmail.com with ESMTPSA id q11sm322698pff.111.2020.02.18.18.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 18:18:56 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Robert Walker , 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 Cc: Leo Yan Subject: [PATCH v5 2/5] perf cs-etm: Continuously record last branch Date: Wed, 19 Feb 2020 10:18:08 +0800 Message-Id: <20200219021811.20067-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200219021811.20067-1-leo.yan@linaro.org> References: <20200219021811.20067-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 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: Mike Leach Reviewed-by: Mathieu Poirier --- 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 84f30c2de185..b2f31390126a 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; } @@ -1485,6 +1482,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.17.1