Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp938829rwo; Sat, 22 Jul 2023 03:29:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlGa0LnR9qJtIBdZipZOhx1VqxF80F9YF9DQNp0GJYs+0E9vwz6HYOCTRqHmQ28bXpUChQj5 X-Received: by 2002:a17:90b:2308:b0:262:f06d:c0fc with SMTP id mt8-20020a17090b230800b00262f06dc0fcmr4311152pjb.7.1690021741760; Sat, 22 Jul 2023 03:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690021741; cv=none; d=google.com; s=arc-20160816; b=0vYmSk2/FkxpoxqWJdQ9AIKe/YNbx4EaElpqJKUWRuxuMWNb1R63g0vNj64bfaJ6kK NO02hyvRGjEseYXUibOwRBx8CbpjEmPoyVJGoJVVHhAGRhNp9nWdrD9Jm6cU4Swgkic0 hOEMU38KrZsuaDMSib2g85nDRH8C8X7kM1n+GrS4K3HFaeRb0cmLom6nGsO6N4Q02HPc guvRTFHMdEGhCf5Mh5QaWo6W1K3gQbGnoWxqfkcqBvV2TCzJeRt9Go209JP3y22vbX2t PTm9/FAG5pdxwmrjlM/XPU2LWx6taDxZUpq1i2LOjSLBvfMG0d9q3EqRSUyjWFEjQlLq JLTw== 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=NRO6ll3NODRZGsv8c8lf/yozKZ6mRiA3XVYR111eioU=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=N1hVCV7fdIxzSuYBD0K9kXojPgR5hQ+2w72U2pd/hagTjDq02v3D0LOwv7ICRruT2y gysMTY0yXAFcZjqFTkb9R4cZ6+0klecwKTyUtkC5CbIzZ3IjcXbeuiTDeQAMQ8AgbIr/ l48wUbMeIh/w3OAesZ7tJgbjozKgY8vDxwDOkDqpzNBky9HBw9WfS8HZ9pWad2Y13EZT m3gr5a0ZKrb2KprGYhjaeaCwKDQsaca34uz2JBkt0rH7kNZlZpEMYKp2fPsWK8chdqOp 50+mx4oi1fpFSA/0LiQC1zfl210xmBkjlVGyHGK7pjlq24n2EQZTpxq1NAfIPaTry0rT phfg== 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 mu10-20020a17090b388a00b002590f26818asi8207389pjb.0.2023.07.22.03.28.50; Sat, 22 Jul 2023 03:29:01 -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 S229960AbjGVJeu (ORCPT + 99 others); Sat, 22 Jul 2023 05:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjGVJer (ORCPT ); Sat, 22 Jul 2023 05:34:47 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981D230E3; Sat, 22 Jul 2023 02:34:44 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R7LpV1zGkz18LXB; Sat, 22 Jul 2023 17:33:54 +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, 22 Jul 2023 17:34:41 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v3 1/7] perf evlist: Add perf_evlist__go_system_wide() helper Date: Sat, 22 Jul 2023 09:32:13 +0000 Message-ID: <20230722093219.174898-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230722093219.174898-1-yangjihong1@huawei.com> References: <20230722093219.174898-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 For dummy events that keep tracking, we may need to modify its cpu_maps. For example, change the cpu_maps to record sideband events for all CPUS. Add perf_evlist__go_system_wide() helper to support this scenario. Signed-off-by: Yang Jihong --- tools/lib/perf/evlist.c | 9 +++++++++ tools/lib/perf/include/internal/evlist.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index b8b066d0dc5e..3acbbccc1901 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -738,3 +738,12 @@ int perf_evlist__nr_groups(struct perf_evlist *evlist) } return nr_groups; } + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel) +{ + if (!evsel->system_wide) { + evsel->system_wide = true; + if (evlist->needs_map_propagation) + __perf_evlist__propagate_maps(evlist, evsel); + } +} diff --git a/tools/lib/perf/include/internal/evlist.h b/tools/lib/perf/include/internal/evlist.h index 3339bc2f1765..d86ffe8ed483 100644 --- a/tools/lib/perf/include/internal/evlist.h +++ b/tools/lib/perf/include/internal/evlist.h @@ -135,4 +135,6 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist, void perf_evlist__reset_id_hash(struct perf_evlist *evlist); void __perf_evlist__set_leader(struct list_head *list, struct perf_evsel *leader); + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel); #endif /* __LIBPERF_INTERNAL_EVLIST_H */ -- 2.30.GIT