Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp938455rwo; Sat, 22 Jul 2023 03:28:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlG//u2XpUWeARD+w+4YCjfQSpMXkccePq3Z7B752UpwbQnqxAmlvVpclvxi1Id/mdYF4ynp X-Received: by 2002:a05:6808:1144:b0:396:4977:e148 with SMTP id u4-20020a056808114400b003964977e148mr7048587oiu.9.1690021701390; Sat, 22 Jul 2023 03:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690021701; cv=none; d=google.com; s=arc-20160816; b=NdM75gIwmjBRRpndnGmOrkDVDVCIIbRqS9vIJu/nmonwktxESAUb7da89UzpYSEZ0M AdKOgmdhAclHv7B7vZFV/wLbDlLvdeb2zk1QXqpiSpikq9o+By3Geo2wLYkBCe/GbeQ7 nbLqQ35WCPV6QBfM1yFlEeNCkJwacIJRCp/6GOLSfBZTBtQXhZAtX3OTn/UIOps4zjto T/d77MTvZo3ENH0aEum3Wg0/jiSRQG8ODARy6zajZBasAsDZRyW3fDiJx6YEaE/kRbsZ YvqmH1IN7Km4ytZxoxqdkY3SslKUaT2Y/ToX/9bKor/ymxnNnuPtjbalDxgQnmD7eDla h73Q== 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=iejwYS8mXOE1t7MAlx0EeafSG2w9VAh+amsIpKvufsg=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=VcLSH5JEmgoE7gg7nFOIxnrap/85ynAU/hiOsZ/Jec4R3E3Os1+jsCcFdlwisUpmtV sIru9ms4JhK64S3w5M0x5zGy7qSYVoXfWb3u5Y1n4JrSd21GkvlUUgjXR/GsrjLRBtxy j0Gyp2+jWTPka91RyVaxshJjDQykM3+bcP1a0/vz0GkgXWiqs0PQ6Aci0HwfhnfNVCx1 8DaEUF8k/4YWb6jJQs77o15Qu13zkhqdKRI8uq/ZeBTEiHoY6J8ksTTZhlZZmUVpKsTw 1RZuZEKzdC0ks1aJkqSkAjPlJVC0cMP3dnZYmKthTaOt9nVxhxy36z0kHJpGsrQkThaF OWnA== 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 kk13-20020a17090b4a0d00b002597ed3cc4fsi5252581pjb.189.2023.07.22.03.28.09; Sat, 22 Jul 2023 03:28:21 -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 S230064AbjGVJfS (ORCPT + 99 others); Sat, 22 Jul 2023 05:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjGVJes (ORCPT ); Sat, 22 Jul 2023 05:34:48 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43AB730F0; Sat, 22 Jul 2023 02:34:47 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R7LpX4mfJzrRmX; Sat, 22 Jul 2023 17:33:56 +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.27; Sat, 22 Jul 2023 17:34:44 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v3 6/7] perf test: Add test case for record sideband events Date: Sat, 22 Jul 2023 09:32:18 +0000 Message-ID: <20230722093219.174898-7-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230722093219.174898-1-yangjihong1@huawei.com> References: <20230722093219.174898-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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --- 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