From patchwork Sat Jul 15 03:29:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 120742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp4351vqt; Fri, 14 Jul 2023 20:58:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFxmCHK5sPrFRnET2MUxNzCkkkX1HEjc6REvXAjxWq+aBIt+GaOKNaGbiQh+oEja416ITg/ X-Received: by 2002:a17:906:3a19:b0:991:c566:979 with SMTP id z25-20020a1709063a1900b00991c5660979mr4758449eje.36.1689393486980; Fri, 14 Jul 2023 20:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689393486; cv=none; d=google.com; s=arc-20160816; b=BAr9CiJwcDHfOo79JMfNcYP/JgzpP1L/SwchAbyoDuenbtxcGZTV9+NxojTH3L+4+t lkSPwNm7dRUc+6z03bVQtAZwXhru71GqH7rhKvfOZVFSnXGyMif3v1eTnzSlRYJebOBB HmC0mWgTB/iq7nUH9wJDyGhbUO5ozhwDGCwBrnmUPHal/omQmWL4J6fTRE0a8BpCxv7X lXw6kjETeSPXgvH8YOlFp9Tcyd/5dSUH3CemYWAXEAKgkrD/WT193W59dyY0qcw1WPgz KakgFwE1bxZHXF1iITnyOPZWY0W8l5jWYBRDoglLQw7sk8YLmoTGsioua+2Yf209LcLz dhGQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a17090637d300b0099300425125si10020076ejc.89.2023.07.14.20.57.43; Fri, 14 Jul 2023 20:58:06 -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 S230079AbjGODcF (ORCPT + 99 others); Fri, 14 Jul 2023 23:32:05 -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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771457465259595273 X-GMAIL-MSGID: 1771457465259595273 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