mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: Ian Rogers <irogers@google.com>, Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 2/3] perf test: Fix record tests on Intel Broadwell
Date: Thu, 24 Sep 2026 14:55:01 +0800	[thread overview]
Message-ID: <db502582-a090-4e8e-b720-7874af1138f0@linux.intel.com> (raw)
In-Reply-To: <CAP-5=fV1_4xC7mjmCpBarBNVd9e=ZYHAojtpK5ECuAF5u+s-Zg@mail.gmail.com>


On 9/24/2026 11:45 AM, Ian Rogers wrote:
> On Wed, Sep 23, 2026 at 2:53 PM Namhyung Kim <namhyung@kernel.org> wrote:
>> I noticed it failed for leader sampling tests on Broadwell.  It's
>> because the period of groups members are a little bit different.  Maybe
>> there's an hardware issue but anyway it's close enough to treat them as
>> same.  I printed the value like below.
>>
>>   $ perf test record
>>   ...
>>   prev: 462507, curr: 462506
>>   prev: 494783, curr: 494782
>>   prev: 454350, curr: 454349
>>   prev: 502782, curr: 502781
>>   prev: 566693, curr: 566692
>>   prev: 606558, curr: 606557
>>   prev: 559770, curr: 559769
>>   prev: 595737, curr: 595736
>>   prev: 643386, curr: 643385
>>   prev: 663672, curr: 663671
>>   prev: 620622, curr: 620621
>>   prev: 650419, curr: 650418
>>   Leader sampling [Failed inconsistent cycles count]

Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>

It looks a hardware overcount issue.  I don't see this issue on recent
platforms, like SPR+, so I suppose the issue got fixed. 

BTW, recently I found the SAMPLE_READ may report invalid counts in some
PEBS based corner sampling cases, like ACR events + SAMPLE_READ, or
multiple PEBS events simultaneously run SAMPLE_READ, I'm working on a patch
series to fix the issues.

Thanks.


>> Let's update the logic to compare values to allow 1% of errors.
>>
>> Also I think it should compare only if sees the non-leader samples so
>> split the check of (($index % 2)).
>>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> +Dapeng Mi
>
> Tested-by: Ian Rogers <irogers@google.com>
>
> Thanks,
> Ian
>
>> ---
>>  tools/perf/tests/shell/record.sh | 11 +++++++----
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
>> index cf8ba3d3411b0bcc..04df35b30b0c15fd 100755
>> --- a/tools/perf/tests/shell/record.sh
>> +++ b/tools/perf/tests/shell/record.sh
>> @@ -550,11 +550,14 @@ test_leader_sampling() {
>>    while IFS= read -r line
>>    do
>>      cycles=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="cycles:") print $(i-1)}')
>> -    if [ $(($index%2)) -ne 0 ] && [ ${cycles}x != ${prev_cycles}x ]
>> +    if [ $(($index%2)) -ne 0 ]
>>      then
>> -      invalid_counts=$(($invalid_counts+1))
>> -    else
>> -      valid_counts=$(($valid_counts+1))
>> +      if (( $(bc <<< "scale=4; r = ${cycles} / ${prev_cycles}; r >= 0.99 && r <= 1.01") ))
>> +      then
>> +        valid_counts=$(($valid_counts+1))
>> +      else
>> +        invalid_counts=$(($invalid_counts+1))
>> +      fi
>>      fi
>>      index=$(($index+1))
>>      prev_cycles=$cycles
>> --
>> 2.56.0.rc1.310.g51773c2048-goog
>>

  reply	other threads:[~2026-09-24  6:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 21:52 [PATCH 1/3] perf test: Fix errors when deleting data in perf record tests Namhyung Kim
2026-09-23 21:52 ` [PATCH 2/3] perf test: Fix record tests on Intel Broadwell Namhyung Kim
2026-09-24  3:45   ` Ian Rogers
2026-09-24  6:55     ` Mi, Dapeng [this message]
2026-09-23 21:52 ` [PATCH 3/3] perf test: Fix record tests on hybrid machines Namhyung Kim
2026-09-24  3:44   ` Ian Rogers
2026-09-24  3:39 ` [PATCH 1/3] perf test: Fix errors when deleting data in perf record tests Ian Rogers

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=db502582-a090-4e8e-b720-7874af1138f0@linux.intel.com \
    --to=dapeng1.mi@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --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

all inboxes | Powered by JetHome®