linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kan.liang@linux.intel.com
To: acme@kernel.org, namhyung@kernel.org, irogers@google.com,
	peterz@infradead.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Cc: adrian.hunter@intel.com, ak@linux.intel.com, eranian@google.com,
	Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH V3 2/9] perf report: Remove the first overflow check for branch counters
Date: Tue, 13 Aug 2024 09:02:01 -0700	[thread overview]
Message-ID: <20240813160208.2493643-3-kan.liang@linux.intel.com> (raw)
In-Reply-To: <20240813160208.2493643-1-kan.liang@linux.intel.com>

From: Kan Liang <kan.liang@linux.intel.com>

A false overflow warning is triggered if a sample doesn't have any LBRs
recorded and the branch counters feature is enabled.

The current code does OVERFLOW_CHECK_u64() at the very beginning when
reading the information of branch counters. It assumes that there is at
least one LBR in the PEBS record. But it is a valid case that 0 LBR is
recorded especially in a high context switch.

Remove the OVERFLOW_CHECK_u64(). The later OVERFLOW_CHECK() should be
good enough to check the overflow when reading the information of the
branch counters.

Fixes: 9fbb4b02302b ("perf tools: Add branch counter knob")
Acked-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
 tools/perf/util/evsel.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d607056b73c9..f22f402d54cc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2884,8 +2884,6 @@ int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
 		array = (void *)array + sz;
 
 		if (evsel__has_branch_counters(evsel)) {
-			OVERFLOW_CHECK_u64(array);
-
 			data->branch_stack_cntr = (u64 *)array;
 			sz = data->branch_stack->nr * sizeof(u64);
 
-- 
2.38.1


  parent reply	other threads:[~2024-08-13 16:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 16:01 [PATCH V3 0/9] Support branch counters in block annotation kan.liang
2024-08-13 16:02 ` [PATCH V3 1/9] perf report: Fix --total-cycles --stdio output error kan.liang
2024-08-13 18:44   ` Arnaldo Carvalho de Melo
2024-08-13 20:06     ` Liang, Kan
2024-08-13 16:02 ` kan.liang [this message]
2024-08-13 16:02 ` [PATCH V3 3/9] perf evlist: Save branch counters information kan.liang
2024-08-13 16:02 ` [PATCH V3 4/9] perf annotate: Save branch counters for each block kan.liang
2024-08-13 16:02 ` [PATCH V3 5/9] perf evsel: Assign abbr name for the branch counter events kan.liang
2024-08-13 16:02 ` [PATCH V3 6/9] perf report: Display the branch counter histogram kan.liang
2024-08-13 16:02 ` [PATCH V3 7/9] perf annotate: " kan.liang
2024-08-13 16:02 ` [PATCH V3 8/9] perf script: Add branch counters kan.liang
2024-08-13 16:02 ` [PATCH V3 9/9] perf test: Add new test cases for the branch counter feature kan.liang
2024-08-13 19:00 ` [PATCH V3 0/9] Support branch counters in block annotation Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240813160208.2493643-3-kan.liang@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).