Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3214966rwp; Fri, 14 Jul 2023 20:48:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFUDtLSayaZG7lOnv5KVYgIvGSduNCi2OYr9YjGP2PFDwcKx41SXcIiq5WC2zH2luivXYkG X-Received: by 2002:a05:6402:27ce:b0:51d:cfeb:fc3b with SMTP id c14-20020a05640227ce00b0051dcfebfc3bmr787501ede.1.1689392932572; Fri, 14 Jul 2023 20:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689392932; cv=none; d=google.com; s=arc-20160816; b=nPVnPIWde7fDANPKUenEYRRJaTrLiGbPP9N8LdBGfrEcMAJJA1cm1s6F4y5E0xL19z w3plFGWojNhG89qAziGVrhZy6OG27TuZpNtxFhy9jjkaG5BpKtEmzS201Pr/TmBe9uLZ RsrYJf8nt6w2tODsojsstc/wwCdSOGTIeDcxgdD2OHocWZJ7Ib9tYr3AjWznErCCvHgq ATZg9fcKQ1QQTvjB8hoEtRMSo5JXnAH//RR9PSHrYr9WTWaFyQiMQe9ikuQWBuihZ8cs Y4q7s0A4KmPQFxQfrX8oP6mAPtQm4U4p+usirS32tnWr/L2AaC10PN25j2IrPUmkPzWP zRYQ== 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=U7/nH6h+1TtIa5MrmS1IezEGgpmVONO1g4fV6/3NCiw=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=XkLsEHVatzyNNYigrphwLOD/OYQT3qdQ3WwvksNH23crSdrxQkN8qTnwhN93lPU40V k2WsN/JruYCh9DFy8IH/0LJk3TV/gYlZENNO7h9pZ2gbwSqW3xISZl6Kr/7QTmQDuk4A HONDSOIRcxzS5SP5cEpM6lWn1Ulu8/YHRV2pMETvv0Z1Vu9k1hkM+ypRLlJ/urM/9L4U FGoDJ8xxwNYW2hu+Sb3hFWYgD6+JwsEP8mU29k7p8hAacysdnJBvDqtOgKMTR823uBnW B9SCXQkU21Tcawsd1jhzeC0YSfSh5aC+R6rc/A34mF5csbeW+8jAjJ2Z69FpA3nIjZ8n my4A== 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 r16-20020aa7da10000000b00521770bcf78si166525eds.438.2023.07.14.20.48.28; Fri, 14 Jul 2023 20:48:52 -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 S230263AbjGODcE (ORCPT + 99 others); Fri, 14 Jul 2023 23:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjGODbi (ORCPT ); Fri, 14 Jul 2023 23:31:38 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715EB1BF9; Fri, 14 Jul 2023 20:31:37 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R2v4x0KFyz18LrJ; Sat, 15 Jul 2023 11:30:57 +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, 15 Jul 2023 11:31:34 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v2 7/7] perf test: Add test case for record sideband events Date: Sat, 15 Jul 2023 03:29:15 +0000 Message-ID: <20230715032915.97146-8-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230715032915.97146-1-yangjihong1@huawei.com> References: <20230715032915.97146-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=-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_tracking.sh | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tools/perf/tests/shell/record_tracking.sh diff --git a/tools/perf/tests/shell/record_tracking.sh b/tools/perf/tests/shell/record_tracking.sh new file mode 100755 index 000000000000..44fc0af92f81 --- /dev/null +++ b/tools/perf/tests/shell/record_tracking.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 -e dummy:u -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} -e dummy:u -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