From: "Mi, Dapeng" <dapeng1.mi@linux.intel.com>
To: "Liang, Kan" <kan.liang@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Thomas Richter <tmricht@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
acme@kernel.org, linux-s390@vger.kernel.org,
james.clark@linaro.org, agordeev@linux.ibm.com,
gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com
Subject: Re: [PATCH 2/2 v3] perf test: Change event in perf test 114 perf record test subtest test_leader_sampling
Date: Fri, 7 Feb 2025 10:15:32 +0800 [thread overview]
Message-ID: <d041a9b4-3948-4aa0-985c-632b2eb9b64c@linux.intel.com> (raw)
In-Reply-To: <69f7d048-e7dd-4863-a21f-2d8fafafd280@linux.intel.com>
On 2/6/2025 10:25 PM, Liang, Kan wrote:
>
> On 2025-02-06 12:42 a.m., Mi, Dapeng wrote:
>> On 2/4/2025 11:55 PM, Liang, Kan wrote:
>>> On 2025-02-03 10:42 p.m., Namhyung Kim wrote:
>>>> Add Kan and Dapeng to CC.
>>>>
>>>> Thanks,
>>>> Namhyung
>>>>
>>>>
>>>> On Fri, Jan 31, 2025 at 11:27:56AM +0100, Thomas Richter wrote:
>>>>> On s390 the event instructions can not be used for recording.
>>>>> This event is only supported by perf stat.
>>>>>
>>>>> Change the event from instructions to cycles in
>>>>> subtest test_leader_sampling.
>>>>>
>>>>> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
>>>>> Suggested-by: James Clark <james.clark@linaro.org>
>>>>> Reviewed-by: James Clark <james.clark@linaro.org>
>>>>> ---
>>>>> tools/perf/tests/shell/record.sh | 10 +++++-----
>>>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
>>>>> index fe2d05bcbb1f..ba8d873d3ca7 100755
>>>>> --- a/tools/perf/tests/shell/record.sh
>>>>> +++ b/tools/perf/tests/shell/record.sh
>>>>> @@ -231,7 +231,7 @@ test_cgroup() {
>>>>>
>>>>> test_leader_sampling() {
>>>>> echo "Basic leader sampling test"
>>>>> - if ! perf record -o "${perfdata}" -e "{instructions,instructions}:Su" -- \
>>>>> + if ! perf record -o "${perfdata}" -e "{cycles,cycles}:Su" -- \
>>>>> perf test -w brstack 2> /dev/null
>>> As a non-precise test, using cycles instead should be fine. But we
>>> should never use it for precise test, e.g., with p. Because cycles is a
>>> non-precise event. It would not surprise me if there is a skid when
>>> reading two cycles events at the point when the event overflow occurs.
>>>
>>> Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
>> Kan, I suppose you mean only the case without counter snapshot, right? With
>> counter snapshot's help, there would be same period even for non-precise
>> events, right?
> No, the counter-snapshot doesn't help. That's why I suggested to not
> utilize it via enabling the modifier p. It should work for most of the
> cases. But it's not 100% guaranteed for some non-precise events that the
> same period is got at overflow. Since it's a test that could be run
> everywhere, the occasional false alarm would just bring troubles.
>
> Without p, it falls back to the traditional way of handling the sampling
> read. In the PMI handler, the global control is disabled first, then all
> the counters are read. The value may not be very accurate, since it's
> stopped at the PMI handler, not the counter overflow. But because of the
> global control, all the counters stop at the same time. The skid would
> be the same. The test should work.
Got it. Thanks for explaining.
>
> Thanks,
> Kan
>>
>>> Thanks,
>>> Kan
>>>
>>>>> then
>>>>> echo "Leader sampling [Failed record]"
>>>>> @@ -243,15 +243,15 @@ test_leader_sampling() {
>>>>> while IFS= read -r line
>>>>> do
>>>>> # Check if the two instruction counts are equal in each record
>>>>> - instructions=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="instructions:") print $(i-1)}')
>>>>> - if [ $(($index%2)) -ne 0 ] && [ ${instructions}x != ${prev_instructions}x ]
>>>>> + 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 ]
>>>>> then
>>>>> - echo "Leader sampling [Failed inconsistent instructions count]"
>>>>> + echo "Leader sampling [Failed inconsistent cycles count]"
>>>>> err=1
>>>>> return
>>>>> fi
>>>>> index=$(($index+1))
>>>>> - prev_instructions=$instructions
>>>>> + prev_cycles=$cycles
>>>>> done < $script_output
>>>>> echo "Basic leader sampling test [Success]"
>>>>> }
>>>>> --
>>>>> 2.48.1
>> The code changes look good for me.
>>
>>
next prev parent reply other threads:[~2025-02-07 2:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 10:27 [PATCH 0/2 v3] perf test: perf record tests (114) changes Thomas Richter
2025-01-31 10:27 ` [PATCH 1/2 v3] perf test: Fix perf test 114 perf record test subtest precise_max Thomas Richter
2025-01-31 10:27 ` [PATCH 2/2 v3] perf test: Change event in perf test 114 perf record test subtest test_leader_sampling Thomas Richter
2025-02-04 3:42 ` Namhyung Kim
2025-02-04 15:55 ` Liang, Kan
2025-02-04 19:33 ` Namhyung Kim
2025-02-04 19:40 ` Liang, Kan
2025-02-06 5:42 ` Mi, Dapeng
2025-02-06 14:25 ` Liang, Kan
2025-02-07 2:15 ` Mi, Dapeng [this message]
2025-01-31 16:22 ` [PATCH 0/2 v3] perf test: perf record tests (114) changes James Clark
2025-02-05 18:39 ` Namhyung Kim
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=d041a9b4-3948-4aa0-985c-632b2eb9b64c@linux.intel.com \
--to=dapeng1.mi@linux.intel.com \
--cc=acme@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=james.clark@linaro.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=sumanthk@linux.ibm.com \
--cc=tmricht@linux.ibm.com \
/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).