From nobody Fri Dec 19 04:27:34 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03287214813; Tue, 8 Apr 2025 07:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098423; cv=none; b=VX5yh8tZpuzchEpC5BdTVNkCf2EztL3/jdEfrRloAmck5WQk1OzI9T1ldT09KAyEhv36Xl9BN+JVc3LWW477Xa0wl4JdBcb7GRlISiJ7K3wdA+SoovMWD7Car4his38J3J++2UHlM7yYI1VngcRS0Elz15Rgp0h0j+akGsOmBYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098423; c=relaxed/simple; bh=OaoRGleOJMBsgBZS3p1bJ8GaQzCT4TbBrlI6cVkNSyQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SXrtbohrzCN1NCUkdxFg2Yaa5wOxLDhYWHIq3EuDTxgW+vFl+/7WULzz0X7KokFVV3RLy0/XqVaW2V8bFIG7TamIK9rpZWe/bImncAcwVOrYlIu5jd9I/If/cQRkjAA72vaptvxgCwWLYUJSgyTf3n9eey0qAZvzivSTUpubPxc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=e99RX80v; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="e99RX80v" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 537KcSt5027885; Tue, 8 Apr 2025 07:46:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=zLV7/doQpEkhTR6ei1g5UJ/2k5+C2pZsALUCRt3FL 7Y=; b=e99RX80vsUuxq6VnQksfRpK/kj0C/YjqA+m+i66LLvcTy+0EdpsIgiZwk Ph/dhcCX8QRDg+h/xPIyJtd+K2NsczCTXeOfJQC6lsyou4mm+JY6w8TMN7YKe+5/ LHjT9H0bFcRI2agws1B6XFrhqzFEUx1i4ERp7Z7jjUvFZ5aGLLL/BahXT3JVDSuz yvDXC7expaYFvQJKcrTB5lA25xtsOMGvfCsts60tzcPg/cm1F2uPnZsqhHuDuoha jEpek891Bq5NuyL1rSgNEYvbo3TF2y8CWhc4jiMUoc44o3gcshDb9BvsZWiswBLw HyQuSPgomd2KpNd+gY2F3+rAavp3w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45vnx0j84a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Apr 2025 07:46:58 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 5387jvrI024572; Tue, 8 Apr 2025 07:46:57 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45vnx0j849-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Apr 2025 07:46:57 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5387inrQ014404; Tue, 8 Apr 2025 07:46:57 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 45ufunhn75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Apr 2025 07:46:56 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5387krNP60162310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Apr 2025 07:46:53 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1233C2004B; Tue, 8 Apr 2025 07:46:53 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC5B520040; Tue, 8 Apr 2025 07:46:52 +0000 (GMT) Received: from tuxmaker.lnxne.boe (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 8 Apr 2025 07:46:52 +0000 (GMT) From: Thomas Richter To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org, namhyung@kernel.org, irogers@google.com, ctshao@google.com Cc: agordeev@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com, Thomas Richter Subject: [PATCH v2] perf test: Allow tolerance for leader sampling test Date: Tue, 8 Apr 2025 09:46:41 +0200 Message-ID: <20250408074641.1471473-1-tmricht@linux.ibm.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3rjcWCOrPulP4NogmG6aFLQWFCe_OuEt X-Proofpoint-ORIG-GUID: mIy3X5RvafINGC6lTK0tsehKj-MZMfYk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=759 lowpriorityscore=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080052 Content-Type: text/plain; charset="utf-8" V2: Changed bc invocation to return 0 on success and 1 on error. There is a known issue that the leader sampling is inconsistent, since throttle only affect leader, not the slave. The detail is in [1]. To maintain test coverage, this patch sets a tolerance rate of 80% to accommodate the throttled samples and prevent test failures due to throttling. [1] lore.kernel.org/20250328182752.769662-1-ctshao@google.com Signed-off-by: Chun-Tse Shao Suggested-by: Ian Rogers Suggested-by: Thomas Richter Tested-by: Thomas Richter Signed-off-by: Thomas Richter --- tools/perf/tests/shell/record.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/reco= rd.sh index ba8d873d3ca7..b17e8b0680e2 100755 --- a/tools/perf/tests/shell/record.sh +++ b/tools/perf/tests/shell/record.sh @@ -238,22 +238,36 @@ test_leader_sampling() { err=3D1 return fi + perf script -i "${perfdata}" | grep brstack > $script_output + # Check if the two instruction counts are equal in each record. + # However, the throttling code doesn't consider event grouping. During t= hrottling, only the + # leader is stopped, causing the slave's counts significantly higher. To= temporarily solve this, + # let's set the tolerance rate to 80%. + # TODO: Revert the code for tolerance once the throttling mechanism is f= ixed. index=3D0 - perf script -i "${perfdata}" > $script_output + valid_counts=3D0 + invalid_counts=3D0 + tolerance_rate=3D0.8 while IFS=3D read -r line do - # Check if the two instruction counts are equal in each record cycles=3D$(echo $line | awk '{for(i=3D1;i<=3DNF;i++) if($i=3D=3D"cycle= s:") print $(i-1)}') if [ $(($index%2)) -ne 0 ] && [ ${cycles}x !=3D ${prev_cycles}x ] then - echo "Leader sampling [Failed inconsistent cycles count]" - err=3D1 - return + invalid_counts=3D$(($invalid_counts+1)) + else + valid_counts=3D$(($valid_counts+1)) fi index=3D$(($index+1)) prev_cycles=3D$cycles done < $script_output - echo "Basic leader sampling test [Success]" + isok=3D$(echo "scale=3D2; val=3D$invalid_counts/($invalid_counts+$valid_= counts); if (val < (1-$tolerance_rate)) { 0 } else { 1 };" | bc -q) + if [ $isok -eq 1 ] + then + echo "Leader sampling [Failed inconsistent cycles count]" + err=3D1 + else + echo "Basic leader sampling test [Success]" + fi } =20 test_topdown_leader_sampling() { --=20 2.49.0