Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1162817rdb; Sun, 20 Aug 2023 21:26:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhrD9eMSxtc21Gw0QxNA7Pw3fnl+3SzNiB2rvyc2AwOnYF+AdSj3tXORSpgFwYSP+lo4Ca X-Received: by 2002:a17:906:105d:b0:99d:6b79:6eda with SMTP id j29-20020a170906105d00b0099d6b796edamr3683198ejj.45.1692592005899; Sun, 20 Aug 2023 21:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692592005; cv=none; d=google.com; s=arc-20160816; b=z4z83lcmIqLQOsybfbaZ2tazYpwQqjPjGuUANzv317G+qrB2clNe5yO1tb+POGQC0S OOGp2Pww3zPKom4cti68dVz5FMwIp96gmGvo6h8ppRHNAyhhidqrxN9TwuZ49XCo0iHa Xq/KPFR51SNzFlf7cs7fXvo9JcnKEI/cptS+A6M29WIpbwK49Hw5nA8qqfhzUvDtJQ6a sV4EdHdVV1CmiR7lmmSHl8Av4+2QxMQQ8Tu2+McJChAj64yOwT7y/adI5YEG6q5Tn4eH dDIRBdjLR1T3hnP5/a9pDFZvjVkcDufr2BGVpoDolE2XoqQLdo++1ZSdc4NHQ/NpRtAt rzOQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FsMniF9X017gy4UEED6N5g8WwyFKkXtVleQIhibmdIA=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=eYRXW1tWiAk3SqVH7jMh29CYO9CGrb4UG3KVluuWzCKpY1x0VCgjv7U94CZDYZCALd trGXCbRi2PA9+fkia+Vb0fX6Z2Cnp15GDWea0qc0rJroe3STIOhqg45NBXCKNGi0hqsG GqrTxhSoyp1scMqE9VpWTHGdg8r6oF72vx3Dux5gKCEiA5EgMKbSRBA5Rcozrhz/Dm7A msseNBRvgbutCbyZbmnBynHfec/NwuLbfNfUzJ75D4sdSh+44yM0dBfyAK90OTjMl7qi auO55ov95BsemFF5Vc1o44+dwVnf4ipDjB8TvHmeyMbEi/ku4HfkacHTppZBcxLf71AL RpTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a17090682c100b0099bce5d5f77si4927494ejy.502.2023.08.20.21.26.22; Sun, 20 Aug 2023 21:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232459AbjHUBas (ORCPT + 99 others); Sun, 20 Aug 2023 21:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbjHUBai (ORCPT ); Sun, 20 Aug 2023 21:30:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F4CAF; Sun, 20 Aug 2023 18:30:32 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RTZZd1t1yztS6p; Mon, 21 Aug 2023 09:26:49 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 21 Aug 2023 09:30:30 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v6 6/7] perf test: Add test case for record sideband events Date: Mon, 21 Aug 2023 01:27:33 +0000 Message-ID: <20230821012734.18241-7-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230821012734.18241-1-yangjihong1@huawei.com> References: <20230821012734.18241-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new test case to record sideband events for all CPUs when tracing selected CPUs Test result: # ./perf test list 2>&1 | grep 'perf record sideband tests' 95: perf record sideband tests # ./perf test 95 95: perf record sideband tests : Ok Signed-off-by: Yang Jihong Tested-by: Adrian Hunter --- tools/perf/tests/shell/record_sideband.sh | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tools/perf/tests/shell/record_sideband.sh diff --git a/tools/perf/tests/shell/record_sideband.sh b/tools/perf/tests/shell/record_sideband.sh new file mode 100755 index 000000000000..2ecf00011cb1 --- /dev/null +++ b/tools/perf/tests/shell/record_sideband.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# perf record sideband tests +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=0 +perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) + +can_cpu_wide() +{ + if ! perf record -o ${perfdata} -BN --no-bpf-event -C $1 true 2>&1 >/dev/null + then + echo "record sideband test [Skipped cannot record cpu$1]" + err=2 + fi + + rm -f ${perfdata} + return $err +} + +test_system_wide_tracking() +{ + # Need CPU 0 and CPU 1 + can_cpu_wide 0 || return 0 + can_cpu_wide 1 || return 0 + + # Record on CPU 0 a task running on CPU 1 + perf record -BN --no-bpf-event -o ${perfdata} -C 0 -- taskset --cpu-list 1 true + + # Should get MMAP events from CPU 1 + mmap_cnt=`perf script -i ${perfdata} --show-mmap-events -C 1 2>/dev/null | grep MMAP | wc -l` + + rm -f ${perfdata} + + if [ ${mmap_cnt} -gt 0 ] ; then + return 0 + fi + + echo "Failed to record MMAP events on CPU 1 when tracing CPU 0" + return 1 +} + +test_system_wide_tracking -- 2.30.GIT