Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2970413rwo; Thu, 3 Aug 2023 19:13:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQOszz92gSLInwmZnySktQ88iDkCkzcc2vvauAAkUT8jjhBwGrTgoLC4oKtu9Gn72+pndG X-Received: by 2002:aa7:c598:0:b0:521:e544:f3 with SMTP id g24-20020aa7c598000000b00521e54400f3mr354036edq.41.1691115211584; Thu, 03 Aug 2023 19:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691115211; cv=none; d=google.com; s=arc-20160816; b=ZIvX3nLqL/1bEznajZmQR/w1bXqnEgCkYl93I2vP3N6PP1wIxxvaFxHJPe+iiegIpV N9Ee7FthZm+dtdRqkWTBonflTLNouf8BtUCDia7jko2DQzIc0fiut0ZDbkXiNf2VlE3V vogt9WG/O71RVoa53DUe/+xV9dHbybBjRR+MbPSWnNfO4kunMuB+KIEU2avU6G+4styz ScT1Gjp/Rnenu50dgDmECbptfTqqyip/9Prcc+tsGMStSz6NNCGIpA+5KjBUshxdqSA3 kzsDoBzSxpyNppFSAqtSNXMh8phZNgKDh/6RInbjR4UkQveO4VPpp001PS5AdsK717+J K4sw== 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=jypaBz/zNYaFEtvqKZBqrQej2z9rEnB0EBPxFmTcMvQrOXLtq0sY4ODX4Rpa5PCeFO 2w6SAm5cbQeTU8y1r3a1v9OLgegKOCRI5PilqiNLoyYvlOZQnxiXRhn+eI7XsxalQC4A f55FVpQImSblcRQNFBJrgtukfkOwR0AtlRoYAkeDVOGz0I+zPOQsZN/lTVuCb2vewrpx 3w29X9uZ8cH3uyDJnXk7tCzMtYykyvf4jahKA94Q6KAveDk/Qb3lPRnZbm5Q6LAp53oQ fCCLdynfsd6qaZ/EZT81ustxGRCKjuJa2a9WC+Zj9x78wQtQROtlxtSx4ZL47HAXfZs6 w+dg== 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 v1-20020aa7d641000000b005222c5636cesi840375edr.40.2023.08.03.19.13.06; Thu, 03 Aug 2023 19:13:31 -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 S233113AbjHDCKo (ORCPT + 99 others); Thu, 3 Aug 2023 22:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbjHDCKW (ORCPT ); Thu, 3 Aug 2023 22:10:22 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8244494; Thu, 3 Aug 2023 19:10:21 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RH8HW2BhWzJrSH; Fri, 4 Aug 2023 10:07:35 +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; Fri, 4 Aug 2023 10:10:19 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v5 6/7] perf test: Add test case for record sideband events Date: Fri, 4 Aug 2023 02:07:40 +0000 Message-ID: <20230804020741.99806-7-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230804020741.99806-1-yangjihong1@huawei.com> References: <20230804020741.99806-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_H2,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