Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp955834pxb; Wed, 3 Mar 2021 22:26:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDeTbH/PZc+BX49LUaFZqvOfpSn/6lWQR9VK5RKj4Ccxw8y59qohYWSsc+o2GY+7B6Kwp0 X-Received: by 2002:aa7:ce16:: with SMTP id d22mr2655634edv.95.1614839164383; Wed, 03 Mar 2021 22:26:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614839164; cv=none; d=google.com; s=arc-20160816; b=caaywLyOLBb4ZSCOm5vBvUQld4qXQHqpcWKE2evIwSmw5v3ws7KmcxFuwyTuLVcQs8 MNX3JXvSpRRWWyRWIaM6f7yOYu2uws+Ec2v4kXDaYlt5Q8oLbTk+4/1j3AcBlKKhEZLj dKntSmguHJB5KOGOtOaNXWvbDi9uRBAdIvjU7FzybSjw7qQ1FwlwpYtJH0QeJ0YYZAZt AjOHx1E4EWfFxEOdVT3in88m4EOV0u5/+yvSC/Teb3J352/A04dbXYuJeqHl1M8xRgQv iv6fnMwePmiUU2QiFn0CUY8dqXha+DHKFkGhjPdeX4e/0qU5HcU/qtVDR7gK4Em5PtSq WwsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=B7QvNdz9JIbVex4ApMnvbHorcJfu+NDYlHxR3nM7NlI=; b=macBhZwpW/PfdDQpfH4NIx+XjNovbHuuYO8il7xbEAgsr1EdoBL0yHm+r01r2JEDbf iqckXHOw6g5fGSJR2ZX+e0o1X4uaUpg7vkGgRfvIqGO7CbXzsZtdNFran2ot848o3voo GPKj4VbFTgD0b1Ig6492om5/130yafRHVOhS/BLteb+kZBIHq67MPpCWmMre5EJ04Yl7 2PVD3FSYgn+ZBBF0x8vzENXQSr4+uBsMwc6+AiJNqpE34aK2LjYOlw1UyV8lcedeeY+9 exOfzp1XQ9l6kO3SGcf/Pl93HFT8oakpyLXQnWXUbS/Vfre47cnLn7jhhGo9zu4dVg27 Do2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=N0IeWVEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ox26si18244521ejb.4.2021.03.03.22.25.42; Wed, 03 Mar 2021 22:26:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=N0IeWVEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838918AbhCBPzT (ORCPT + 99 others); Tue, 2 Mar 2021 10:55:19 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:5288 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351150AbhCBNcx (ORCPT ); Tue, 2 Mar 2021 08:32:53 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 122D9UEg123988; Tue, 2 Mar 2021 08:31:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=B7QvNdz9JIbVex4ApMnvbHorcJfu+NDYlHxR3nM7NlI=; b=N0IeWVEmlc/c1apHBCz8a3RvGVZwhZgncbb0fBECpkJZgqNmHzsPj/9kau0g4KkWHA49 RozHJz7Ox/o2/GB+zQy9V6X+FynFq19kee4xx+PwYW33d9IdGIibfc8nt0SBO/aQbyNw qtYJA10GAfoe2k46I2OOYVARuoR7w5qvJMTEV10ZvmLep9ftNS+tkfhAlF8Mu7vfM3v5 iMz5GeeSisePg6CD01qXmajuOXmxh4ExCKbZRJQojjp3rK9Sfl1yWwfwTGTIvvEzB02C NTT3Z7A7GMH/ramWxpA8Qj3KBMwGA0CH/e4Nm92FZuPVt3UAEiEsjzZ+GLN+O8ZnbtBe 4A== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 371n8v20c2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 08:31:35 -0500 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 122DO1MJ006228; Tue, 2 Mar 2021 13:31:33 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04fra.de.ibm.com with ESMTP id 37150crd14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Mar 2021 13:31:33 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 122DVUO741812476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Mar 2021 13:31:30 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7CF0852050; Tue, 2 Mar 2021 13:31:30 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 30D4E52051; Tue, 2 Mar 2021 13:31:30 +0000 (GMT) From: Thomas Richter 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 Subject: [PATCH] perf test: Test case 27 fails on s390 and non-x86 platforms Date: Tue, 2 Mar 2021 14:31:19 +0100 Message-Id: <20210302133119.3325530-1-tmricht@linux.ibm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-02_06:2021-03-01,2021-03-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 spamscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 adultscore=0 suspectscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103020107 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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