From patchwork Mon Aug 21 01:27:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 136361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2893725vqi; Mon, 21 Aug 2023 02:59:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfi++45GsGCMZDLjc9Pi+FdBfxBywgXabBngGssDExp5Vnu+6uxRERLjAFmcc/S05q5rx5 X-Received: by 2002:a05:6402:1610:b0:525:70b3:72c2 with SMTP id f16-20020a056402161000b0052570b372c2mr4706715edv.14.1692611960427; Mon, 21 Aug 2023 02:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692611960; cv=none; d=google.com; s=arc-20160816; b=ohn1h0DZ8ktFLKo4/SidQ62R1pDzen49JB8nkhUyBVByY/tO3jWYQ9M+JStWsub9qA Dl+BkQRZx69k0w4aYdRs3GE72nK8b0fWhh7T3QBfOutaSoONxCyxDevO8Sgusu3xCXSI OoavyUU9GdeAUt+yvRTKbPZGH293q/4JlFOD7FS9PJnj3zk9KOeTEXEFuUbSWNVu+p9q aCWPFnaORBYRk3k4FCgIlGE6FSEt9gKiWEzNVxrv5VYR3xOmLbR4uvBmKu6yCkafsNA5 YxtrUjtra+d6Q29yxTAgN93H7D4nB8fbBvlHXcklcRNlPnRoyXhTvialjFYWTOSaItn4 rVow== 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=g3pdwHgmY7evmW6P2UQXVdPfh0DuDDsfo4UyXH9W6iI=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=r19rYdaRcl51BGawvalD63v7TYhQGD7DwrVdCusdQRWf8Y6C42eC8yNr1v4FydwsQD 5SkO3CNHghUsyax8LvVBEjxSCG8PZNu5orejBOfC4rk67QQwSAndp0Z/8rir2nQN70Os MvkzZZRaJjR2BS1l4GJsbSx3paqRyuMr80zqdP9vISWHuYcOmJfcN55rJ+PA6fgr+ji6 13PF7Ou9wnXUEH1RaCdwEF/1JU3e3nbSjygCgfRM3UjmejKA4FCZPVMRIZWRrOVmR3KC SoS3Bfx2/Pf+EHAtJNRz04+BRF17vjqYo0a8T1u6NZ0/DGguScSyURZn+JupziW5qwY/ kSaA== 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 w25-20020aa7dcd9000000b005254dc5ba21si5725840edu.597.2023.08.21.02.58.56; Mon, 21 Aug 2023 02:59:20 -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 S232473AbjHUBaq (ORCPT + 99 others); Sun, 20 Aug 2023 21:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbjHUBai (ORCPT ); Sun, 20 Aug 2023 21:30:38 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C3CA8; Sun, 20 Aug 2023 18:30:33 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RTZZd6Q3rztRpW; Mon, 21 Aug 2023 09:26:49 +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.31; Mon, 21 Aug 2023 09:30:30 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v6 7/7] perf test: Add perf_event_attr test for record selected CPUs exclude_user Date: Mon, 21 Aug 2023 01:27:34 +0000 Message-ID: <20230821012734.18241-8-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230821012734.18241-1-yangjihong1@huawei.com> References: <20230821012734.18241-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=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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: 1774832279287262475 X-GMAIL-MSGID: 1774832279287262475 If all (non-dummy) evsel have exclude_user, system_wide sideband is not needed. Add this test scenario. Test result: # ./perf test list 2>&1 | grep 'Setup struct perf_event_attr' 17: Setup struct perf_event_attr # ./perf test 17 -v 17: Setup struct perf_event_attr : --- start --- test child forked, pid 720198 running './tests/attr/test-record-C0-all-kernel' test child finished with 0 ---- end ---- Setup struct perf_event_attr: Ok Signed-off-by: Yang Jihong Tested-by: Adrian Hunter --- .../perf/tests/attr/test-record-C0-all-kernel | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tools/perf/tests/attr/test-record-C0-all-kernel diff --git a/tools/perf/tests/attr/test-record-C0-all-kernel b/tools/perf/tests/attr/test-record-C0-all-kernel new file mode 100644 index 000000000000..2d7549277c1e --- /dev/null +++ b/tools/perf/tests/attr/test-record-C0-all-kernel @@ -0,0 +1,32 @@ +[config] +command = record +args = --no-bpf-event --all-kernel -C 0 kill >/dev/null 2>&1 +ret = 1 + +[event:base-record] +cpu=0 + +# no enable on exec for CPU attached +enable_on_exec=0 + +# PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME | +# PERF_SAMPLE_PERIOD | PERF_SAMPLE_IDENTIFIER +# + PERF_SAMPLE_CPU added by -C 0 +sample_type=65927 + +# Dummy event handles mmaps, comm and task. +mmap=0 +comm=0 +task=0 + +# exclude_user for all-kernel option +exclude_user=1 + +[event:system-wide-dummy] + +# system_wide is not need for all (non-dummy) events have exclude_user +cpu=0 + +# exclude_user for all-kernel option +exclude_user=1 +exclude_kernel=0