From: Thomas Richter <tmricht@linux.ibm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
acme@kernel.org
Cc: svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com,
heiko.carstens@de.ibm.com, kan.liang@linux.intel.com,
Thomas Richter <tmricht@linux.ibm.com>
Subject: [PATCH] perf test: Test case 27 fails on s390 and non-x86 platforms
Date: Tue, 2 Mar 2021 14:31:19 +0100 [thread overview]
Message-ID: <20210302133119.3325530-1-tmricht@linux.ibm.com> (raw)
Executing perf test 27 fails on s390:
[root@t35lp46 perf]# ./perf test -Fv 27
27: Sample parsing
--- start ---
---- end ----
Sample parsing: FAILED!
[root@t35lp46 perf]#
The root cause is
commit c7444297fd3769 ("perf test: Support PERF_SAMPLE_WEIGHT_STRUCT")
This commit introduced a test case for PERF_SAMPLE_WEIGHT_STRUCT
but does not adjust non-x86 weak linkage functions.
The error is in test__sample_parsing() --> do_test()
Function do_test() defines two structures of type struct perf_sample named
sample and sample_out. The first sets member sample.ins_lat = 117
Structure sample_out is constructed dynamically using functions
perf_event__synthesize_sample() and evsel__parse_sample().
Both functions have an x86 specific function version which sets member
ins_lat. The weak common functions do not set member ins_lat.
Later in function samples_same() both data in variable sample and sample_out
are compared. The comparison fails because sample.ins_lat is 117
and samples_out.ins_lat is 0, the weak functions never set member ins_lat.
Output after:
[root@t35lp46 perf]# ./perf test -Fv 27
27: Sample parsing
--- start ---
---- end ----
Sample parsing: Ok
[root@t35lp46 perf]#
Fixes:
commit c7444297fd3769 ("perf test: Support PERF_SAMPLE_WEIGHT_STRUCT")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
tools/perf/util/evsel.c | 8 +++++---
tools/perf/util/synthetic-events.c | 6 +++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1bf76864c4f2..c9efed5c173d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2106,10 +2106,12 @@ perf_event__check_size(union perf_event *event, unsigned int sample_size)
}
void __weak arch_perf_parse_sample_weight(struct perf_sample *data,
- const __u64 *array,
- u64 type __maybe_unused)
+ const __u64 *array, u64 type)
{
- data->weight = *array;
+ if (type & PERF_SAMPLE_WEIGHT)
+ data->weight = *array & 0xffffffff;
+ if (type & PERF_SAMPLE_WEIGHT_STRUCT)
+ data->ins_lat = (*array >> 32) & 0xffff;
}
int evsel__parse_sample(struct evsel *evsel, union perf_event *event,
diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
index b698046ec2db..af7ecbc57cbe 100644
--- a/tools/perf/util/synthetic-events.c
+++ b/tools/perf/util/synthetic-events.c
@@ -1507,9 +1507,13 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
}
void __weak arch_perf_synthesize_sample_weight(const struct perf_sample *data,
- __u64 *array, u64 type __maybe_unused)
+ __u64 *array, u64 type)
{
*array = data->weight;
+ if (type & PERF_SAMPLE_WEIGHT_STRUCT) {
+ *array &= 0xffffffff;
+ *array |= ((u64)data->ins_lat << 32);
+ }
}
int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format,
--
2.29.2
next reply other threads:[~2021-03-03 5:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 13:31 Thomas Richter [this message]
2021-03-02 14:03 ` [PATCH] perf test: Test case 27 fails on s390 and non-x86 platforms Liang, Kan
2021-03-02 14:48 ` Thomas Richter
2021-03-02 15:23 ` Liang, Kan
2021-03-02 17:08 ` Thomas Richter
2021-03-02 20:10 ` Liang, Kan
2021-03-03 7:32 ` Athira Rajeev
2021-03-03 8:23 ` Thomas Richter
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=20210302133119.3325530-1-tmricht@linux.ibm.com \
--to=tmricht@linux.ibm.com \
--cc=acme@kernel.org \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sumanthk@linux.ibm.com \
--cc=svens@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).