Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp647150rwo; Wed, 2 Aug 2023 01:39:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHKOuKtBB/Rhc3OFmCXvWbWjuTySQI0uvxIfHoXmPMnE+eRBxCsNfiY+xO7YZosxZ+/1DgL X-Received: by 2002:a05:6a20:1446:b0:13d:7433:2ebf with SMTP id a6-20020a056a20144600b0013d74332ebfmr11765213pzi.60.1690965566966; Wed, 02 Aug 2023 01:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690965566; cv=none; d=google.com; s=arc-20160816; b=JanpXAV7v91DLkumO76kcnjdLk9P1UftLt0VsDRP7rMu0w4faUqFhBaLvyIeEtHx21 J0xUhJciUfPylD8dGv6u05so3DwKPRTXyFiDyURrFuxeeTTXyt4+o+Vdkqiu4Mf3voEV FE9IQxWnk6TziuCd3uW9WqsKhGr5Y3tgLery3zN4iP6/yNjIJtBjlFgdQFGLAdLHKG+B 5Vq/XbzsIDM1XR8m5fHqGIn8ZV0zlzdYIRt9XUN2pkZ77fQCCVRV5RnHh4RPkm6KsQRk 4YnT+h9GjWS1ip7kbOakuCzvuKKHpB9rrc8ANg5jZkUcoD2sj+jsav68HgT2tBH3jU/E vDBA== 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=RjM1MDJX8GWMDsSC/GmG7efvSTYhYcvcGT32HkPKieoPSss/sDUd30HpSzI5AUgM3i jWAkoNp58O/gnAtthA0YpvE6Z940/8Zw+ZOQnkbxr74atEz7BQmSby+tknPXKrdNHyI4 w9UUIju8R/2UhOEdxhhxhEDbbMBI5VDzLJRR0IEotFd4J3ojxkM7VK8aiAo1D5DYJ7v8 mx38SIl8Lu6tlRf35zJDDHOX4Vt22t0u2TuOpaxuRvTCstXbjexgtgc8/5k1n6Ix8rMX vPJ4Vn5/dEpanrxk1QzLLFZbkXOGh3yVj39/tLHACVA9nqfN7FOpgVIwB5qAlUoHin6F fPXA== 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 u186-20020a6379c3000000b00546bab11218si10212891pgc.439.2023.08.02.01.39.03; Wed, 02 Aug 2023 01:39:26 -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 S231815AbjHBHzK (ORCPT + 99 others); Wed, 2 Aug 2023 03:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233728AbjHBHyb (ORCPT ); Wed, 2 Aug 2023 03:54:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A05C95242; Wed, 2 Aug 2023 00:52:27 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RG3yR67FRztRn2; Wed, 2 Aug 2023 15:49:03 +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; Wed, 2 Aug 2023 15:52:24 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 6/7] perf test: Add test case for record sideband events Date: Wed, 2 Aug 2023 07:49:47 +0000 Message-ID: <20230802074948.136468-7-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230802074948.136468-1-yangjihong1@huawei.com> References: <20230802074948.136468-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: dggems705-chm.china.huawei.com (10.3.19.182) 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